Apple Pay iFrame
Out Of Scope
Apple Pay with WePay does not currently support Nonprofits.
The Apple Pay iFrame allows your platform to offer a digital wallets solution to merchants. The iFrame is an embeddable component that can be hosted on the checkout page for merchants. Merchants' customers can choose Apple Pay as a contactless alternate method of payment.
Requirements
- Download the SDK for iFrame
- Enable and configure Apple Pay
- Set up the domain verification file
- Apple Pay tokenized bundle is received from the iFrame, which is is then processed by WePay
- Ensure that email and notification functionality is available through the triggers
- payments.created
- payments.updated
- payments.completed
- payments.failed
Apple requires additional verification of the domains that will host/contain the Apple Pay button. Before payments can be accepted via Apple Pay, the platform or the merchant must register all domains that will host the Apple Pay button.
Domain verification steps:
- Download the verification file that Apple provides. This file will be the same for all WePay merchants:
- Host the domain verification file in the following format:
https://yourdomain.com/.well-known/apple-developer-merchantid-domain-association
. - In your codebase or the merchant’s codebase, make sure the verification file is in a folder called
.well-known
. - Apple will make a request to
https://yourdomain.com/.well-known/apple-developer-merchantid-domain-association
(no filename extension) and verify the file. - Apple will check that the file is hosted at the provided URL to verify the domain.
Required
Every merchant must have each one of their domains registered with Apple.
Who does the registration?
We handle the domain registration through the endpoint:
POST /accounts/{id}/payment_methods/apple_pay/register
with the following request body. Note that merchant_url
is optional. {
"domain_names": ["https://example.com", "https://example2.com", "https://example3.com", "...etc"],
"merchant_url": "http://merchantdomain.com",
"partner_merchant_name": "Merchant Selling a Product or Service, Inc."
}
The
POST /accounts/{id}/payment_methods/apple_pay/register
endpoint allows you to unregister a domain. {
"domain_names": ["https://example.com", "https://example2.com", "https://example3.com", "...etc"],
"reason": "Changed domain"
}
The
GET /accounts/{id}/payment_methods/apple_pay
endpoint retrieves all Apple Merchant details with regard to your Apple Pay registration.If the you are hosting the merchant's domain for them, then you would register all their merchant's domains and host the verification file either via Partner Center or via an API interaction.
If the merchant has a sub-domain within your domain or if they have their own e-commerce website, they can register their domains themselves using Merchant Center.
Response Schema
Verb | API Endpoint | Description |
---|---|---|
POST | /accounts/{id}/payment_methods/apple_pay/register | Register merchant domains as an apple pay web merchant using WePay |
POST | /accounts/{id}/payment_methods/apple_pay/unregister | Unregister merchant domains as an apple pay web merchant using WePay |
GET | /accounts/{id}/payment_methods/apple_pay | Get all domains and other related info the apple has on their database with their registration involving WePay as a ecommerce platform |
Description | Response Code to Partner | Description |
---|---|---|
Ok | 200 | Ok/Return GetMerchantInfo Reponse body |
Bad Request | 400 | The Input is Invalid: malformed request or domain is not ready to accept Apple Pay Payments |
Unauthorized. WePay's Merchant ID is not registered with Apple | 500 | Internal Server Error: WePay's credentials might need to be remade due to expiration or other possible error with the merchant ID/Domain configuration |
Expectation Failed. WePay's Merchant ID is not configured correctly to handle ApplePay payments | 500 | Internal Server Error: WePay's credentials might need to be remade due to expiration or other possible error with the merchant ID/Domain configuration |
Internal Server Error | 500 | Issue Connecting to Apple Pay |
Response Body
The response body for
GET /accounts/{id}/payment_methods/apple_pay
will be in the following form:{
"domain_names": ["https://example.com", "https://example2.com", "https://example3.com", "...etc"],
"merchant_url": "http://merchantdomain.com",
"partner_merchant_name": "Merchant Selling a Product or Service, Inc."
}
POST /payment_methods
to complete the transaction.