How to embed invoice data to your payment page
Last updated
Last updated
If you already have a checkout page in your application it's can be useful to embed invoice data to checkout page with all needed for client payment data. Embedding invoice data on your checkout page can provide several benefits for your business and your customers:
By including all the necessary information for payment on one page, it makes the process of making a payment in cryptocurrency more streamlined and efficient.
Customers will not need to leave your website to complete their payment and this can increase payment conversion.
Additionally, it can also improve the overall user experience by making the payment process more user-friendly and intuitive.
In this guide we consider how to embed to your web page.
We also have some detailed guides on how to create and track limited fiat invoices via API:
Limited Fiat invoice - the amount to pay is issued in fiat currency but converted to crypto currency at current exchange rate.
For detailed information about managing invoices read these guides first. Here we will go through the general flow.
To embed Calypso invoice data to your web page, you can follow these steps:
Place the HTML code in your web page's code, wherever you want the invoice to appear:
HTML
cURL
Get invoice data in response
JSON
Replace the placeholder data within the code (such as the currency, amount, and wallet address) with the actual invoice data that you receive in response:
full-currency
amount
amount
currency
get value from currency
, split it by the symbol "_". and take first element. Example, USDT_TRX -> USDT
fiat-amount
fiatAmount
fiat-currency
fiatCurrency
wallet-address
invoiceAddress
qr-code
If you have a CSS file in your web page, you can add the CSS styles for the HTML code.
Add the copyText() function to your Javascript file and make sure it is correctly referenced in the HTML code.
HTML
Test the invoice on your web page, to make sure that it looks good and that all the data is correct. Your ready invoice form with CSS styles can be looked like this:
Send API request to create invoice (API description: ):
get value from currency
and make mapping for user-friendly text: . Example, USDT_TRX -> Tether USD (TRC-20)
link on image with QR-code where encoded invoiceAddress
. You can use service or encode by yourself.