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

  1. Download the SDK for iFrame
  2. Enable and configure Apple Pay
  3. Set up the domain verification file
  4. Apple Pay tokenized bundle is received from the iFrame, which is is then processed by WePay
  5. Ensure that email and notification functionality is available through the triggers
    • payments.created
    • payments.updated
    • payments.completed
    • payments.failed
Domain Verification

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:

  1. Download the verification file that Apple provides. This file will be the same for all WePay merchants:

  2. Host the domain verification file in the following format: https://yourdomain.com/.well-known/apple-developer-merchantid-domain-association.
  3. In your codebase or the merchant’s codebase, make sure the verification file is in a folder called .well-known.
  4. Apple will make a request to https://yourdomain.com/.well-known/apple-developer-merchantid-domain-association (no filename extension) and verify the file.
  5. 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.

Copy
Copied
	{
		"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.
Copy
Copied
	{
		"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

VerbAPI EndpointDescription
POST/accounts/{id}/payment_methods/apple_pay/registerRegister merchant domains as an apple pay web merchant using WePay
POST/accounts/{id}/payment_methods/apple_pay/unregisterUnregister merchant domains as an apple pay web merchant using WePay
GET/accounts/{id}/payment_methods/apple_payGet all domains and other related info the apple has on their database with their registration involving WePay as a ecommerce platform
The Response Codes
DescriptionResponse Code to PartnerDescription
Ok200Ok/Return GetMerchantInfo Reponse body
Bad Request400The Input is Invalid: malformed request or domain is not ready to accept Apple Pay Payments
Unauthorized. WePay's Merchant ID is not registered with Apple500Internal 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 payments500Internal 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 Error500Issue Connecting to Apple Pay

Response Body

The response body for GET /accounts/{id}/payment_methods/apple_pay will be in the following form:
Copy
Copied
{
	"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."
}
Once the response is received from the payor, create a token from the response data and generate a POST /payment_methods to complete the transaction.