Using the Public API for checkout

Accepting cryptocurrency payments with the CPAY Public API is fast and easy. After you've signed up you already can to create a charge to receive a payment.

Use the CPAY Public API for checkout creating. When you create a charge, we generate payment addresses on your behalf for each cryptocurrency that’s enabled and provide you with a hosted page you can send to customers to complete the payment.

Login to merchant

You need to get api keys for your merchant and login to your merchant in order to get the token necessary for creating checkout and further actions on them.

Endpoint POST /public/auth

POST https://api.cpay.world/api/public/auth

Endpoint allows you to log in to the system under the merchant. publicKey and privateKey can be obtained from the merchant. There is a corresponding endpoint that generates these keys for the merchant.

Request Body

{
  "token": "string"
}

Checkout(donation) creating

Endpoint POST /api/public/checkout/donation

POST https://api.cpay.world/api/public/checkout/donation

You need to log in to the merchant.

Request Body

{
  "data": {
    "identifier": "string",
    "merchant": {},
    "createdAt": "2021-10-04T14:20:37.949Z",
    "updatedAt": "2021-10-04T14:20:37.949Z",
    "organizationName": "string",
    "description": "string"
  }
}

Checkout(sale) creating

Endpoint /api​/public​/checkout​/sale

POST https://api.cpay.world/api​/public​/checkout​/sale

You need to log in to the merchant.

Request Body

{
  "data": {
    "identifier": "string",
    "merchant": {},
    "createdAt": "2021-10-04T14:42:12.328Z",
    "updatedAt": "2021-10-04T14:42:12.328Z",
    "productName": "string",
    "description": "string",
    "price": 0,
    "fiatCurrency": "string"
  }
}

Get all checkouts list

Endpoint /api/public/checkout

GET https://api.cpay.world/api​/public​/checkout

You need to log in to the merchant.

Query Parameters

{
  "data": {
    "page": 0,
    "pages": 0,
    "countItems": 0,
    "entities": [
      {
        "identifier": "string",
        "merchant": {},
        "createdAt": "2021-10-04T14:50:27.706Z",
        "updatedAt": "2021-10-04T14:50:27.706Z"
      }
    ]
  }
}

Get a specific checkout

Endpoint /api/public/checkout/{checkoutId}

GET https://api.cpay.world/api/public/checkout/{checkoutId}

You need to log in to the merchant.

Path Parameters

{
  "data": {
    "identifier": "string",
    "merchant": {},
    "createdAt": "2021-10-04T15:49:56.601Z",
    "updatedAt": "2021-10-04T15:49:56.601Z"
  }
}

Checkout deleting

Endpoint /api/public/checkout{checkoutId}

DELETE https://api.cpay.world/api/public/checkout{checkoutId}

You need to log in to the merchant.

Path Parameters

{
  "data": true
}

Checkout(donation) editing

Endpoint PATCH /api/public/checkout/{checkoutId}/donation

PATCH https://api.cpay.world/api/public/checkout/{checkoutId}/donation

You need to log in to the merchant.

Path Parameters

Request Body

{
  "data": {
    "identifier": "string",
    "merchant": {},
    "createdAt": "2021-10-04T16:08:23.049Z",
    "updatedAt": "2021-10-04T16:08:23.049Z",
    "organizationName": "string",
    "description": "string"
  }
}

Checkout(sale) editing

Endpoint PATCH /api/public/checkout/{checkoutId}/sale

PATCH https://api.cpay.world/api/public/checkout/{checkoutId}/sale

You need to log in to the merchant.

Path Parameters

Request Body

{
  "data": {
    "identifier": "string",
    "merchant": {},
    "createdAt": "2021-10-04T16:18:44.588Z",
    "updatedAt": "2021-10-04T16:18:44.588Z",
    "productName": "string",
    "description": "string",
    "price": 0,
    "fiatCurrency": "string"
  }
}

A checkout object is returned with a URL to a hosted page where a customer can complete their charge. The customer is able to send any amount for donation or fixed amount for sale.

Receive a payment

After creating a charge, Coinbase Commerce will continuously monitor each blockchain network for a payment. Since cryptocurrencies are push payments, we set an expiration time for the charge which is currently 1 hour after the creation date. If the customer does not make a payment within that timeframe, we consider the charge to be expired.

After the user opens the widget, two requests are sent: the first to receive the chargeId, and the second to receive all the information on the charge.

Get the chargeId

Endpoint /api/checkout-client/{identifier}/charge

POST https://api.cpay.world/api/checkout-client/{identifier}/charge

Path Parameters

{
  "data": {
    "id": "string"
  }
}

Get the charge

Endpoint /api/checkout-client/{chargeId}/charge

GET https://api.cpay.world​/api​/checkout-client​/{chargeId}​/charge

Path Parameters

{
  "data": {
    "id": "string",
    "typeNetwork": "string",
    "expiredDate": "string",
    "systemStatus": "string",
    "checkout": {
      "type": "string",
      "organizationName": "string",
      "description": "string"
    },
    "wallets": [
      {
        "address": "string",
        "currency": {
          "name": "string",
          "title": "string",
          "nodeType": "string",
          "currencyType": "string"
        }
      }
    ],
    "replenish": {
      "price": 0,
      "currency": "string",
      "amount": {
        "value": 0,
        "usd": 0
      }
    }
  }
}

Also you can get information about checkout by identifier

Endpoint /api/checkout-client/{identifier}

GET https://api.cpay.world/api​/checkout-client​/{identifier}

Path Parameters

{
  "data": {
    "type": "string",
    "organizationName": "string",
    "description": "string"
  }
}

The user opens a charge with an available list of currencies and expired time. After selecting the currency, a unique client wallet is generated. In this case, the status of the charge is accepted as New. When the user sends funds to the selected wallet, the charge status is accepted as Pending. After successful payment, the status of the charge is accepted as Done. If the user has not paid for the charge at the specified time, then the status of the charge is accepted as Expired. If any error or failure has occurred in the network, then the status of the transaction is accepted as Failed. After successful replenishment, the user needs to click on the "Back" button to generate new wallets or replenish the previous wallet, but in this case the transaction will not be displayed in the widget.

Last updated