Operations (buy/sell/withdraw crypto)

Available operations

Buying crypto

Buy object needs to be obtained first to start the process of buying:

Getting token for buying

Before buying, you need to get a unique token designated to this specific operation, for this you can use the .convert method:

Buying

After you obtained a buying token you can call buy method passing parameters of operation.

Parameter

Description

cardId

ID of card in Mercuryo

cvv

CVV code of card

buyToken

Buying token buy.convert(...)

redirectUrl

URL where user will be redirected after operation. Example: http://my.mercuryo.io/orders?invoice={invoice_id}

Confirmation of operation

To finalize an operation user may need to confirm ownership of bank account by providing a descriptor sent as a part of transaction.

Parameter

Description

transactionId

ID of transaction obtained after buy.commit(...)

code

Descriptor code

Getting rate for buying

User may want to know the rate of fiat-crypto conversion which may be obtained using the following method:

Selling process

Sell object needs to be obtained first to start the process of buying:

Getting token for selling

Before selling, you need to get a unique token designated to this specific operation, for this you can use the .convert method:

Selling

To sell you need to get token for selling first call method as shown below.

Parameter

Description

cardId

ID of card in Mercuryo

sellToken

Token obtained from sell.convert(...)

Getting exchange rate for selling

Rate includes a fee.

Withdrawal to another wallet

Withdraw object needs to be obtained first to start the process of buying:

Currency converter

Before sending crypto it may be beneficial for user to know how amount converts to fiat or vice versa. Mercuryo SDK provides a method for that allowing to understand transaction better.

Withdrawal fees

To make withdrawal you need to obtain available blockchain fees first. In case there are no fees this method will throw an CurrencyNotSupportFeeException exception.

Make a withdrawal

Fields

Description

currency

Crypto

address

Wallet address

amount

Amount of withdrawal in crypto

estimateId

ID of estimation fee obtained on the previous step, see method withdraw.getEstimateFee

Withdrawal confirmation

User may need to confirm withdrawal using text message or email code.

Last updated

Was this helpful?