> 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/standards/issuance/flow-1/trigger-by-user-for-any-wallet-email-tx_code-delivery/method-2-api-+-embed-ui.md).

# Method 2: API + Embed UI

Let Embed UI collect the address, show the QR code, and handle code entry and resend

The same calls as [Method 1](/standards/issuance/flow-1/trigger-by-user-for-any-wallet-email-tx_code-delivery/method-1-api.md), with the Holder-facing part pre-built - including the two things this journey needs and the others don't: somewhere to ask for an address, and somewhere to type the code.

{% hint style="info" %}
**One call can serve both journeys.** Enable `internalWallet` alongside `externalWallet` and each Holder's choice decides: any other wallet stays on this journey, an EQUS Wallet the Holder is signed in to goes down [`pull` tx\_code delivery](/standards/issuance/flow-1/trigger-by-user-for-equs-wallet-pull-tx_code-delivery/method-2-api-+-embed-ui.md) and fetches the code itself. Embed UI passes that choice to your `deliverTxCode` as `method`, so the same two functions handle both. The `pull` side needs [Bring Your Own IdP](/standards/onboarding/bring-your-own-idp.md), with `userInfo.id` set to the Holder's `sub` from your IdP.
{% endhint %}

**Before you start** you need an [Issuer and VC Schema](/standards/issuance/configuration-issuer-and-vc-schema.md) and Embed UI installed - see [Embedded UI](/standards/embedded-ui/overview.md).

### Who calls what

**Your platform credentials never reach the browser.** Every protected Issuance call - creating the Offer and setting `tx_code` delivery - goes through **your back end**, via functions you supply.

```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
```

That also means your server stays the place your own checks belong - whether this Holder is entitled to this credential, and whether the address they typed is one you are willing to send to.

### What the Holder goes through

1. **Pick a wallet.** They choose from the options you enabled, each labeled with the `name` you gave it.\
   ![](https://701364325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFaucIkpW1i4WOAQC06fj%2Fuploads%2FMhQxDTNfRxn3HdFPNZtV%2Fimage.png?alt=media\&token=0bca427f-c366-4217-b4f2-68e412ab96de)
2. **Give an address - sometimes.** When the code has to travel out of band, they're asked where to send it. You can prefill the address you already hold, or skip the question entirely and send it there regardless.\
   ![](https://701364325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFaucIkpW1i4WOAQC06fj%2Fuploads%2FPM2PzYUHwQPPGqK2Jzx1%2Fimage.png?alt=media\&token=bbe69b9b-4e6c-49c6-b2ef-3c5b7cc1c8cf)
3. **Open the wallet.** A web wallet opens in the same tab or a new one, your choice. For a mobile wallet, Embed UI shows a QR code to scan.\
   \
   ![](https://701364325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFaucIkpW1i4WOAQC06fj%2Fuploads%2FEnaqfR2bYOcmTeVD4vN8%2Fimage.png?alt=media\&token=85b0ac34-0dd6-4d7e-83d7-efbd3902bbcf)
4. **Type the code** they received, and accept the Offer.

From there the rest of the flow happens in the wallet.

### What you write

Two functions you pass to `issueVC`. 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 `{ offerId, method: 'email', email }` to the delivery endpoint and return its response unchanged |

Embed UI reads `txCodeResendUrl` and `txCodeResendCooldown` from that response to run the resend button, which is why it has to come back unchanged.

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

issueVC({
  getCredentialOfferUri,
  deliverTxCode,
  userInfo: { id, email },
  externalWallet: { name: 'Any wallet', supported: true },
  contactInfoOptions: { allowContactInput: true, prefillContactInfo: true },
  onLoading,
})
```

### Controlling the address question

`contactInfoOptions` takes `{ allowContactInput, prefillContactInfo }`, both defaulting to `true`.

* `allowContactInput: false` shows no field at all and sends the code to `userInfo.email`. If you didn't pass `userInfo.email`, there's nowhere to send it, so the field is shown anyway.
* With the field shown, `prefillContactInfo` decides whether that address is filled in already or the Holder starts from blank.

`manualTxCode: true` puts an EQUS Wallet Holder on this journey deliberately, making them type the code instead of letting the wallet fetch it.

{% hint style="info" %}
Embed UI's `deliverTxCode` always routes through the platform's delivery endpoint, so the address reaches platform storage. If you need the "you deliver it" variant from [Method 1](/standards/issuance/flow-1/trigger-by-user-for-any-wallet-email-tx_code-delivery/method-1-api.md), send the code from your own back end and don't enable the address question.
{% endhint %}

### 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](/standards/embedded-ui/overview.md).

### Track the result

See [Issuance Results](/standards/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/standards/issuance/flow-1/trigger-by-user-for-any-wallet-email-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.
