Process the payment data

To process the payment data and finalize the payment, you must deliver the payment credentials (payment token) to your payment gateway (PG). You get the payment credentials as the paymentCredential object from the output of the startInAppPayWithCustomSheet() method.

The paymentCredential object structure varies depending on your PG and the token mode (direct or indirect):

  • The following code snippet is an example of the direct network token for a Visa card.
    {
        "billing_address": {
            "city": "BillingCity",
            "country": "USA",
            "state_province": "CA",
            "street": "BillingAddr1",
            "zip_postal_code": "123456"
        },
        "card_last4digits": "1122",
        "3DS": {
            "data": "eyJhbGciOiJSU0ExXzUiLCJraWQiOiJCak91a1h2aFV4WU5wOFIwVGs2Y25OaCtZWWFqZXhIeHRVZ0VFdHlhYy9NPSIsInR5cCI6IkpPU0UiLCJjaGFubmVsU2VjdXJpdHlDb250ZXh0IjoiUlNBX1BLSSIsImVuYyI6IkExMjhHQ00ifQ.Fg2OOUvHdGKkIVyBa2S5KtUrPWUeujKZEyxz7n6kALhQahszv3P5JaBaOJ-RoKcznFjDg3qierzjktU7zXST9gwv4Oclahpfdw64w0X6TtAxeYJiIVkJUG-edXXTWaJeyeIkgC68wEhF1CltSqG4zLWi6upVCAywdPpBN0Hl0C5WcF5Az4WABYtV_Fda5aHGuyPnE70kEQRTWdlacW9MzEJx2Xth7Msd9OHoulR8LUQ-7gha17jHoOBwgMoQ9q0hAoCNm0LjWiuhKoRyyu-Njulnbkk8FZus_AIuMgdv2YN9ygFqIlMculb0VWuF0YeKX6IsgAxi0ZQhLiUsJkCZ_w.AuZZxoG46lnrtk3Q.QE2llwS30VzH-ZduuE8b045CnfRm2p-RjZGBnZcHELS3v26N64cFg1AV5mtP5f-fSwbJ3ntP5x4V1NK8FmdY0uSPxzeMfvl5badGAC7w9FrXt6X5xV1Fqu6-q-ZkbxcB9bYgownt983BcKOE1bd5djxFBOdLrc4j68ikDjc5M3LEBDx6hV0aQzKmilCH-JeVL3AwQyKBny4Vj7m3Fizw7u1PRLI2ZfWUkXDfS4Vwv3bPm4QUDEMVnHXJ.qTYmdmn4ne93juljNmWkJg",
            "type": "S",
            "version": "100"
        },
        "merchant_ref": "MerchantId",
        "method": "3DS",
        "recurring_payment": false
    }
    
  • The following code snippet is an example of the indirect gateway token used by Stripe.
    {
        "reference": "tok_18rje5E6SzUi23f2mEFAkeP7",
        "status": "AUTHORIZED"
    }
    

To send the payment credentials to your PG:

  1. In case of a direct network token, decrypt the encrypted data (the 3DS element) using your private key.

    The following code snippet is an example of a private key.

    -----BEGIN RSA PRIVATE KEY-----
    MIIEowIBAAKCAQEA4LZYjQR+dqd/XLEOXct9jwTJXHD2PTJke9djtMIjKi0h2Oc2GHoW4uJHHY/1jvFt2+zCnjTOXuVLp+76/DWA3bCwFRj+fPP6x5KKYlPb+dJDYo1TTumltNqCWymJB3u7jBC+xR4vKfRzqjxkE7xhN/SBb82uE8c3sMzVKYnUJi<…>
    -----END RSA PRIVATE KEY-----
    

    The following code snippet is an example of the decrypted output.

    {
       "amount": "1000",
       "currency_code": "USD",
       "utc": "1490266732173",
       "eci_indicator": "5",
       "tokenPAN": "1234567890123456",
       "tokenPanExpiration": "0420",
       "cryptogram": "AK+zkbPMCORcABCD3AGRAoACFA=="
    }
    
  2. Send the payment token to your PG based on their requirements:

    • In case of a direct network token, you can send either the entire paymentCredential output or just the extracted 3DS element. For guidance, contact your PG.
    • In case of an indirect gateway token, send the entire paymentCredential output to the appropriate payment processing API provided by the PG, for example, if your PG is Stripe, send the token to Charge.