Skip to content
Josh Monroe edited this page Mar 20, 2018 · 5 revisions

Gateway iOS SDK Documentation

Basic Transaction Lifecycle

Payment Flow

Components

  • Merchant Mobile App: A mobile app integrated with the Gateway Mobile SDK
  • Merchant Web Service: A web service, hosted and maintained on the merchant's servers, which will handle sending authenticated requests to the Gateway.
  • Gateway: An instance of your Gateway provider.

Steps

  1. The mobile app requests a new Session from the merchant service. This is an authenticated call, meaning it requires a private API password, which is why it needs to be carried out on a secure server, rather than the mobile device.
  2. The merchant service calls Create a Session on the Gateway.
  3. Information about the newly created session is returned to the merchant service, including the Session Id.
  4. The Session Id + the version of the API used to create it is returned back to the mobile app. Updating the session with card details must use the same Gateway API version number that created it.
  5. Card information is collected from the card holder and sent directly to the Gateway using the SDK method provided.
  6. A success / fail message is returned to the app in the appropriate callback method.
  7. The app then requests to complete the transaction with the merchant service.
  8. The merchant service performs the appropriate transaction operation with the Gateway.
  9. The Gateway returns the summary of the transaction attempt to the merchant service.
  10. The success / fail status is returned to the mobile app.

Implementation

Using an existing Session Id, you may pass card information directly to the Gateway object:

var request = GatewayMap()
request[at: "sourceOfFunds.provided.card.nameOnCard"] = "<#name on card#>"
request[at: "sourceOfFunds.provided.card.number"] = "<#card number#>"
request[at: "sourceOfFunds.provided.card.securityCode"] = "<#security code#>"
request[at: "sourceOfFunds.provided.card.expiry.month"] = "<#expiration month#>"
request[at: "sourceOfFunds.provided.card.expiry.year"] = "<#expiration year#>"

gateway.updateSession("<#session id#>", apiVersion: <#Gateway API Version#>, payload: request) { (result) in
switch result {
case .success(let response):
print(response.description)
case .error(let error):
print(error)
}
}

3-D Secure Authentication

For more information, visit the 3-D Secure Authentication wiki page

Clone this wiki locally