LogoLogo
  • GENERAL
    • Introduction
    • Overview
    • Authentification
    • ENUM description
  • ACQUIRING
    • Customer wallets
    • Invoices
    • Onramp
  • EXCHANGE
    • Crypto exchange
  • PAYOUTS
    • Single Payout
    • Mass Payout
  • WEBHOOKS
    • Overview
    • Types of events
    • Webhook payload
    • Webhook sign check
  • GUIDES
    • General questions
      • What is Calypso Pay?
      • Which blockchains and tokens we support?
    • Calypso UI guides and questions
      • Introduction to Calypso Pay
      • Sandbox mode and limits
      • General
        • How to create new API key
        • How to create an additional account
        • How to add a new asset to account
        • How to add funds to your wallet
        • Protect your withdrawals with additional signatures
        • How to change your top-up address
        • How to use address book
        • How to set up auto currency conversion
        • How to transfer money within Calypso pay
        • Create a webhook
      • Accept Payments via UI
        • How to create an invoice via UI
        • Accept Payments FAQ
      • Make Payments via UI
        • How to create a single payout via UI
        • How to create mass payout via UI
        • Make Payments FAQ
      • Make Exchanges via UI
        • How to exchange one crypto asset to the other
      • Reports
        • How to get reports
        • Report contents description
    • Integration guides and questions
      • Get started with API
      • Use Customer purse via API
        • How create a customer
        • How to get a purse
        • How to get a transaction data
      • Accept Payments via API
        • How to create a Limited Invoice via API
        • How to create a Limited Fiat Invoice via API
        • How to create an Unlimited Invoice via API
        • How to manage interventions via API
        • How to embed invoice data to your payment page
      • Payment widget
        • How to create a limited fiat payment widget via API
        • How to create unlimited payment widget
        • How to embed a payment widget on a web page
      • Make Exchange via API
        • How to create a exchange
        • Get balance information via API
      • Make Payments via API
        • Get balance information via API
        • How to create a single payout via API
        • How to create a mass payout via API
  • API REFERENCE
    • Report API
    • Settlement Payout API
    • Webhook API
    • Payout API
    • Exchange API
    • Fiat API
    • User API
    • Rate API
    • Settlement Wallet API
    • Fiat withdrawal API
    • Account API
    • Currency API
    • Invoice API
    • Settlement Report API
    • Crypto to fiat API
    • Customer Purse API
    • Fiat deposit API
    • Payment Widget API
    • Models
Powered by GitBook
On this page
  • Introduction
  • Steps to embed invoice
Export as PDF
  1. GUIDES
  2. Integration guides and questions
  3. Accept Payments via API

How to embed invoice data to your payment page

PreviousHow to manage interventions via APINextPayment widget

Last updated 3 days ago

Introduction

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.

Steps to embed invoice

To embed Calypso invoice data to your web page, you can follow these steps:

  1. Place the HTML code in your web page's code, wherever you want the invoice to appear:

HTML

  <div class="invoice">
    <h4 class="full-currency">Tether USD (TRC-20)</h4>
    <h4 class="rate"><span class="amount">1800</span> <span class="currency">USDT</span> = <span class="fiat-amount">1801.1</span> <span class="fiat-currency">USD</span></h4>
    <p><span class="amount" id="amount">1800</span> <span class="currency">USDT</span></p>
    <button onclick="copyText('amount')">Copy Amount</button>
    <p class="wallet-address" id="wallet-address">TEoZ53apYcxrJspfCCb7PGh5CJKMiRrAMX</p>
    <button onclick="copyText('wallet-address')">Copy Address</button>
    <br>
    <hr>
    <p>or scan QR code</p>
    <img class="qr-code" src="https://api.qrserver.com/v1/create-qr-code/?data=TEoZ53apYcxrJspfCCb7PGh5CJKMiRrAMX&size=150x150"
      alt="QR Code">
  </div>

cURL

curl --location --request POST 'https://api.calypso.finance/api/v1/invoice/create' \
--header 'Key: <your_api_key>' \
--header 'Sign: <your_sign>' \
--header 'Content-Type: application/json' \
--data-raw '
{
    "timestamp": 13292792792,
    "account": "0xc195df92dd9db2a8f28e597981f113d6e7582f8b",
    "payload": {
        "type": "SINGLE_FIAT",
        "currency": "USDC",
        "description": "invoice for client 1",
        "idempotencyKey": "1be6a518-6dcd-477d-96af-dd914b1300ce",
        "fiatAmount": 1000,
        "fiatCurrency": "EUR"
    }
}'
  1. Get invoice data in response

JSON

{
    "id": "d9732536-acdd-41bd-87c3-ec40aeeb6a37",
    "invoiceAddress": "0xc23670524181205cdddef7a7e471674779b20797",
    "type": "SINGLE_FIAT",
    "totalDebitAmount": 0,
    "amount": 980,
    "currency": "USDC",
    "state": "PENDING_PAYMENT",
    "description": "invoice for client 1",
    "createdDate": "2022-09-05T06:54:41.421731",
    "idempotencyKey": "d7067648-cf1f-4d95-afd1-3f7228992671",
    "expiration": "2022-10-05T06:54:41.421458",
    "fiatAmount": 1000,
    "fiatCurrency": "EUR",
    "isInterventionResolved": true,
    "subscriptionEnabled": false
}
  1. 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:

Class in HTML file
Field 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

  1. If you have a CSS file in your web page, you can add the CSS styles for the HTML code.

  2. Add the copyText() function to your Javascript file and make sure it is correctly referenced in the HTML code.

HTML

  <script>
    function copyText(elementId) {
      var copyText = document.getElementById(elementId);
      var textArea = document.createElement("textarea");
      textArea.value = copyText.innerText;
      document.body.appendChild(textArea);
      textArea.select();
      document.execCommand("copy");
      textArea.remove();
    }
  </script>
  1. 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.

Limited Invoice
How to create a Limited Fiat Invoice via API
New Single Fiat Invoice
Currency Mapping
https://api.qrserver.com/v1/create-qr-code/?data={InvoiceAddress}&size=150x150