- Clone the project
- # for Netlify and set up the Payment Example on your site
- # for Netlify
- Import your cloned GitHub repository and create a new site
- Do not change any configuration or settings. This has already been added to the netlify.toml file we provided.
-
Create secret and publishable API keys
- Add your secret API key to the
tilledSecretApiKey
variable inapp.js
- Add your publishable API Key to the
pk_PUBLISHABLE_KEY
variable inindex.html
- Add your secret API key to the
-
View your list of connected accounts and either use the auto-created
Shovel Shop (demo)
account or create your own connected account. Note: Prefix the name of the account with an asterisk (ex. '*The Surf Shop') to bypass needing to submit an onboarding form.- Add an active connected Account ID to the
account_id
variable inindex.html
- Add an active connected Account ID to the
-
Create an Apple Developer Account (this will be used when testing Apple Pay on your Website)
- On your Apple Developer Account, create a Sandbox Tester Account.
- # to your Sandbox Tester Account on a Compatible Device you would like to test out your integration on.
- Once you are signed in, you will add a Test Card Number to your Apple Pay Wallet using one of the Test Cards provided by Apple.
- When you created your site by importing your cloned repository to your new Netlify site, it had already deployed. Every time a change is made to the repository, the site is re-deployed. (i.e a change is made to the code or a file is added, moved, or deleted)
Apple's Documentation for Apple Pay on the Web instructs you to create a >Merchant Identifier, Payment Processing Certificate, and to Register your Domain through them. Tilled takes care of all of this on your behalf when you verify your Domain through our API using our Apple Domain Verification File.
You must register and verify all top-level domains and subdomains where you will display the Apple Pay button. For example, if you were to host a Payment Form that displays the Apple Pay button on https://pay.example.com/
and https://example.com/
, you will need to complete Domain Verification for both.
In the Production environment, to receive your Domain Verification files for Apple Pay, you will need to reach out to the Onboarding Team at integrations@tilled.com and provide the following information:
- On how many domains do you plan to host the Apple Pay button?
- If each Merchant will be using a different domain or subdomain, you will need to include that in your answer if the Merchant will be hosting the Apple Pay button.
- You will need to register and verify all top-level domains and subdomains where you will display the Apple Pay button. For example, if you were to host a payment form that displayed the Apple Pay button on `https://pay.example.com/` and `https://example.com/`, you would need to complete domain verification for both.
How many merchants are you planning to enable Apple Pay for?
Will you be using your own payment/checkout page (using Tilled.js) or Tilled’s Checkout Sessions?
- In this example, we have already added Tilled's Apple Domain Verification File and it should be reachable at
/.well-known/apple-developer-merchantid-domain-association
in the domain path. You can find the file in the repo here.- Make sure the file is accessible in your domain at
https://YOURDOMAIN.com/.well-known/apple-developer-merchantid-domain-association
. The page should either show the contents of what is shown here or the file should be automatically downloaded when visiting the page.
- Make sure the file is accessible in your domain at
- After confirming that your file is being hosted and is accessible, you will need to utilize Tilled's API to Create an Apple Domain, which will verify the Domain through Apple.
Example: POST /v1/apple-pay-domains Request
$ curl -X POST 'https://sandbox-api.tilled.com/v1/apple-pay-domains' \
-H 'tilled-account: {{MERCHANT_ACCOUNT_ID}}' \
-H 'tilled-api-key: {{SECRET_KEY}}' \
-H 'Content-Type: application/json' \
--data-raw '{"hostname": "https://example.com"}'
Example: POST /v1/apple-pay-domains Response
{
"updated_at": "2019-08-24T14:15:22Z",
"created_at": "2019-08-24T14:15:22Z",
"id": "string",
"hostname": "string",
"account_id": "string"
}
- After successful Domain Verification, you are now able to start accepting Payments on your site.
After completing the steps above, you will follow the instructions below to access your publicly facing domain where the server is being hosted:
- # to your Apple Sandbox Tester Account on the device you are using
- If you haven't already, use Apple's Test Cards to add a card to your Apple Pay Wallet
- In Safari, open the link to your publicly-facing domain where the example is being hosted.
- ** you are not able to make payments with Apple Pay in localhost **
- Click the Buy with Pay Button under Pay with Card.
- Authorize the payment through the Apple Pay pop-up.
Optional: Look in the browser's developer console to see payment intent creation logs
- Go here to see your payment
To complete a card or ACH payment without using Apple Pay, complete the following steps:
- Navigate to your example's domain in your browser.
- Enter
4037111111000000
as the test card number with a valid expiration date and123
as the CVV Code and click Pay
Optional: Look in the browser's developer console to see payment intent creation logs
- Go here to see your payment
- To pay with ACH, you can click on the ACH tab and enter the following details:
- Routing Number:
011000138
- Account Number: Any 12-digit number can be passed as an account number.
- Routing Number:
This example was made with Apple Pay in mind and will show errors if you are not using a compatible device or browser, if you would like to see a payment example without Apple Pay, you can use our simple-payment-example.