Commerce (legacy)
CBCommerceClient targets the legacy api.commerce.coinbase.com API. It does not implement Coinbase Business Checkout APIs.
Coinbase's transition notice set 31 March 2026 as the Commerce migration deadline and says charge creation is no longer available after that date. For new payment integrations, follow the Coinbase Business Checkout documentation. Business uses different endpoints, credentials and schemas; changing this client's baseUrl is not a migration.
SDK scope
The methods below describe the legacy Commerce interface for existing integrations. New payment integrations use the Coinbase Business APIs.
Legacy authentication
Commerce used an API key in X-CC-Api-Key, without an API secret or passphrase. The examples below pass that header through the REST client's second constructor argument. These are legacy read examples, not Coinbase Business authentication examples. Do not substitute Business credentials.
Charge methods
getAllCharges() requests one page from /charges. The historical API requires cursor pagination to retrieve all charges, but this wrapper does not accept a cursor or fetch further pages automatically. The example reads COINBASE_COMMERCE_API_KEY from the environment:
import { CBCommerceClient } from 'coinbase-api';
function requiredEnvVar(name: string) {
const value = process.env[name];
if (!value) {
throw new Error(`Set ${name}.`);
}
return value;
}
async function main() {
const apiKey = requiredEnvVar('COINBASE_COMMERCE_API_KEY');
const client = new CBCommerceClient(
{ apiKey },
{ headers: { 'X-CC-Api-Key': apiKey } },
);
const response = await client.getAllCharges();
console.log(response);
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});Individual charge
getCharge() takes charge_code_or_charge_id. The example also reads COINBASE_COMMERCE_CHARGE_ID:
import { CBCommerceClient } from 'coinbase-api';
function requiredEnvVar(name: string) {
const value = process.env[name];
if (!value) {
throw new Error(`Set ${name}.`);
}
return value;
}
async function main() {
const apiKey = requiredEnvVar('COINBASE_COMMERCE_API_KEY');
const client = new CBCommerceClient(
{ apiKey },
{ headers: { 'X-CC-Api-Key': apiKey } },
);
const response = await client.getCharge({
charge_code_or_charge_id: requiredEnvVar('COINBASE_COMMERCE_CHARGE_ID'),
});
console.log(response);
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});Preserve charge identifiers when migrating historical records; a checkout ID or on-chain transaction hash is not a substitute for a Commerce charge ID.
Checkout and event methods
getAllCheckouts()requests one page of legacy checkout resources, not all checkouts. It does not accept a cursor or fetch further pages automatically.getCheckout({ checkout_id })requests one legacy checkout.listEvents()andshowEvent()require anX-CC-Versionargument. Event lists were also paginated;listEvents()does not fetch all pages automatically.
These are not the Business checkout or webhook APIs. Follow the replacement API's documentation for payment events and signature verification.
Legacy creation methods
createCharge() and createCheckout() are legacy Commerce methods. Coinbase has ended Commerce charge creation; use the Coinbase Business APIs for new payments.
Transport and environments
This SDK has no Commerce WebSocket feed, Commerce WebSocket request API or mapped Commerce sandbox. WebsocketClient does not implement a webhook receiver.