1.3. Android SDK UI Systems Interaction - Aigul-Irgalina/personal_test GitHub Wiki

SDK UI Systems Interaction

If you are implementing SDK UI (SDK UI contains SDK Core) then you need to do following integrations.

Card binding

Step Requirement text
1 HostApp (merchant mobile application) sends request to MerchantServer (merchant backend) to get mobile token (requestMobileToken).
2 MerchantServer sends POST request (JSON) with valid access token to UnlimintServer (API v3 endpoint https://cardpay.com/api/mobile/token) to get mobile token .Request header: valid access_token for merchant. Request parameters: request.id - request ID, should be unique for 30 minutes time period, request.time - request attempt date and time up to milliseconds in ISO 8601 format (milliseconds are optional part).Example: {"request": {"id": "{{$guid}}","time": "{'yyyy-MM-dd'T'HH:mm:ss.SSS'Z'}"}}
3 UnlimintServer returns response to MerchantServer with requested mobile token:- mobile_token (string, unique identifier, 128 symbols),- expires (date and time of mobile token expiration in ISO 8601 format, format example - yyyy-MM-dd'T'HH:mm:ss.SSS'Z').Mobile token is only one-time use for payment operations.
4 MerchantServer sends mobile token to the HostApp.
5 HostApp sends request to MerchantServer to create a payment.
6 MerchantServer creates a payment record and unique order id (aka merchantOrderId).
7 MerchantServer responds to HostApp with generated merchantOrderId.
8 HostApp calls bindNewCardForResult(mobileToken) method of the mobile SDK.
9 Customer fills in card data in card data form (SDK manages the screen).
10 Mobile SDK sends request with customer data, card data, mobile token to UnlimintServer to bind a card.
11, 15 (11) If 3DS verification is required, UnlimintServer sends a card binding response with transaction id and redirect URL (for 3DS verification) to the mobile SDK.(15) Otherwise UnlimintServer sends a card binding response with transaction id.
12 Mobile SDK returns transaction id to the HostApp.
13 HostApp sends transaction id to the MerchantServer.
14 Mobile SDK presents a webview with 3dsUrl to the customer for 3-D Secure verification.
15 3-D Secure verification procedure passes and customer is redirected to success or decline url (bindingResult).
16 UnlimintServer sends callback to the MerchantServer (with merchantOrderId, transaction id and filing id).
17, 18, 19 MerchantServer compares order id from point 6 with received merchantOrderId and saves a received filing id for a future use (recommended to do).

Checkout and payment

Step Requirement text
1-7 Similar to the binding scenario.
8 HostApp calls paymentForResult(mobileToken) method of the mobile SDK and transmits a list of required payment methods. If paymentWithToken is in this list, then cardTokens and masked PANs should be transmitted too.
9 Mobile SDK requests UnlimintServer for available payment methods. This request is called checkout.
10 UnlimintServer responds with a list of available payment methods.
11 Mobile SDK shows the intersection of required and available methods to the customer.Possible scenarios:- if there are several methods in this intersection, all those methods will be shown to the customer,- if there is only one method in this intersection, customer payment data form will be shown to the customer,- if there is only paymentWithToken in this intersection and there are several cardTokens, list of available cardTokens will be shown to the customer,- if there is only paymentWithToken in this intersection and only one cardToken, pre-filled card data form will be shown to the customer,- if intersection is empty, SDK will return an exception.
12 Customer chooses method (if possible).
13 Customer fills in customer payment data form if needed (SDK manages the screen).
14 Mobile SDK sends request with customer data, card data, mobile token to UnlimintServer to make a payment.
15, 19 (15) If 3DS is required UnlimintServer sends a payment response with transaction id and redirect URL (for 3DS verification) to the mobile SDK.(19) Otherwise UnlimintServer sends a payment response with transaction id
16 Mobile SDK returns transaction id to the HostApp.
17 HostApp sends transaction id to the MerchantServer.
18 Mobile SDK presents webview with 3dsUrl to the customer for 3-D Secure verification.
18 3-D Secure verification procedure passes and customer is redirected to success or decline url (paymentResult).
20 UnlimintServer sends callback to the MerchantServer (with transaction id and merchantOrderId).
21, 22, 23 MerchantServer compares order id from point 6 with received merchantOrderId and saves a received card token for a future use (if paymentMethod was bankCard and generateToken was true).