Converting fiat settlements to stablecoins
After identifying that funds have arrived in your fiat wallet, you'll next need to convert the required amount into stablecoins (or any cryptocurrency you want to settle into). To do this we will be using the Create quote and Accept quote endpoints.
Most cryptocurrencies experience drastic volatility. We recommend using 1:1 collateralised stablecoins such as USDC as the value will maintain regardless of market volatility.
Start by creating a quote
curl --request POST \
--url https://api.sandbox.bvnk.com/api/v1/quote \
--header 'Accept: application/json' \
--header 'Authorization: Hawk id="B9jnE1U8eLblzHtNeJZRxfcq03CQKcmcP9FOrACMzXb1HfrxrePWsTfuP70JNns9", ts="1633010032", nonce="guGXrD", mac="uKeg+w1qXqzaF/8mOQGv8Y9IlRxyxTT+iINLe03EQ60="' \
--header 'Content-Type: application/json' \
--data '
{
"merchantId": "93403",
"from": "EUR",
"to": "USDC",
"payInMethod": "wallet",
"payOutMethod": "wallet",
"amountIn": 100
}
'
To create the quote you'll need the following information:
Parameter | Type | Description |
---|---|---|
merchantId | string | Your Merchant ID. You can find it on the Merchant Details page in your account. See this guide for creating one |
from | string | The originating currency you are holding on the platform and will be trading from. |
to | string | The end currency you are trading into. |
payInMethod | string | Set to wallet. |
payOutMethod | string | Set to wallet. |
amountIn | big decimal | The amount in the originating currency you'd like to convert. |
You'll receive a response detailing the price of the quote and the fees involved
{
"id": 93403,
"from": "EUR",
"to": "ETH",
"amountIn": 100.000000000000000000,
"amountDue": 100.000000000000000000,
"amountOut": 0.008933300000000000,
"price": 3470.162202097800000000,
"quoteStatus": "PENDING",
"paymentStatus": "PENDING",
"acceptanceExpiryDate": 1640875693683,
"paymentExpiryDate": 1640876572459,
"paymentReceiptDate": null,
"payInLegs": [],
"payInMethod": {
"id": 5,
"code": "wallet",
"settlementCurrency": "EUR",
"requestedCurrency": null,
"estimatedExchangeRate": null,
"accountMethods": []
},
"payOutMethod": {
"id": 3,
"code": "wallet",
"currency": "ETH",
"accountMethods": [
{
"id": 161,
"display": null
}
]
},
"uuid": "379a66e4-d402-48f4-a2a9-d4735ef2c79f",
"payOutInstruction": null,
"payInInstruction": null,
"usePayInMethod": null,
"usePayOutMethod": null,
"fee": 0.310000000000000006,
"processingFee": 0E-18,
"type": "FIXED",
"netPrice": 3470.162202097800000000,
"grossPrice": 3470.162202097800000000,
"amountInGross": 31,
"amountInNet": 31.000000000000000000,
"fees": {
"percentage": {
"service": 0.0100,
"processing": 0.0000
},
"value": {
"service": 0.31,
"processing": 0
}
},
"dateCreated": 1640875673705,
"lastUpdated": 1640875673705
}
Next, you simply accept the quote using the quote ID and the [Accept quote] (accept-quote) endpoint.
At this point, you have two options:
- Hold the stablecoins on the platform until your merchant requests to withdraw
- Immediately send the stablecoins to the merchant.
Updated over 2 years ago