> For the complete documentation index, see [llms.txt](https://docs.toolkit.equs.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.toolkit.equs.ai/docs/issuance/flow-1/trigger-by-user-for-equs-wallet-pull-tx_code-delivery/method-2-api-+-embed-ui.md).

# Method 2: API + Embed UI

Keep the two API calls on your back end and let a pre-built component handle the Holder

Same two calls as [Method 1](/docs/issuance/flow-1/trigger-by-user-for-equs-wallet-pull-tx_code-delivery/method-1-api.md), but the Holder-facing half - wallet picker, QR code, deep link - comes ready-made. Embed UI calls back into your server for anything protected, so the platform credentials never reach the browser.

{% hint style="info" %}
**One call can serve both journeys.** Enable `externalWallet` alongside `internalWallet` and each Holder's choice decides: an EQUS Wallet stays on this journey, any other wallet goes down [`email` tx\_code delivery](/docs/issuance/flow-1/trigger-by-user-for-any-wallet-email-tx_code-delivery/method-2-api-+-embed-ui.md). Embed UI passes that choice to your `deliverTxCode` as `method`, so the same setup handles both.
{% endhint %}

**Before you start** you need an [Issuer and VC Schema](/docs/issuance/configuration-issuer-and-vc-schema.md), your identity provider registered (see [Bring Your Own IdP](/docs/onboarding/bring-your-own-idp.md)), and Embed UI installed - see [Embedded UI](/docs/embedded-ui/overview.md).

### Who calls what

```mermaid
flowchart LR
    E["Embed UI<br/>in your page"] --> B["Your back end"] --> P["Platform<br/>Integration API"]
    style E fill:#e6f4ea,stroke:#34a853
    style B fill:#e8f0fe,stroke:#4285f4
    style P fill:#fff4e5,stroke:#f9ab00
```

### What you write

`issueVC` takes one options object. Two of its properties are functions you pass in: Embed UI calls them in the browser, and each one reaches the platform through your back end.

| Function                | Embed UI calls it             | You do                                                                      |
| ----------------------- | ----------------------------- | --------------------------------------------------------------------------- |
| `getCredentialOfferUri` | when the Holder starts        | Create the Offer, return `{ refUri, uriId }` from `byReference` and `uriId` |
| `deliverTxCode`         | once a wallet has been chosen | Forward to the delivery endpoint and return its response unchanged          |

For this journey Embed UI passes `{ offerId, method: 'pull', userId }`, so the decision is made for you - but the call still goes through your back end, which is where your own checks belong.

```javascript
import { issueVC } from '@equs-ai/dtk-embedded-ui'

issueVC({
  getCredentialOfferUri,   // async () => ({ refUri, uriId })
  deliverTxCode,           // async (params) => ({ txCodeFetchUrl, txCodeResendCooldown })
  userInfo: { id, email },
  internalWallet: { name: 'Our Wallet', platform: ['web', 'mobile'] },
  webWalletMode: 'embedded',
  onLoading,
})
```

### Keeping the Holder on the `pull` path

`internalWallet` is what puts an EQUS Wallet in the picker, and it is the only option whose wallet can fetch the code. Leave `externalWallet` unset and `manualTxCode` at its default of `false`: enabling either sends the Holder down [`email` tx\_code delivery](/docs/issuance/flow-1/trigger-by-user-for-any-wallet-email-tx_code-delivery/method-1-api.md) instead, where a code has to be typed.

Set `userInfo.id` to the Holder's user ID in your IdP: the `sub` it reports when they sign in, which is also the `userId` you create the Offer with (see [Bring Your Own IdP](/docs/onboarding/bring-your-own-idp.md)). Embed UI passes it to your `deliverTxCode` as `userId`. Without it, the EQUS Wallet isn't offered.

### Canceling an issuance in flight

If the Holder navigates away mid-flow, `cleanUpIssueVC()` cancels the issuance: it removes Embed UI's message listeners and closes its iframe. `cleanUpEmbeddedUi` calls it for you - see [Embedded UI](/docs/embedded-ui/overview.md).

### Track the result

See [Issuance Results](/docs/issuance/issuance-results.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.toolkit.equs.ai/docs/issuance/flow-1/trigger-by-user-for-equs-wallet-pull-tx_code-delivery/method-2-api-+-embed-ui.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
