Token payment process
To use the mercury service, a valid and verified token_id
must be provided for the initialisation of a shared key session. For test servers, unlimited tokens can be generated by calling the /deposit/get_token
GET request. However for the mainnet service, terms and conditions of use must be agreed to and a fee payment are required to generate a valid token_id
.
To generate a valid token_id
, the following steps must be followed:
First, the /token/token_gen
function is called:
GET https://api.mercurylayer.com/token/token_gen
This returns a json
object containing the "tnc"
which is the text of the terms and conditions to use the mercury layer service and an initialised token_id
.
Next, to explicitly agree with the terms and conditions of use, the /token/token_init
function is called with the initialised token_id
:
GET https://api.mercurylayer.com/token/token_init/<token_id>
This returns a json
object containing the fee payment details. Example:
{
"btc_payment_address": "bc1qu2vs2z58m4dnyzuyk4240wdm2qd9jm827rnrjw",
"fee": "50",
"lightning_invoice": "lnbc939970n1pnvtm8ypp525ssrlm7senz7pf9z7h4sx7mz8nd2r7d6nxvldwjw7k2wm7hs8eqdp68psnxv3jxcekytf5x5cnwtf5xp3rwttzxpskxttzxumrgwpc8yer2cej8qcqzzsxqzjcsp5rd992e42ff4my6safcjce3gs0cz74rsuyffhqpragclzzkfw0lcq9qxpqysgq83hpdfxvsgh6ve8afvj38f2uuhg6nzm042sz98ge4qknfrcurlr8n3prw5qtmvjvcc7lpkhrfvm09ex5q3v6aq3tsprq958fakkrljgp2zfy80",
"processor_id": "bb038002-b7cf-49e7-8425-da4d28e8242e",
"token_id": "8a32263b-4517-40b7-b0ac-b76488925c28"
}
The fee amount is provided in euros. The invoice can be paid via Lightning Network (LN) invoice or on chain BTC. To get additional details, make a call to:
GET https://api.swiss-bitcoin-pay.ch/checkout/<processor_id>
Once the payment has been made, calling the /token/token_verify
function verifies the payment and validates the token.
GET https://api.mercurylayer.com/token/token_verify/<token_id>
This will return true
or false
. If true
, the token_id
can then be used with the client deposit functions to initialise a shared key session.