ClickPay provides you with multiple methods for using ApplePay, for easy-to-use integration, and even more easy implementation for developers.


for a better understanding, you can check What is ApplePay? this is a highly recommended step.


TABLE OF CONTENTS


Postman Endpoint Example

For the purposes of this article, you will need to use the following postman endpoint example for testing and integrating; for proceeding with this, please click here.




Payment Flow

Once the customer clicks on the ApplePay "PAY" button, this would trigger the ApplePay wallet on the OS to pop up. After that, the customer will have to choose one of the saved cards on the wallet to initiate the payment using it.


A request would be sent to ApplePay once the customer selects the card, which will return the ApplePay token parts that are required by ClickPay ApplePay Payment request endpoint. This would allow the payment to be initiated using the token sent from the merchant server side to the ClickPay side. Check the ApplePay documentation for a better understanding of the flow. 

In other words, the payment flow of this endpoint is summarized as shown below:


- ApplePay button would trigger the Wallet Screen to Popup

- Choosing a card would return an apple_pay_token

- The applepay_token would be sent to the merchant server-side.

- Merchant server-side would make the ApplePay payment request.



ApplePay Payment

Sample Request Payload

As the payment page is on your side (merchant side), you must send a payment request using the transaction API after receiving the card details from your payment page. You will need to include the card and customer details in the payment request.


Post{{domain}}/payment/request



{
    "profile_id": 47125,
    "tran_type": "sale",
    "tran_class": "ecom",
    "cart_id": "cart_88888",
    "cart_description": "Sample Payment",
    "cart_currency": "{{currency}}",
    "cart_amount": "1",
    "return": "none",
    "customer_details": {
        "name": "John Smith",
        "email": "jsmith@gmail.com",
        "street1": "404, 11th st, void",
        "city": "Dubai",
        "country": "AE",
        "phone": "97333333101",
        "ip": "99.99.00.00"
    },
    "apple_pay_token": {
        "paymentMethod": {
            "network": "Visa",
            "type": "Debit",
            "displayName": "Visa 4228"
        },
        "transactionIdentifier": "D32A2C43FCC4314A668FFDB95B0F38D0BEF0B2F6AC8569CC433607BA51D25301",
        "paymentData": {
            "data": "P\/l0iLnWAj393LZyMjdblyJHo8zUrAv2i73tcSnFkLDCFkuk35oh5+CCA7G6rBFXD0O6iu3kS3cE+yW3uhS88vI7jqMMG4bnJ0GdJUckJ6P7o++IurHG0bIHhOlu8gqL\/1Bd73sHAKp4eK8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2azEKkCIQCb90ECiwGTt4TOm194OCo9wusSNlZipzmy1XBPohv8sAAAAAAAAA==",
            "header": {
                "publicKeyHash": "dQ1T3uh4uMRK7OAynypjLF7V9NWdL49JVKIHU+jDsww=",
                "ephemeralPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEcPy\/H\/285E6ruf9Y4Yn3D41MdtLFRqdGVPoXr6wWpWk\/cBr31AZSVWCorIu4HT92GNy5efMcinrAyev2Mwy+zg==",
                "transactionId": "d32a2c43fcc4314a668ffdb95b0f38d0bef0b2f6ac8569cc433607ba51d25301"
            },
            "version": "EC_v1"
        }
    }
}


Sample Response Payload

{
  "tran_ref": "TST2222801314561",
  "merchant_id": 31237,
  "profile_id": 47125,
  "cart_id": "cart_88888",
  "cart_description": "Sample Payment",
  "cart_currency": "SAR",
  "cart_amount": "1",
  "tran_currency": "SAR",
  "tran_total": "133.00",
  "tran_type": "Sale",
    "customer_details": {
        "name": "John Smith",
        "email": "jsmith@gmail.com",
        "street1": "404, 11th st, void",
        "city": "Riyadh",
        "country": "SA",
        "phone": "96633333101",
        "ip": "99.99.00.00"
    },
  "payment_result": {
    "response_status": "A",
    "response_code": "G43489",
    "response_message": "Authorised",
    "acquirer_message": "00:Approved",
    "acquirer_rrn": "220210096025",
    "transaction_time": "2022-08-16T09:51:29Z"
  },
  "payment_info": {
    "payment_method": "ApplePay",
    "card_type": "Debit",
    "card_scheme": "Visa",
    "payment_description": "Visa 4228",
    "expiryMonth": 12,
    "expiryYear": 2023
  },
  "serviceId": 2
}