Accept Crypto Payments
Use Wyre wallets to easily accept and reconcile crypto payments.
Conceptual Overview
For Marketplaces, Merchants and Processors
Wyre's APIs support businesses of all shapes and sizes to integrate crypto payments into their business operations. You can simple create your own merchant services including:
- Accept Crypto Payments: Accept payments from crypto wallets from any of our supported cryptocurrencies
- Reconcile Payments: Generate unique "invoice" addresses for each payment and seamlessly transfer to your business account for settlement or onto third parties with ease
- Off-ramp Funds: Take any supported combination of fiat and crypto out of your business account
With a combination of Wyre's User API, Wallet API, and Transfer API, you can create easy to use merchant services that fit your needs.
Implementation Steps
- [Create User] (ref:createuser) to KYC the payor.
- When a User completes a transaction in your app, use Create Wallet to create an invoice wallet to receive their crypto payment. Use masquerading to assign this Wallet to the User.
- Create Transfer, unconfirmed, from the invoice wallet to your business account, to lock in rates for your receivable.
- Request payment from the User in your app.
- Receive Webhooks when incoming payments are received by the invoice wallet.
- Confirm Transfer from the invoice address to business account. Your open invoice is now paid.
- Use Create Payment Method to connect a bank account, if necessary, or connect your business account directly from our Dashboard.
- Use Transfers to withdraw fiat to connected banks or to payout crypto.
Step 1 - Create a User
Create a User for every shopper on your app to perform KYC checks.
{
"fields": {
"firstName": "Erika",
"lastName": "Nowaj",
"cellphoneNumber": "+4930986365012",
"email": "[email protected]",
"dateOfBirth": "1964-12-08",
"residenceAddress": {
"street1": "Werner-Heisenberg-Allee 25",
"city": "berlin",
"state": "MU",
"postalCode": "80939",
"country": "DE"
}
},
"blockchains": [
"ALL"
],
"immediate": true
}
{
"id": "US_LULWDGTQ83M",
"status": "PENDING",
"partnerId": "PT_6NU9NYY3XRU",
"type": "INDIVIDUAL",
"createdAt": 1652303594470,
...
}
Step 2 - Create the Invoice Address
Create a wallet for each item for sale in your app. These unique addresses allow you to reconcile incoming payments, as each wallet is specific to one item.
Creating Wallets:
- Create Wallets to receive payment. Include your custom 'name' of the wallet for easy identification, for example adding in your product Ids here, and use masquerading to assign the wallets to the users.
- Note, Algorand and Flow address require using blockchain/attach endpoint in order to 'opt-in' to these networks.
{
"name": "US_LULWDGTQ83M",
"callbackUrl": "https://requestinspector.com/inspect/yourUrl",
"notes": "Notes about the sub account"
}
{
"pusherChannel": "595caeff29811807ee4a2aadc46e77cf",
"balances": {},
"srn": "wallet:WA_6VVFUN7GTZB",
"callbackUrl": "https://requestinspector.com/inspect/yourUrl",
"depositAddresses": {
"BTC": "n15vBgzu1HKaH53Fw1x2GWzde2HWVt7yka",
"MATIC": "0x1fdf32d35a7f875d2d7c9713c4d566eb8f40e710",
"AVAX": "X-fuji1d5lh2ufqu8a8d9rn3ldfjwy6tn557w2gmq9td5",
"ETH": "0xdd921e212ea66bb3dbc6e8490f89ea6a171c8cf8",
"XLM": "GD7WXI7AOAK2CIPZVBEFYLS2NQZI2J4WN4HFYQQ4A2OMFVWGWAL3IW7K:A8PXZEVNY4F",
"AVAXC": "0xb9f4aa99a5faa77c9ba6f0b12d140ebe706ba9ba"
},
"notes": "Notes about the sub account",
"totalBalances": {},
"availableBalances": {},
"savingsReferralSRN": null,
"name": "US_LULWDGTQ83M",
"id": "WA_6VVFUN7GTZB",
"type": "DEFAULT",
"status": null
}
Step 3 - Create unconfirmed Transfer
Create Transfer from the invoice wallet to your business account, setting 'autoConfirm' to false. This action locks in the rate for the eventual transfer from the invoice wallet to your business account, ensuring you always get exactly the right amount.
Use masquerading to execute this transfer on behalf of the User, who is the wallet 'owner'.
{
"source": "wallet:WA_6VVFUN7GTZB",
"sourceCurrency": "ETH",
"sourceAmount": "0.1",
"dest": "account:AC_JVPFPWYQH4B",
"amountIncludesFees": "true",
"autoConfirm": false,
"notifyUrl": "https://requestinspector.com/inspect/01fhv0kycds1mnrt1fan4fw6br",
"destCurrency": "USD",
"message": "user invoice to business revenue wallet"
}
Step 4 - Prompt User to Pay
Display the invoice wallet address for the desired currency and request payment within 15 minutes.
Step 5 - Receive Payment Callback
Receive a callback when the payment has been completed by the user, and validate you received the correct amount.
Wallet Callbacks
- Use our callbacks to receive Wallet Balance Updates when the payment is received.
- In the case of transfers received from external wallets, we will provide the network transaction Id and received amount.
{
"createdAt": 1652305428844,
"id": "TR_THFQGH2GHDN",
"source": "ethereum:0xcd83423f289dd074233c0470c75a268a89223316",
"dest": "wallet:WA_6VVFUN7GTZB",
"currency": "ETH",
"amount": 0.1,
"status": "CONFIRMED",
"confirmedAt": 1652305428844,
"cancelledAt": null,
"reversedAt": null,
"message": null,
"allowOverdraft": true,
"authorizer": null,
"senderProvidedId": null,
"reversedBy": null,
"fees": 0,
"feesDest": null,
"metadata": {
"ETHNetworkTxId": "0x375efa6413b233615f016219ef29c07f062fb18cf83a1bcd8cfbee5da2a2bbdb"
},
"tags": [],
"sourceFees": null,
"destFees": null
}
Step 6 - Confirm Transfer
Confirm Transfer from invoice wallet to your business account.
curl --location --request POST 'https://api.testwyre.com/v3/transfers/TF_BRQ3MGGQC99/confirm' \
--header 'Content-Type: application/javascript' \
--header 'Authorization: Bearer SK-Q' \
--data-raw ''
Step 7 - Creating a Payment Method
Once you received payment you can create a Payment Method to offramp that crypto by bank transfer, or alternatively connect your bank directly through our Dashboard.
Connecting a Bank:
- Connect a Create Payment Method
- Set the "chargeablePM" parameter to "false." This makes the payment only available for receiving funds.
- When setting "chargeablePM: false" the payment method status will remain "AWAITING_FOLLOWUP." This allows you to bypass the bank statement upload requirement.
- If you set "chargeablePM: true" or leave at the default setting a bank statement upload will be required.
- Save the returned identifier that gets generated in the response as this will be used later to create transfers.
Step 8 - Creating Off-Ramp Transfers
Once you have a payment method created you can off-ramp funds using the Create Transfer endpoint. Both crypto and fiat can be off-ramped as determined by the dest
, sourceCurrency
, and destCurrency
parameters.
Off-Ramping
The merchant user can create a Transfer to push funds from your business account to the connected payment method.
"source":"account:AC_XXXXXXXX2",
"dest":"paymentmethod:PA_W7YN28ABCHT",To see the full list of required parameters for a transfer click here.
Updated about 2 years ago