Skip to main content

ApplePay

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 ApplePay developer.

  1. ApplePay 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 Merchant Identity Certificate
  • Generate a CSR (Certificate Signing Request) using Keychain or OpenSSL on a Mac.
  • Go back to Apple Developer → Certificates → Add Certificate.
  • After uploading the CSR, Apple returned a .cer file.
  • Download and install it locally, then export the .p12 file.
  • .p12 is used for payment gateways or intermediate servers to conduct signed and encrypted communication with Apple.
  1. Configure Merchant Domain whitelist
  1. Obtain the Apple Pay Payment Token. View the complete ApplePay example, pass the Token to Oceanpayment via the pay_accountNumber parameter, and call Server to Server integration.
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();

}