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

Understanding the Expected Flow: MetaMask

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 which is where the funds will be sent after the completes

ethereum:0xYYYY bitcoin:1xxxxx

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

Currency amount to purchase.

destAmount is no longer supported in the hosted widget checkout.

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

A url that the user will be sent to when they select any close button.

The following data will be passed to the redirectUrl as url query parameters: transferId, orderId, accountId, dest, fees, and destAmount

(iOS) myapp:// (Web) https://myapp.com/

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

Url to get the user redirect in case order fails. You should handle error and display messages in your end when using this property.

Optional

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:

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

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

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. 👇

 
{
  "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
}

Last updated

Was this helpful?