<div id="integration-guide">

<div class="ig-section" id="embedded-checkout">
<div class="ig-section-header">
<div class="ig-section-icon embedded-checkout"><i class="fas fa-window-maximize"></i></div>
<h2>Embedded Checkout</h2>
</div>
<p class="ig-section-desc">Embed a complete checkout form directly in your site using the <strong>Checkout Element</strong>. It handles card input, 3D Secure, and payment submission - all within a single element you mount to a container.</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 checkout element</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 pays inline</div>
</div>

<div class="ig-features">
<div class="ig-feature"><i class="fas fa-check"></i> Single element - handles everything</div>
<div class="ig-feature"><i class="fas fa-check"></i> Built-in submit button and validation</div>
<div class="ig-feature"><i class="fas fa-check"></i> Customisable with themes and CSS variables</div>
<div class="ig-feature"><i class="fas fa-check"></i> Automatic 3DS challenge handling</div>
<div class="ig-feature"><i class="fas fa-check"></i> <code>onSuccess</code> / <code>onError</code> callbacks</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>checkout/sessions/create</code></td><td>Create a checkout session for the SDK</td></tr>
<tr><td><code>checkout/sessions/id/get</code></td><td>Get checkout session by ID</td></tr>
</tbody>
</table>


</div>

<!-- Domain verification -->
<div class="ig-subsection">
<h3>Domain Verification</h3>
<p>To use Apple Pay within the Embedded Checkout, your domain must be verified with Apple. 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 for Apple Pay
content: Domain verification is only required if you want Apple Pay to appear in the Embedded Checkout. Card payments work without it. Verification must be completed for each domain (including staging and production).
```
</div>

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

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

For React applications, also install the React wrapper:

```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/checkout/customize">Customize</a> - Themes, CSS variables, and appearance options</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>
<li><a href="/partners/online-payments/troubleshooting">Troubleshooting</a> - Common issues and best practices</li>
<li><a href="/apis/online-payments/apis">API Reference</a> - Full API endpoint documentation</li>
</ul>
</div>

</div>

<div class="ig-section" id="try-it">
<div class="ig-section-header">
<div class="ig-section-icon embedded-checkout"><i class="fas fa-window-maximize"></i></div>
<h2>Try it - Embed Checkout</h2>
</div>

<div class="ig-subsection">
<p>Follow the interactive quickstart below to build a working integration with the Checkout element.</p>
<div id="qs-quickstart-root" class="qs-root qs-embedded" data-element="checkout">
<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>
