Skip to main content

Apple Pay

FeatureDescription
Payment Logo - Usage Guidelines
Integration Methods
  1. ✅ Hosted Checkout
  2. ✅ Embedded
  3. ✅ Server-to-Server
Recommended RegionsGlobal
Virtual Industry Support
Subscription Support✅ Varies by industry
Supported SaaSAll integrated SaaS platforms
Supported Open-Source Platforms
  1. ✅ Magento
  2. ✅ WordPress/Woocommerce
  3. ✅ OpenCart
  4. ✅ PrestaShop
  5. ✅ ZenCart

Integration Method

Embedded

When using embedded integration,

  1. Merchants need to host domain verification files for each domain they register at the following path and ensure that the files at this path are accessible: Click to ⬇️ download the domain verification file.
https://[DOMAIN_NAME]/.well-known/apple-developer-merchantid-domain-association
Notice

If you have multiple subdomains or other domains, you need to add the above verification files, for example:

https://example.com/.well-known/apple-developer-merchantid-domain-association  
https://test.example.com/.well-known/apple-developer-merchantid-domain-association
···
  1. Initiate domain verification:
cURL -X POST 'https://mds.oceanpayment.com/appleregistermerchant'
-H 'Authorization: MVc9Lt1CDY7RBRUvh8iVmvvPbYF3uvWkymUDz'
-d '{
"website": ["example.com,test.example.com"]
}'
  1. Errors
Response codeDescription
200OK
  • Success.
400Bad Request
  • The request is malformed or invalid.
401Unauthorized
  • The request is malformed or invalid.
417Expectation Failed
  • The e-commerce platform isn’t registered with Apple Developer.
500Internal Server Error
  • An internal server error occurred.
  1. After domain verification is complete, Apple Pay will be displayed as a payment option on the checkout page, where possible.
Notice

Apple Pay is only available on Apple devices that support it (such as the Safari web browser and iOS devices), and the button will only be displayed on iOS 17 and above.

  1. The integration was completed using the Embedded integration solution.

Server to Server

To use this integration mode, you need to become an official Apple Pay developer.

  1. Apple Pay Developer Account Registration and Configuration
  • Visit https://developer.apple.com.
  • Choose the Apple Developer Program.
  • Payment integration requires a corporate account; personal accounts cannot create Merchant IDs.
  1. Create Merchant ID
  • Log in Apple Developer → Certificates, Identifiers & Profiles.
  • Click the menu on the left Identifiers → Merchant IDs → (+), create Merchant ID.
  1. Generate Payment Processing Certificate
  • Generate a CSR (Certificate Signing Request) using Keychain or OpenSSL on macOS.
  • Create a certificate of type Payment Processing Certificate.
  • Upload the CSR and download the issued .cer file.
  • Install the certificate into your local Keychain.
  • Export it as a .p12 file (including the private key).
    The .p12 file is used on your server to decrypt the Apple Pay payment token.
  1. Configure Merchant Domain whitelist
  1. Refer to the complete example of Apple Pay to obtain the JSON format of the Apple Pay Payment Token below.
{
"data": "ned7UHi3Uti0VPrayQVZ7lIEBBeahdv02bFf65k4xVNzoMCm1ansTK+dbeoCb5doLRIm7FWYjJOmUE2/HMARrLvuzeWhX2ILKfQ9n3KqGXrTQC8M+YrbHS0eQZXBFBSlNeebn+izrbSzk+xmxBXGrK1R8/ov7q+i5/1q64+a0Eh1QGscBbweOuvBOsJl1CSSYvoRXF3GTHO1c80fGE1GWtHBPjDmhtjl7Al57lZPBenfnA/PXCx1NeUQPJcfNIXY/Ax9q2GjVk2nfXyGepvB8cXpdYZ7gqCo6V13B28D7qX3/AJo1CWEeH8ulVNbRu2sJKoE5/vIOmXXmUJY/2gwCQOnebXxtLjGlOJO8DiOAFDEdQx6pGpi9Ckzi8S7IU294s=",
"signature": "MIAGCSqGSIb3DQEHAqCAMIACAQExDTALBglghkgBZQMEAgEwgAYJKoZIhvcNAQcBAACggDCCA+MwggOkxNz2lPUyBTeXN0ZSBJbmMuMQGSM49AwEHA0IABMIVd+3r1seyIY9o3XCQoSGNx7C9bywoPYRgldlK9KVBG4NCDtgR80B+gzMfHFTD9+syINa61dTv9JKJiT58DxOjggIRMIICDTAMBgNVHRMBAf8EAjAAMB8GA1UdIwQYMBaAFCPyScRPk+TvJ+bE9ihsP6K7/S5LMEUGCCsGAQUFBwEBBDkwNzA1BggrBgEFBQcwAYYpaHR0cDovL29jc3AuYXBwbGUuY29tL29jc3AwNC1hcHBsZWFpY2EzMDIwggEdBgNVHSAEggEUMIIBEDCCAQwGCSqGSIb3Y2QFATCB/jCBwwYIKwYBBQUHAgIwgbYMgbNSZWxpYW5jZSBvbiB0aGlzIGNlcnRpZ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AKwAnvO9+06yugF6pninfzLfwNOyHvKDdOM+MweabfSU1GjG3fN9tLc6mvz1g1RGuIQrrqhfb2MCSzBGcY7R2Q==",
"transactionId": "627f630d5f403f676697ee779752abe338e9a05e8ba92b111bb69dd1f43cbb15"
},
"version": "EC_v1"
}
  1. Pass the token to Oceanpayment via the pay_accountNumber parameter, and initiate a Server to Server API request.
