<div id="integration-guide">

<div class="ig-section">
<div class="ig-section-header">
<div class="ig-section-icon embedded-components"><i class="fab fa-apple"></i></div>
<h2>Apple Pay</h2>
</div>
<p class="ig-section-desc">Render a native Apple Pay button that handles the complete Apple Pay session, including the payment sheet, Touch ID/Face ID, and confirmation.</p>

<!-- How it works -->
<div class="ig-subsection">
<h3>How it works</h3>

<div class="ig-flow-steps">
<div class="ig-flow-step"><span class="ig-flow-step-num">1</span> Create session (server)</div>
<span class="ig-flow-arrow"><i class="fas fa-arrow-right"></i></span>
<div class="ig-flow-step"><span class="ig-flow-step-num">2</span> Initialise SDK (client)</div>
<span class="ig-flow-arrow"><i class="fas fa-arrow-right"></i></span>
<div class="ig-flow-step"><span class="ig-flow-step-num">3</span> Mount Apple Pay button</div>
<span class="ig-flow-arrow"><i class="fas fa-arrow-right"></i></span>
<div class="ig-flow-step"><span class="ig-flow-step-num">4</span> Customer authenticates</div>
</div>

<div class="ig-features">
<div class="ig-feature"><i class="fas fa-check"></i> Native Apple Pay UI and sheet</div>
<div class="ig-feature"><i class="fas fa-check"></i> Biometric authentication (Touch ID / Face ID)</div>
<div class="ig-feature"><i class="fas fa-check"></i> One-tap checkout experience</div>
<div class="ig-feature"><i class="fas fa-check"></i> Safari + compatible browsers</div>
<div class="ig-feature"><i class="fas fa-check"></i> Payment details sourced from session token</div>
<div class="ig-feature"><i class="fas fa-check"></i> Works with HTML/JS and React</div>
</div>
</div>

<!-- Before getting started -->
<div class="ig-subsection">
<h3>Before getting started</h3>

<h4>1. Get merchant credentials</h4>
<p>As a partner you take payments on behalf of the merchants you serve. Each merchant's <strong>Client ID</strong> and <strong>Client Secret</strong> are delivered to your <code>registrationWebhook</code> when the merchant connects Teya to your platform, along with the <code>store_id</code> and <code>payment_webhook_public_key</code>.</p>

<div class="ig-features">
<div class="ig-feature"><i class="fas fa-check"></i> Use <code>client_credentials</code> grant to obtain access tokens</div>
<div class="ig-feature"><i class="fas fa-check"></i> Each merchant store has its own set of credentials</div>
<div class="ig-feature"><i class="fas fa-check"></i> Store credentials securely and never expose them in client-side code</div>
</div>

```admonition
icon: fas fa-key
title: A separate Client ID and Client Secret per merchant
content: Unlike POSLink credentials, these aren't shared across your merchant base. Each merchant you serve gets its own Client ID and Client Secret, delivered to your registrationWebhook when they connect - keep each merchant's credentials separate and don't reuse one set across multiple merchants.
```

```admonition
icon: fas fa-user-plus
title: Not registered yet?
content: Set up your partner account and implement the merchant registration flow first. Teya sends each merchant's credentials to your registration webhook.
link: /partners/online-payments/register-merchants
```

<h4>2. API URLs</h4>
<table class="ig-comparison">
<thead>
<tr><th>Service</th><th>Staging</th><th>Production</th></tr>
</thead>
<tbody>
<tr><td><strong>Online Payments API</strong></td><td><code>https://api.teya.xyz</code></td><td><code>https://api.teya.com</code></td></tr>
<tr><td><strong>OAuth</strong></td><td><code>https://id.teya.xyz/oauth/v2/oauth-token</code></td><td><code>https://id.teya.com/oauth/v2/oauth-token</code></td></tr>
<tr><td><strong>Business Portal</strong></td><td><code>https://business.teya.xyz</code></td><td><code>https://business.teya.com</code></td></tr>
</tbody>
</table>

<h4>3. Required scopes</h4>
<p>Request these scopes when obtaining your access token:</p>
<table class="ig-comparison">
<thead>
<tr><th>Scope</th><th>Description</th></tr>
</thead>
<tbody>
<tr><td><code>transactions/online/create</code></td><td>Process an online transaction</td></tr>
<tr><td><code>transactions/online/id/get</code></td><td>Get online transaction details</td></tr>
<tr><td><code>checkout/sessions/create</code></td><td>Create a session for the SDK</td></tr>
</tbody>
</table>


</div>

<!-- Domain verification -->
<div class="ig-subsection">
<h3>Domain Verification</h3>
<p>Apple Pay requires that your domain is verified before payments can be processed. Follow these steps:</p>

<div class="ig-flow-steps">
<div class="ig-flow-step"><span class="ig-flow-step-num">1</span> Download the domain verification file from the <a href="https://business.teya.xyz" target="_blank" rel="noopener">Business Portal</a> under <strong>Integrations &gt; Apple Pay</strong></div>
<span class="ig-flow-arrow"><i class="fas fa-arrow-right"></i></span>
<div class="ig-flow-step"><span class="ig-flow-step-num">2</span> Host the file at <code>https://yourdomain.com/.well-known/apple-developer-merchantid-domain-association</code></div>
<span class="ig-flow-arrow"><i class="fas fa-arrow-right"></i></span>
<div class="ig-flow-step"><span class="ig-flow-step-num">3</span> Click <strong>Verify</strong> in the Business Portal to complete domain verification</div>
</div>

