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
  • How to create payment widget?
  • How to create payment link?
  • How embed payment widget / link on a web page using IFrame?
Export as PDF
  1. GUIDES
  2. Integration guides and questions
  3. Payment widget

How to embed a payment widget on a web page

PreviousHow to create unlimited payment widgetNextMake Exchange via API

Last updated 3 days ago

Introduction

There are two options you can use in Calypso to embed on your web page:

  1. Payment widget - if you want to provide possibility to pay by several crypto currencies.

  2. Payment link - if you want to provide possibility to pay by particular crypto currency.

First of all you need to create a payment widget or payment link.

How to create payment widget?

Detailed guide for payment widget creation is provided on the link: and . Here we will consider the simplest example.

To create a new Payment widget use the following endpoint: Create new Single Fiat payment widget (POST https://api.calypso.finance/api/v1/payment-widget/single-fiat/create)

You can find the detailed description of all the parameters in the documentation:

Here we describe the most important ones.

  • fiatAmount - the amount of fiat money merchant wants to receive for a product/service.

  • fiatCurrency - the fiat currency of future payment. The pay amount in crypto recalculates every 15 minutes after the invoice creation according to this value.

  • description - the description of product/service.

  • cryptoCurrencies - the list of available for payment crypto currencies.

  • idempotencyKey - a specific UUID for the Payment widget link which guarantees uniqueness of the request. It forms the link via client can access the payment widget.

  • externalId - the unique custom ID for your Payment widget and all the future invoices created from it. It allows you to check the status of payment by this parameter after creation.

So to create a payment widget without additional options you just have to send request:

Bash

curl --location --request POST 'https://api.calypso.finance/api/v1/payment-widget/single-fiat/create' \
--header 'Key: <your_api_key>' \
--header 'Sign: <your_sign>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "timestamp": 13292792792,
    "account": "0xc195df92dd9db2a8f28e597981f113d6e7582f8b",
    "payload": {
        "description": "Single Fiat Payment Widget example",
        "fiatAmount": 100,
        "fiatCurrency": "EUR",
        "cryptoCurrencies": [
          "BTC", "ETH"
        ],
        "idempotencyKey": "5743852b-c182-4b70-8475-2c714c98fdde",
        "externalId": "unique_id_111222333"
    }
}'

You can customize interface of your Payment widget by transmitting returnUrl, supportUrl and logoUrl fields.

If the creation was successful you will receive the response:

  • Response example

    JSON

    {
        "idempotencyKey": "5743852b-c182-4b70-8475-2c714c98fdde",
        "cryptoCurrencies": [
            "USDC"
        ],
        "widgetType": "SINGLE_FIAT",
        "widgetState": "IN_PROGRESS",
        "fiatCurrency": "EUR",
        "fiatAmount": 100,
        "description": "Single Fiat Payment Widget example",
        "externalId": "unique_id_111222333",
        "invoices": [],
        "createdDate": "2022-11-17T07:07:39.591444"
    }
    

Now after you’ve successfully created a Payment widget you can build a link for payment. Link format: https://pay.calypso.finance/pay?widgetKey={idempotencyKey}.

Payment widget view:

How to create payment link?

Detailed guide for payment link creation is provided on the links:

Here we will consider the simplest example - single payment where the price defined in crypto currency.

To create a payment link you need to create Invoice using the following endpoint: New Invoice (POST https://api.calypso.finance/api/v1/invoice/create)

Here we consider the most important ones.

  • amount - the amount of money merchant want to receive for a product/service.

  • currency - the crypto currency of payment.

  • description - the description of product/service.

  • idempotencyKey - a specific UUID for the payment link which guarantees uniqueness of the request. It’s possible to check the status of the invoice by this parameter after creation.

  • type - the type of invoice. As we want to create invoice for one fixed payment, we put here “SINGLE”.

So to create invoice without additional options you just have to send request:

Bash

curl --location --request POST 'https://api.calypso.finance/api/v1/invoice/single/create>' \\
--header 'Key: <your_api_key>' \\
--header 'Sign: <your_sign>' \\
--header 'Content-Type: application/json' \\
--data-raw '{
  "timestamp": 13292792792,
  "account": "0xc195df92dd9db2a8f28e597981f113d6e7582f8b",
  "payload": {
    "amount": 0.001,
    "currency": "ETH",
    "description": "invoice for client 1",
    "idempotencyKey": "1be6a518-6dcd-477d-96af-dd914b1300ce",
    "type": "SINGLE"
  }
}'

If the creation was successful you receive the response:

  • Response example

    JSON

    {
        "id": "d9732536-acdd-41bd-87c3-ec40aeeb6a37",
        "invoiceAddress": "0xc7721217b3e919eeb618c5155df278da58521aef",
        "type": "SINGLE",
        "amount": 0.001,
        "fee": 0.000042026017236
        "totalDebitAmount": 0,
        "currency": "ETH",
        "state": "PENDING_PAYMENT",
        "description": "invoice for client 1",
        "createdDate": "2022-08-25T12:47:28.200475",
        "idempotencyKey": "1be6a518-6dcd-477d-96af-dd914b1300ce",
        "expiration": "2022-09-24T12:47:28.171538",
        "isInterventionResolved": true,
        "subscriptionEnabled": false
    }
    

To complete the payment the client must pay the amount of money from payAmount field to address specified in invoiceAddress field.

Now after you’ve successfully created an invoice you can build a link for payment. Link format: https://pay.calypso.finance/invoice/{idempotencyKey}

Invoice Payment link view:

How embed payment widget / link on a web page using IFrame?

In order to embed payment widget or payment link on your web page you can use html tag <iframe>.

The <iframe> tag specifies an inline frame. An inline frame is used to embed another document within the current HTML document.

Just add this code to your web page replacing url in src attribute by url created by yourself:

HTML

<iframe src="https://pay.calypso.finance/invoice/{idempotencyKey}" width="800" height="800" style="border: none;"></iframe>

Full html code example:

HTML

<html>
<head>
    <title>Pyament button</title>
</head>
<body style="background-color: grey">
<iframe src="https://pay.calypso.finance/invoice/{idempotencyKey}" width="800" height="800" style="border: none;"></iframe>  
</body>

</html>

Specifying attributes width and height you can adjust size of the widget on your page.

Here is the example with attributes width="800" height="800":

Here is the example with attributes width="370" height="600":

You also can customize your widget by specifying logoUrl, supportUrl and returnUrl parameters during creating payment widget or invoice:

- single payment, the price defined in crypto currency.

single payment, the price defined in fiat currency.

unlimited payments with any amount in crypto currency.

You can find the detailed description of all the parameters in the documentation:

How to create limited fiat payment widget via API
How to create unlimited payment widget
Create new Single Fiat Payment widget
How to create a Limited Invoice via API
How to create a Limited Fiat Invoice via API
How to create Unlimited Invoice via API?
How to create a Limited Invoice via API