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
publicKey*
string
privateKey *
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
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
productName*
String
description*
String
price*
number
must not be less than 1
fiatCurrency*
string
must be only USD
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
order
string
Available values: ASC, DESC. Defaule value: ASC
page
number
Default value: 1
limit
number
Default value : 10
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
checkoutId*
string
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
checkoutId*
string
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
checkoutId
string
Request Body
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
checkoutId*
string
Request Body
productName*
string
description*
string
price*
number
must not be less than 1
fiatCurrency*
string
must be only USD
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
identifier*
string
checkout identifier
Get the charge
Endpoint /api/checkout-client/{chargeId}/charge
GET
https://api.cpay.world/api/checkout-client/{chargeId}/charge
Path Parameters
chargeId*
string
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
identifier*
string
checkout identifier
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