```admonition
icon: fas fa-info-circle
title: Domain Verification Required
content: The Apple Pay button will not appear until your domain is verified. Verification must be completed for each domain (including staging and production).
```

```admonition
icon: fas fa-exclamation-triangle
title: Without domain verification
content: 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.
```
</div>

<!-- Install SDK -->
<div class="ig-subsection">
<h3>Install the SDK</h3>

```bash
npm install @teyaproduct/teya-blocks-js
```

For React applications:

```bash
npm install @teyaproduct/teya-blocks-js @teyaproduct/teya-blocks-react
```

<p>See <a href="/partners/online-payments/embedded-components/sdk-initialization">SDK Initialization</a> for <code>initTeyaBlocks()</code> options, including <code>developmentMode</code> for staging.</p>
</div>



<!-- Related -->
<div class="ig-subsection">
<h3>Related</h3>
<ul>
<li><a href="/partners/online-payments/embedded-components/apple-pay/customize">Customize</a> - Button styles, types, and locale options</li>
<li><a href="/partners/online-payments/embedded-components/card/get-started">Card Element</a> - Single unified card input</li>
<li><a href="/partners/online-payments/embedded-components/split-card/get-started">Split Card</a> - Separate card fields</li>
<li><a href="/partners/online-payments/webhooks">Webhooks</a> - Receive payment confirmation notifications</li>
<li><a href="/partners/online-payments/testing">Testing</a> - Test cards and integration checklist</li>
</ul>
</div>

</div>

<div class="ig-section" id="try-it">
<div class="ig-section-header">
<div class="ig-section-icon embedded-components"><i class="fab fa-apple"></i></div>
<h2>Try it - Apple Pay</h2>
</div>

<div class="ig-subsection">
<p>Follow the interactive quickstart below to build a working integration with the Apple Pay.</p>
<div id="qs-quickstart-root" class="qs-root qs-embedded" data-element="applePay">
<div class="playground-selectors">
<div class="playground-selector-group">
<label>Frontend</label>
<div class="playground-tabs" id="qs-frontend-tabs">
<button class="playground-tab active" data-qs-frontend="html">HTML / JS</button>
<button class="playground-tab" data-qs-frontend="react">React</button>
</div>
</div>
<div class="playground-selector-group">
<label>Backend</label>
<div class="playground-tabs" id="qs-backend-tabs">
<button class="playground-tab active" data-qs-backend="javascript">Node.js</button>
<button class="playground-tab" data-qs-backend="python">Python</button>
<button class="playground-tab" data-qs-backend="php">PHP</button>
<button class="playground-tab" data-qs-backend="go">Go</button>
<button class="playground-tab" data-qs-backend="java">Java</button>
</div>
</div>
<div class="playground-selector-group">
<label>Environment</label>
<div class="playground-tabs" id="qs-env-toggle">
<button class="playground-tab active" data-env="staging">Staging</button>
<button class="playground-tab" data-env="production">Production</button>
</div>
</div>
</div>
<div class="qs-layout">
<div class="qs-steps-panel" id="qs-steps-panel">
<div class="qs-intro">
<div class="qs-actions">
<button class="qs-download-btn" id="qs-download-all"><i class="fas fa-download"></i> Download example</button>
<button class="qs-share-btn" id="qs-share-btn"><i class="fas fa-share-alt"></i> Share</button>
</div>
<div class="qs-progress" id="qs-progress">
<div class="qs-progress-bar"><div class="qs-progress-fill" id="qs-progress-fill"></div></div>
<span class="qs-progress-text" id="qs-progress-text">0 / 0 steps</span>
</div>
</div>
<div id="qs-steps"></div>
<div class="qs-whats-next" id="qs-whats-next" style="display:none;">
<div class="qs-section-header">
<span class="qs-section-num"><i class="fas fa-check"></i></span>
<span class="qs-section-title">What's next</span>
</div>
<div id="qs-next-links"></div>
</div>
</div>
<div class="qs-code-panel" id="qs-code-panel">
<div class="qs-code-sticky">
<div class="qs-panel-tabs">
<button class="qs-panel-tab" id="qs-tab-code" data-panel="code"><i class="fas fa-code"></i> Code</button>
<button class="qs-panel-tab" id="qs-tab-preview" data-panel="preview"><i class="fas fa-eye"></i> Preview</button>
<button class="qs-panel-tab" id="qs-tab-customise" data-panel="customise"><i class="fas fa-sliders-h"></i> Customise</button>
</div>
<div class="qs-panel-content" id="qs-panel-code">
<div class="qs-file-tabs" id="qs-file-tabs"></div>
<div class="qs-code-display" id="qs-code-display"></div>
</div>
<div class="qs-panel-content" id="qs-panel-preview" style="display:none;"></div>
<div class="qs-panel-content qs-customise-split" id="qs-panel-customise" style="display:none;">
<div class="qs-customise-controls" id="qs-customise-controls"></div>
<div class="qs-customise-preview" id="qs-customise-preview">
<div class="qs-customise-preview-frame" id="qs-customise-preview-frame"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

</div>

</div>

<script src="/js/quickstart-loader.js"></script>

<script src="/js/playground.js"></script>
