Skip to main content

Accepting Crypto Payments with Commerce API

To start accepting cryptocurrency payments you need to create a request for payment, also known as a charge.

Creating a Charge

When you create a charge, we provide you with a hosted page that you can send to customers to complete the payment.

Here’s an example of dynamically creating a charge:

curl -X POST https://api.commerce.coinbase.com/charges/ \
-H "Content-Type: application/json" \
-H "X-CC-Api-Key: YOUR_API_KEY" \
-d "@data.json"

Where data.json is simply a JSON object:

{
"name": "The Human Fund",
"description": "Money For People",
"pricing_type": "fixed_price",
"local_price": {
"amount": "10.00",
"currency": "USD"
}
}

A charge object is returned with payment addresses for each currency plus a URL to a hosted page where a customer can complete their payment.

Accepting a Payment

Unlike credit cards where merchants must obtain payment credentials in order to charge a customer, cryptocurrencies are more like digital cash and rely on the customer explicitly sending money to the merchant.

After creating a charge, Commerce continuously monitors each blockchain network for a payment.

Once a payment has been sent, we update your Dashboard with the payment information. To get more information about the payment, simply retrieve the charge by supplying the UUID that was returned when the charge was created.

Here’s an example of retrieving a charge:

curl https://api.commerce.coinbase.com/charges/cbfaa911-19cd-4643-8d37-06560b3a77bf \

A charge object is returned with specific information about the payment including, but not limited to, the transaction hash and status. Learn more.


See Also:

Was this helpful?