Apple Pay in sandbox and production environments

Toast provides and maintains access to both sandbox and production environments. These environments are for testing and using Apple Pay payments. You must use the sandbox environment first to test your Apple Pay integration in a realistic setting before testing your integration in a production environment. For more information on service environments, see Environments.

Note

If you do not have sandbox credentials, contact the Toast integrations team.

Quick-start Apple Pay integration

This guide provides a high-level overview of how to set up and create Apple Pay payments in both sandbox and production environments. For detailed information about Toast’s Apple Pay API, see Apple Pay API.

The steps to set up and create Apple Pay payments are:

Hosting the static domain verification file overview

Note

For detailed information about hosting the static domain verification file for a production integration, see Hosting the static domain verification file.

The static domain verification file is sent from Apple for each merchant ID registered to use Apple Pay. The first step is to host the production version of the file. You can use the file for both sandbox and production environments.

wget https://www.toasttab.com/.well-known/ME_prod_toast
Registering an Apple Pay integration overview

Note

For detailed information about registering an Apple Pay integration for a production integration, see Registering an Apple Pay integration.

The next step is to register your Apple Pay payment integration. It is important to use the correct hostname when authorizing an Apple Pay payment. For the sandbox environment, you must register using the sandbox hostname provided by the Toast integrations team. If your Apple Pay integration is approved to go live, you will receive a hostname for the production environment. For more information on hostnames, see Environments.

Building an Apple Pay payment interface overview

Note

For detailed information about building an Apple Pay payment interface for a production integration, see Building an Apple Pay payment interface.

The next step is to build your Apple Pay payment interface using the Apple® JavaScript API. The web interface is what guests can use to make Apple Pay payments. You can use the same script for both sandbox and production environments.

Creating an Apple Pay payment session overview

Note

For detailed information about creating an Apple Pay payment session for a production integration, see Creating an Apple Pay payment session.

The final step is to make a request to create an Apple Pay payment session. Note that the request body is the same for both sandbox and production environments, but the validationURL is different. The validationURL for each environment is:

  • Sandbox: apple-pay-gateway-cert.apple.com

  • Production: apple-pay-gateway.apple.com

Sandbox

{
  "validationURL": "https://apple-pay-gateway-cert.apple.com/paymentservices/paymentSession",
  "domain": "nicerestaurant.com",
  "restaurantName": "Nice Restaurant",
  "integrationIdentifier": "4f3d3ab6-feec-430c-9669-8844b9c818f6_nice_restaurant"  
}

Production

{
  "validationURL": "https://apple-pay-gateway.apple.com/paymentservices/paymentSession",
  "domain": "nicerestaurant.com",
  "restaurantName": "Nice Restaurant",
  "integrationIdentifier": "4f3d3ab6-feec-430c-9669-8844b9c818f6_nice_restaurant"  
}