Accept payments with Apple Pay
Through the Apple Pay service, buyers can make payments using the credit or debit cards stored in their Apple Pay accounts. When using the Native API method, the merchant frontend needs to directly integrate the Apple Pay SDK. After obtaining the card asset information, call Antom’s pay (One-time Payments) API to initiate the payment. For details on integrating the Apple Pay SDK, refer to Apple Pay on the Web or Apple Pay (Native).
Note: When integrating Apple Pay using the Native API method, you need to have your own Apple merchant identifier and certificate. For the Apple Pay Web integration method, merchants must complete domain verification on Apple’s side.
User experience
The following figures demonstrate the user experience of paying with Apple Pay:
Web
Mobile
Integration preparations
Before you start integrating, read the Integration Guide and API Overview documents to understand the integration steps of the server-side API and the precautions for calling the API. Furthermore, ensure that the following prerequisites are met:
- Obtain a client ID
- Complete the key configuration
- Complete the configuration of paymentNotifyUrl to receive the asynchronous notification
- Integrate the server-side SDK package, install the server-side library, and initialize a request instance. For more details, refer to Server-side SDKs.
Integration Steps
Follow these steps to start the integration:
- Decrypt ApplePayPaymentToken
- Initiate an authorized payment
- Obtain the authorization result
- Capture
Step 1: Decrypt ApplePayPaymentToken
When the buyer completes Apple Pay payment authorization using Touch ID, Face ID, or a passcode, the frontend obtains ApplePayPaymentToken in the Apple Pay authorization event. For details, refer to onpaymentauthorized (Web)orpaymentAuthorizationViewController:didAuthorizePayment:handler: (Native). After you obtain ApplePayPaymentToken, you can choose one of the following methods to decrypt the token and call the pay (One-time Payments) API to initiate an authorized payment request.
- Hosted decryption: Antom manages certificates and performs decryption on your behalf, so you do not need to be PCI-qualified.
- Merchant decryption: You manage your own certificates and perform decryption operations yourself, and this mode requires that you are PCI-qualified.
Step 2: Initiate an authorized payment Server-side
The parameters required for initiating an authorized payment differ depending on the decryption method used. Refer to the corresponding instructions based on the decryption method you adopt.
Hosted decryption
The following illustrates the payment flow for Antom-hosted decrypted ApplePayPaymentToken:
After you obtain ApplePayPaymentToken and delegate its decryption to Antom, use Antom’s card authorization payment capability to initiate the payment. You can pass the decrypted ApplePayPaymentToken through the paymentMethod.paymentMethodMetaData.applePayConfiguration parameter in the pay (One-time Payments) API.
Before using hosted decryption for ApplePayPaymentToken, you need to complete the certificate exchange process. Generate a Payment Processing Certificate according to Antom’s standard and provide it to Antom for configuration. The steps are as follows:
- When generating the CSR, you need to specify the DN values to Antom CN (Common Name). The CN (Common Name) is typically used to identify the organization name or project name.
- L: Locality name
- ST: State or province name
- O: Organization name, typically the company’s legal name.
- (Optional) OU: Organizational unit name
- C: Country name
- Antom generates the CSR certificate and delivers it to you. You then uploads the CSR to Apple Developer, downloads the Payment Processing Certificate with .CER suffix, and then sends it to Antom.
- Antom completes the configuration after obtaining the CER file.
If you have any questions, contact Antom SA for support.
Note: When using this integration method, pay attention to the expiration time of the CER certificate, and contact Antom Technical Support (TechnicalService@antom.com) at least one month before the certificate expires to complete the certificate renewal.
Follow Step 1: Initiate an authorized payment to call the pay (One-time Payments) API and submit the payment request. You need to pass in the basic parameters, order parameters, and device parameters in the payment request. While you do not need to pass in card payment parameters, you need to pass in the following parameters:
Parameter name | Required | Description |
paymentMethod.paymentMethodType | Yes | |
paymentMethod.paymentMethodMetaData.applePayConfiguration.applePayToken | Yes | Pass in ApplePayPaymentToken you obtained. |
For more information about the parameters used to initiate an authorized payment, refer to Step 1: Initiate an authorized payment.
public static void payByApplePayServer2Server() {
AlipayPayRequest alipayPayRequest = new AlipayPayRequest();
alipayPayRequest.setProductCode(ProductCodeType.CASHIER_PAYMENT);
// replace with your paymentRequestId
String paymentRequestId = UUID.randomUUID().toString();
alipayPayRequest.setPaymentRequestId(paymentRequestId);
// set amount
Amount amount = Amount.builder().currency("SGD").value("4200").build();
alipayPayRequest.setPaymentAmount(amount);
// set paymentMethod
PaymentMethod paymentMethod = PaymentMethod.builder().paymentMethodType("APPLEPAY").build();
alipayPayRequest.setPaymentMethod(paymentMethod);
// set ApplePay related parameters-hosted decryption
Map<String, String> applePayToken = new HashMap<String, String>();
applePayToken.put("applePayToken", "{\"paymentData\":{....}");
paymentMethodMetaData.put("applePayConfiguration", applePayToken);
paymentMethod.setPaymentMethodMetaData(paymentMethodMetaData);
// replace with your orderId
String orderId = UUID.randomUUID().toString();
// set buyer info
Buyer buyer = Buyer.builder().referenceBuyerId("yourBuyerId").build();
// set order info
Order order = Order.builder()
.referenceOrderId(orderId)
.orderDescription("antom testing order")
.orderAmount(amount)
.buyer(buyer)
.build();
alipayPayRequest.setOrder(order);
// set env info
Env env = Env.builder().terminalType(TerminalType.WEB).clientIp("1.2.3.4").build();
alipayPayRequest.setEnv(env);
// replace with your notify url
alipayPayRequest.setPaymentNotifyUrl("https://www.yourNotifyUrl.com");
// replace with your redirect url
alipayPayRequest.setPaymentRedirectUrl("https://www.yourMerchantWeb.com");
// pay
AlipayPayResponse alipayPayResponse = null;
try {
alipayPayResponse = CLIENT.execute(alipayPayRequest);
} catch (AlipayApiException e) {
String errorMsg = e.getMessage();
// handle error condition
}
}The following shows the sample code of a request:
{
...........
"paymentMethod": {
"paymentMethodType": "APPLEPAY",
"paymentMethodMetaData": {
"applePayConfiguration":{
"applePayToken": "{\"paymentData\":{\"data\":\"a9+mMMEXE5iIL***\",\"signature\":\"MIAGCSqGSIb***\",\"header\":{\"publicKeyHash\":\""Ch94ASjh***\"",\"ephemeralPublicKey\":\"MFkwEw****\",\"transactionId\":\"940bf1714c***\"},\"version\":\"EC_v1\"},\"paymentMethod\":{\"displayName\":\"Visa 0869\",\"network\":\"Visa\",\"type\":\"debit\"},\"transactionIdentifier\":\"940bf17****\"}"
}
},
},
...........
}Merchant decryption
The following illustrates the payment flow merchant-decrypted ApplePayPaymentToken:
After you obtain ApplePayPaymentToken, decrypt it according to Apple Pay’s Payment token format reference to retrieve the DPAN information. Once you have obtained the DPAN information, use Antom’s card authorized payment capability to initiate the payment. For more information about the parameters used to initiate an authorized payment, refer to Step 1: Initiate an authorized payment.
Note: Using this mode requires that you are PCI-qualified.
The following are key parameters for initiating a authorized payment request:
Parameter name | Required | Description |
paymentMethod.paymentMethodType | Yes | |
paymentMethod.paymentMethodMetaData.cardNo | Yes | Pass in the value of the applicationPrimaryAccountNumber parameter from the obtained DPAN information. |
paymentMethod.paymentMethodMetaData.expiryMonth | Yes | Pass in the month value of the applicationExpirationDate parameter from the obtained DPAN information. |
paymentMethod.paymentMethodMetaData.expiryYear | Yes | Pass in the year value of the applicationExpirationDate parameter from the obtained DPAN information. |
paymentMethod.paymentMethodMetaData.mpiData.cavv | No | Pass in the value of the paymentData.onlinePaymentCryptogram parameter from the obtained DPAN information. |
paymentMethod.paymentMethodMetaData.mpiData.eci | No | Pass in the value of the paymentData.eciIndicator parameter from the obtained DPAN information. |
public static void payByApplePayServer2Server() {
AlipayPayRequest alipayPayRequest = new AlipayPayRequest();
alipayPayRequest.setProductCode(ProductCodeType.CASHIER_PAYMENT);
// replace with your paymentRequestId
String paymentRequestId = UUID.randomUUID().toString();
alipayPayRequest.setPaymentRequestId(paymentRequestId);
// set amount
Amount amount = Amount.builder().currency("SGD").value("4200").build();
alipayPayRequest.setPaymentAmount(amount);
// set paymentMethod
PaymentMethod paymentMethod = PaymentMethod.builder().paymentMethodType("APPLEPAY").build();
alipayPayRequest.setPaymentMethod(paymentMethod);
// set ApplePay related parameters-merchant decryption
Map<String, Object> paymentMethodMetaData = new HashMap<String, Object>();
paymentMethodMetaData.put("cardNo", "***********");
paymentMethodMetaData.put("expiryMonth", "11");
paymentMethodMetaData.put("expiryYear", "30");
MpiData mapiDate = new MpiData();
mapiDate.setCavv("Af9**********A=");
mapiDate.setEci("5");
paymentMethodMetaData.put("mpiData", mapiDate);
paymentMethod.setPaymentMethodMetaData(paymentMethodMetaData);
// replace with your orderId
String orderId = UUID.randomUUID().toString();
// set buyer info
Buyer buyer = Buyer.builder().referenceBuyerId("yourBuyerId").build();
// set order info
Order order = Order.builder()
.referenceOrderId(orderId)
.orderDescription("antom testing order")
.orderAmount(amount)
.buyer(buyer)
.build();
alipayPayRequest.setOrder(order);
// set env info
Env env = Env.builder().terminalType(TerminalType.WEB).clientIp("1.2.3.4").build();
alipayPayRequest.setEnv(env);
// replace with your notify url
alipayPayRequest.setPaymentNotifyUrl("https://www.yourNotifyUrl.com");
// replace with your redirect url
alipayPayRequest.setPaymentRedirectUrl("https://www.yourMerchantWeb.com");
// pay
AlipayPayResponse alipayPayResponse = null;
try {
alipayPayResponse = CLIENT.execute(alipayPayRequest);
} catch (AlipayApiException e) {
String errorMsg = e.getMessage();
// handle error condition
}
}The following shows the sample code of a request:
{
........
"paymentMethod": {
"paymentMethodType": "APPLEPAY",
"paymentMethodMetaData": {
"cardNo":"***********",
"expiryYear":"30",
"expiryMonth":"12",
"mpiData":{
"cavv":"Af9xA/3bAyP6CAP3FngiMAABAAA="
"eci":"5"
}
},
},
.........
}Step 3: Obtain the authorization result Server-side
After the buyer completes payment or the payment times out, you can obtain the payment result either by receiving asynchronous notifications from Antom or by proactively querying the result. For detailed steps, refer to Step 3: Obtain the authorization result.
Step 4: Capture Server-side
After successful authorization, Antom will automatically initiate capture for you, or you can choose to initiate capture manually. After capture, you can obtain the capture result either via asynchronous notification or active query. You should decide whether to ship goods based on the capture result. For specific steps, refer to Capture.
After payments
After completing the payment, you can perform the following actions:
Cancellation Server-side
For successful payments, if the buyer requests cancellation or a refund on the same day, you can use Antom’s cancellation capability to cancel the order or release funds. Orders not yet completed can also be cancelled directly. For details, refer to Cancel.
Refund Server-side
To learn about Antom refund rules and how to initiate a refund for a successful transaction, see Refund for more information.
Dispute Server-side
Antom provides dispute resolution services for contested transactions. For more information, refer to Dispute Guidance and Dispute resolution.
ReconciliationServer-side
After the transaction is completed, use the financial reports provided by Antom for reconciliation. For more information on how to reconcile and the settlement rules of Antom, refer to Reconciliation.
Additional content
Card payment features
Card payment features also apply to Apple Pay. The following table outlines the support status of these features for Apple Pay:
Type | Supported | Conditions |
| Antom Tokenization | Conditional |
|
| COF | Conditional | Only supported in MIT (Merchant-Initiated Transaction) scenarios. |
| 3D Secure 2 | Yes | After completing 3D Secure 2 authentication, Apple Pay passes the encrypted transaction cryptogram and ECI (E-Commerce Indicator) to Antom. Antom processes this authentication data following standard third-party card network procedures. For details, refer to Apple Developer: Payment token format reference. As a result, no additional 3DS authentication flow will be triggered by the payment method within Checkout Page, ensuring a seamless user experience. It is recommended to use the default values for the is3DSAuthentication and enableAuthenticationUpgrade parameters when initiating payment requests. |
| Antom 3DS-Retry | Yes | None |
| MIT | Yes | None |
| Installment payments | No | None |