Apple Pay
Render a native Apple Pay button that handles the complete Apple Pay session, including the payment sheet, Touch ID/Face ID, and confirmation.
How it works
1 Create session (server)
2 Initialise SDK (client)
3 Mount Apple Pay button
4 Customer authenticates
Native Apple Pay UI and sheet
Biometric authentication (Touch ID / Face ID)
One-tap checkout experience
Safari + compatible browsers
Payment details sourced from session token
Works with HTML/JS and React
Before getting started
1. Get your credentials
1 Request a development store with an ecommerce subscription from your Teya contact
2 Log in to the Staging Business Portal with your Teya ID
3 Select your store and go to Integrations
4 Create ecommerce API credentials and configure webhook URLs
You'll receive a Client ID and Client Secret for OAuth authentication
Use
client_credentials grant to obtain access tokens Each store has its own set of credentials
Staging vs Production
Use Staging for development and testing. When ready to go live, repeat the credential setup in Production. Keep separate credentials and token caches for each environment.
2. API URLs
| Service | Staging | Production |
|---|---|---|
| Online Payments API | https://api.teya.xyz | https://api.teya.com |
| OAuth | https://id.teya.xyz/oauth/v2/oauth-token | https://id.teya.com/oauth/v2/oauth-token |
| Business Portal | https://business.teya.xyz | https://business.teya.com |
3. Required scopes
Request these scopes when obtaining your access token:
| Scope | Description |
|---|---|
transactions/online/create | Process an online transaction |
transactions/online/id/get | Get online transaction details |
checkout/sessions/create | Create a session for the SDK |
Integrating on behalf of the merchants you serve?
Partners and platforms get credentials through the merchant registration flow instead. See Take payments online for partners.
Domain Verification
Apple Pay requires that your domain is verified before payments can be processed. Follow these steps:
1 Download the domain verification file from the Business Portal under Integrations > Apple Pay
2 Host the file at
https://yourdomain.com/.well-known/apple-developer-merchantid-domain-association3 Click Verify in the Business Portal to complete domain verification
Domain Verification Required
The Apple Pay button will not appear until your domain is verified. Verification must be completed for each domain (including staging and production).
Without domain verification
If your domain has not been verified, the Apple Pay button will simply not appear in the checkout. There is no error message - the SDK silently hides Apple Pay when verification is incomplete. This applies to both the standalone Apple Pay element and Apple Pay within the Checkout element.
Install the SDK
npm install @teyaproduct/teya-blocks-js
For React applications:
npm install @teyaproduct/teya-blocks-js @teyaproduct/teya-blocks-react
See SDK Initialization for initTeyaBlocks() options, including developmentMode for staging.
Related
- Customize - Button styles, types, and locale options
- Card Element - Single unified card input
- Split Card - Separate card fields
- Webhooks - Receive payment confirmation notifications
- Testing - Test cards and integration checklist
Try it - Apple Pay
Follow the interactive quickstart below to build a working integration with the Apple Pay.