External fiat deposit with exchange by fixed rate and send crypto to external Address
This endpoint is a combination of two other endpoints in one operation - v2/exchange/external/deposit-with-exchange and v2/withdraw/crypto.
This allows you to exchange euros paid using a bank card or SEPA transfer for crypto and simultaneously (without calling a separate endpoint) withdraw the received cryptocurrency to the specified crypto address.
For the endpoint, the conditions of execution are valid, which are valid for separately taken endpoints of deposit with exchange and withdrawal.
So, before making a request to v2/exchange/external/buy-to-send-crypto, you must send a request to receive rateId to /v2/rate/freeze. This request allows you to "freeze" the exchange rate for a certain (defined by the settings) time.
It is important to note that the freeze rate for this type of exchange, which is carried out using the SEPA transfer deposit method, is indicative at the moment the request is made to initiate the operation. The exact freeze rate will be recalculated at the moment the euro deposit is actually credited to the user's account for further exchange.
At the same time, in order to receive a freeze rate as part of this type of transaction, it is required to specify the depositPaymentCode AND also withdrawPaymentCode, since a deposit by card/SEPA transfer and withdraw to crypto address is used.
The payment methods, in addition to determining the cost of the exchange operation, also contains a list of required fields (fields) asked by the provider (for deposit) and by the blockchain (for withdraw) to ensure the successful execution of the payment.
Therefore, when performing a freeze rate (/v2/rate/freeze), it is enough to specify only the depositPaymentCode and withdrawPaymentCode, but when performing an exchange operation (/v2/exchange/external/buy-to-send-crypto), you need to specify the depositPaymentCode and withdrawPaymentCode together with the fields for this payment methods.
The list of fields and their parameters are returned together with the payment methods as a response to the request at /v2/exchange/external/pre-request.
Provided that all data for creating an invoice have been correctly transmitted, a link to the payment of this invoice or bearerToken (for payment without payment link, integration guide here https://merchant.kuna.io/docs/ru/integration/payments/h2h/#card-gate) will be returned in metadata.invoice object the response to the request to /v2/exchange/external/buy-to-send-crypto. The operation will be continued only after the client pays the invoice, after which the stage of exchanging fiat currency for crypto will begin.
After the exchange and a successful AML check, the received cryptocurrency will be withdrawn to a crypto address, provided that the data is correct and sufficient for such a withdrawal (correct crypto address, memo sign, etc.).
Deposit with exchange can acquire the following statuses:
- Created - operation created;
- Processing - operation in processing;
- OnHold - the operation is blocked (for example, for checking AML);
- Declined - the operation is rejected;
- Completed - the operation is successful.
To provide information about the status of the operation, a callback service is implemented. The link for receiving callbacks should be provided in the request to /v2/exchange/external/buy-to-send-crypto.
The duration of execution of that type of operation depends on the speed of execution of its separated parts -speed of fiat deposit, speed of fiat to crypto exchange and speed of crypto withdrawal. Execution of a crypto withdrawal depends on many factors, but the main one is the speed of processing such withdrawal by the blockchain network. In most cases, this is a few minutes, but sometimes the processing time can take much longer. Part of exchange fiat to crypto is instant. Part of the fiat deposit made using a bank card may take a few moments, while a SEPA transfer can take up to 3-5 days.
Information about the amount of operation fees will be indicated along with other operation details.