> For the complete documentation index, see [llms.txt](https://wyre-1.gitbook.io/wyre-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wyre-1.gitbook.io/wyre-docs/payments/wyre-checkout/hosted-redirect-operation.md).

# Hosted Redirect Operation

Wyre’s hosted redirect is a simple way to add fiat-to-crypto into your web or mobile application. Users can purchase using Apple Pay and debit card entry.

![MetaMask's Hosted Redirect](https://3214875655-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M6VsBq4DVlecYt2V4oT%2F-MASXBrStfTg9ICZ-HQf%2F-MASZ7z_Y3KYK7YEiF7H%2FMetaMaskGif.gif?alt=media\&token=4252fc92-ebeb-410a-9840-e079b5b33ead)

## Understanding the Expected Flow: MetaMask&#x20;

Above is MetaMask's Wyre integration using the Hosted Redirect. A user opens their MetaMask wallet, clicks on "Deposit" and then selects "Continue to Wyre". Since MetaMask knows  the address `dest` they use they use a parameter to pass that information in on behalf of the user. When the user arrives at the Wyre widget they already have that information prefilled. You can use all or some of the parameters to create a better checkout experience for you user like MetaMask did. \
\
Visiting <https://pay.sendwyre.com/> starts the checkout. To help your users pay quicker, you can pass in some or all of the following query parameters which will auto-fill into the purchase form.

| Query Parameter      | Description                                                                                                                                                                                                                                                                                                | Value                                                                          |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| `dest`               | An [SRN](https://app.gitbook.com/@wyre-1/s/wyre-inital-docs/general-api-information-and-faqs/system-resource-name) which is where the funds will be sent after the completes                                                                                                                               | <p><code>ethereum:0xYYYY</code><br><code>bitcoin:1xxxxx</code></p>             |
| `destCurrency`       | Specifies the currency to present for purchase to the user. This is present when a transfer is initiated.                                                                                                                                                                                                  | `ETH`, `BTC`, `DAI` or `USDC`                                                  |
| `sourceAmount`       | <p>Currency amount to purchase.</p><p><code>destAmount</code> is <strong>no longer supported</strong> in the hosted widget checkout.</p>                                                                                                                                                                   | `0.5 10.13 125`                                                                |
| `paymentMethod`      | The id of the payment method type you’d like the user to start off with. Generally you'll want to leave this blank. Wyre will determine what to display based on OS.                                                                                                                                       | `apple-pay` or `debit-card (Only specific if you have a specific use case)`    |
| `redirectUrl`        | <p>A url that the user will be sent to when they select any close button.</p><p>The following data will be passed to the redirectUrl as url query parameters: <code>transferId</code>, <code>orderId</code>, <code>accountId</code>, <code>dest</code>, <code>fees</code>, and <code>destAmount</code></p> | <p>(iOS) <code>myapp\://</code><br>(Web) <code><https://myapp.com/></code></p> |
| `accountId`          | Your Wyre Account ID. This associates accounts created inside the widget with you, though it does not give you access to their details                                                                                                                                                                     |                                                                                |
| `failureRedirectUrl` | <p>Url to get the user redirect in case order fails. You should handle error and display messages in your end when using this property.</p><p><strong>Optional</strong></p>                                                                                                                                |                                                                                |

After initiating a purchase, users will be taken to a processing view as the payment is being completed. This process takes on average 15-45 seconds. Once Wyre has initiated a blockchain transaction, the user will be taken to the Purchase Completed view which will display information about the completed transaction.

Here is an example URL that uses URL parameters to help improve UX:

```markup
https://pay.sendwyre.com/purchase?
destCurrency=BTC&sourceAmount=10&
dest=18XZiNoVAKx4NbppwNCuxiLw9wvTc3qzf6&
paymentMethod=apple-pay&accountId=AC_DW6V9VLY6EJ
```

\
Wallet Order Webhook
--------------------

Rather than relying on `redirectUrl` for callbacks, this section covers how to receive wallet order webhook updates when Digital Wallet orders change status.

### Passing parameters in the Widget: Hosted Mode

```scheme
https://pay.testwyre.com/purchase?dest=ethereum%3A0x98B031783d0efb1E65C4072C6576BaCa0736A912&destCurrency=ETH&sourceAmount=10&paymentMethod=apple-pay&referenceId=your_own_id&accountId=YOUR_ACCOUNT
```

| Parameter     | Description                     | Required                                  |
| ------------- | ------------------------------- | ----------------------------------------- |
| `referenceId` | Your own internal reference id. | String, optional                          |
| `accountId`   | Your Wyre account id.           | String, required for the webhook to work. |

### Registering the Webhook&#x20;

Ask a Wyre team member to register your webhook URL by providing them your `accountId` and the `url` where you host the widget. This configuration is per environment.

The webhook will be called for any state change in orders which were submitted with an `accountId`\
that has a webhook URL configured. \
\
A Webhook response looks like this. 👇

```scheme
 
{
  "referenceId":"your_reference_id", // your own id passed in the order creation
   "accountId":"AAAAAAAAAAA", // your Wyre account id
   "orderId":"WO_0000000001", // the wallet order id
   "orderStatus":"PROCESSING", // the order status {PROCESSING, COMPLETE, FAILED}]
   "transferId":"TF_000000001", // OPTIONAL, available when order was completed,  the transfer id
   "failedReason":" OPTIONAL,  some string with failed reason" // if failed, there should be a reason string when possible
}
```

##
