Apple Pay Token

Streamlining Secure Payments with Apple Pay Direct Integration

Instructions to keep in mind before you start.

Initial Mapping

TAP issues a 'CSR' file against the merchant keys as a mandatory requirement, that allows the merchant to generate a CER from the ApplePay side. This 'CER' needs to be shared with TAP to synchronize it with the merchant account.
follow steps here


ApplePay token

On click, the merchant needs to get the ApplePay token data generated by Apple. Apple's reference

Sample Date (ApplePay token)

{
	"data": "CM8i9PNK4yXtKO3",
	"header": {
		"ephemeralPublicKey": "MFkwEwYHKoZIzZHA==",
		"publicKeyHash": "LjAAyv6vOR2uCTHIkB61DaYdEWD+w=",
		"transactionId": "0c4352c073ad460044a3ec5295"
	},
	"signature": "MIAGCSqGSI=",
	"version": "EC_v1"
  }

Getting TAP token

Pass the ApplePay token in the API call and get a TAP token_id in response

API request

Sample request

{
  "type": "applepay",
  "token_data": {
    "data": "CM8i9PNK4yXtKO3xmOn6uyYOWmQ+iX9/Oc0EWHJZnPZ/IAEe2UYNCfely3dgq3veEygmQcl0s8lvMeCIZAbbBvbZWPKng9lfUwP2u3IUOFfFyI4beE9znpQ/e0nyQiVh8NFyZun8o0/YZfdFhaBy8bunveULZkWODZy3vg1LLTk0wSRfzbiFav/krgeMvztl8U85Fefl1VJVoJbW/jtShwDkusHizw/p/hkLiOFcCYSz7h9culZQMTWfqsxIfTuY3mOl+NhjAHPP+UFv4wefXrQL9MKO2cI6ttXOp5k6M6mFV/Qe0fbmJ6GnDWDMSiikW+3eL0yi0IApAKmmVgPS+uk42dyhrnSPhB6A7EJBmhEEb3ErL1I69Jq9REjDHp+VoZR0fAbDtpbjKKMo",
    "header": {
      "ephemeralPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAELAfDie0Ie1TxCcrFt69BzcQ52+F+Fhm5mDw6pMR54AzoFMgdGPRbqoLtFpoSe0FI/m0cqRMOVM2W4Bz9jVZZHA==",
      "publicKeyHash": "LjAAyv6vb6jOEkjfG7L1a5OR2uCTHIkB61DaYdEWD+w=",
      "transactionId": "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MBAf8EBTADAQH/MB8GA1UdIwQYMBaAFLuw3qFYM4iapIqZ3r6966/ayySrMDcGA1UdHwQwMC4wLKAqoCiGJmh0dHA6Ly9jcmwuYXBwbGUuY29tL2FwcGxlcm9vdGNhZzMuY3JsMA4GA1UdDwEB/wQEAwIBBjAQBgoqhkiG92NkBgIOBAIFADAKBggqhkjOPQQDAgNnADBkAjA6z3KDURaZsYb7NcNWymK/9Bft2Q91TaKOvvGcgV5Ct4n4mPebWZ+Y1UENj53pwv4CMDIt1UQhsKMFd2xd8zg7kGf9F3wsIW2WT8ZyaYISb1T4en0bmcubCYkhYQaZDwmSHQAAMYIBjDCCAYgCAQEwgYYwejEuMCwGA1UEAwwlQXBwbGUgQXBwbGljYXRpb24gSW50ZWdyYXRpb24gQ0EgLSBHMzEmMCQGA1UECwwdQXBwbGUgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxEzARBgNVBAoMCkFwcGxlIEluYy4xCzAJBgNVBAYTAlVTAghoYPaZ2cynDzANBglghkgBZQMEAgEFAKCBlTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0yMDAxMjIxMTE1MjdaMCoGCSqGSIb3DQEJNDEdMBswDQYJYIZIAWUDBAIBBQChCgYIKoZIzj0EAwIwLwYJKoZIhvcNAQkEMSIEIOpHDrXFlLPMYwCXIjWNFUjfzhciVuMVbo/lYkYVLbq0MAoGCCqGSM49BAMCBEcwRQIhAN6zsYadN6EB+PBaRL8fR5IVa320R8InvhGX/VEwQMwjAiBvIT8mVUHcDe4FPRt3KcKfPRVhK2Sc6gT5+vIZjdLCGQAAAAAAAA==",
    "version": "EC_v1"
  },
  "client_ip": "192.168.1.20"
}
https://api.tap.company/v2/tokens

API response

A token_id is expected in the API response, and it also contains the card information.

{
    "id": "tok_CUBiv13xxxx2ZiYP5XXXXX",
    "object": "token",
    "created": 1626080791506,
    "live_mode": true,
    "type": "APPLEPAY",
    "used": false,
    "card": {
        "id": "card_CJXexxxx0124U5y527506",
        "object": "card",
        "funding": "DEBIT",
        "fingerprint":
"33096067e5a3af19xxxxxxxxxce0a467ad2ae4fa2a324af2196c98f85ba25",
        "brand": "VISA",
        "exp_month": 12,
        "exp_year": 23,
        "last_four": "9xx5",
        "first_six": "4xxx12",
        "payment_data_type": "3DSecure"
    }

Charge the Token

Sample to control the source object in the charge API: with "token_id"

{
...
	"source": {
		"id": "tok_CUBiv13xxxx2ZiYP5XXXXX"
}
"post": {
    "url": "https://webhook.site/fd8b0712-d70a-4280-8d6f-9f14407b3bbd"
 },
 "redirect": {
    "url": "https://customer.redirection_url"
  }
...
}

Payment would be captured from the card, and the API response would be as status:captured, which Means successfully completed.