const paymentRequest = {
countryCode: 'US',
currencyCode: 'USD',
total: {
label: 'OceanPayment Checkout',
amount: '10.00',
},
supportedNetworks: ['visa', 'masterCard', 'amex'],
merchantCapabilities: ['supports3DS'],
merchantIdentifier: 'merchant.oceanpayment.test',
};

session.onpaymentauthorized = function (event) {
const payment = event.payment;
console.log(JSON.stringify(payment));
console.log(JSON.stringify(payment.token));

processPayment(payment.token).then(function (response) {
console.log("response from datatrans received");
console.log(response);

if (response.match(/status=.error./)) {
console.log("an error occured!");
console.log(response);
return session.abort();
}

session.completePayment(ApplePaySession.STATUS_SUCCESS);
window.location.href = "/success.html";
});

};


function processPayment(paymentToken) {
let paymentMethod = paymentToken.paymentMethod;
let cardType = paymentMethod.network;
let environment = document.getElementById('environment').value;

let account = payParams[environment].account;
let terminal = payParams[environment].terminal;
let orderNo = new Date().getTime();
let orderCurrency = document.getElementById('#order_currency').value;
let orderAmount = document.getElementById('#order_amount').value;

document.getElementById('form').action = payParams[environment].url;
document.getElementById('account').value = account;
document.getElementById('terminal').value = terminal;
document.getElementById('pay_accountNumber').value = paymentToken.paymentData;
document.getElementById('card_type').value = cardType;
document.getElementById('order_number').value = orderNo;
document.getElementById('order_amount').value = orderAmount;
document.getElementById('methods').value = 'ApplePay';

let billingId = document.getElementById('billing_id').value;
let billingFirstName = document.getElementById('billing_firstName').value;
let billingLastName = document.getElementById('billing_lastName').value;
let billingEmail = document.getElementById('billing_email').value;

let signString = account + terminal + orderNo + orderCurrency + orderAmount
+ billingId + billingFirstName + billingLastName + billingEmail + payParams[environment].secureCode;

document.getElementById('signValue').value = sha256_digest(signString);
document.getElementById('form').submit();

}