Skip to main content

API endpoint mapping

Create a payment request

POST https://api.commerce.coinbase.com/charges
X-CC-Api-Key: YOUR_API_KEY

{
  "name": "Order #12345",
  "description": "Payment for order #12345",
  "pricing_type": "fixed_price",
  "local_price": {
    "amount": "100.00",
    "currency": "USD"
  },
  "redirect_url": "https://example.com/success",
  "cancel_url": "https://example.com/cancel",
  "metadata": {
    "order_id": "12345",
    "customer_id": "cust_abc123"
  }
}
  • Amount is now a direct string field (not nested in local_price)
  • Currency is specified directly (Checkouts API currently supports USDC)
  • Network specification is now explicit (defaults to base)
  • Redirect URLs have been renamed for clarity
  • name field is removed; use description instead
  • Idempotency is supported via X-Idempotency-Key header

List payment requests

GET https://api.commerce.coinbase.com/charges
X-CC-Api-Key: YOUR_API_KEY
  • Pagination uses pageSize and pageToken instead of Commerce’s cursor-based approach
  • Can filter by status (ACTIVE, PROCESSING, DEACTIVATED, EXPIRED, COMPLETED, FAILED)
  • Response includes nextPageToken for retrieving next page
  • Response key is checkouts (not data)

Retrieve a specific payment request

GET https://api.commerce.coinbase.com/charges/{charge_code_or_charge_id}
X-CC-Api-Key: YOUR_API_KEY
  • Use the checkout ID (24-character hexadecimal format)
  • No support for retrieval by code (use ID only)

Cancel/deactivate a payment request

No explicit endpoint available
- Charges expire based on expires_at timestamp
- Cannot manually cancel active charges
  • Explicit deactivation endpoint available
  • Deactivated checkouts cannot accept further payments
  • Status changes to DEACTIVATED

Response schema mapping

Payment details

Charge API FieldCheckouts API FieldNotes
ididFormat changed from UUID to 24-character hexadecimal
codeN/ACode not available in Checkouts API
hosted_urlurlThe shareable payment URL
namedescriptionName field replaced by description
descriptiondescriptionSame purpose
pricing.local.amountamountFlattened structure
pricing.local.currencycurrencyFlattened structure
N/AnetworkNew field specifying blockchain network
N/AaddressNew — merchant’s blockchain receiving address
N/AupdatedAtNew — timestamp of last status update
N/AsettlementNew — fee breakdown (totalAmount, feeAmount, netAmount, currency)
N/AtransactionHashNew — on-chain transaction hash (present when COMPLETED)
expires_atexpiresAtSame purpose, RFC 3339 format
metadatametadataSame purpose
redirect_urlsuccessRedirectUrlRenamed for clarity
cancel_urlfailRedirectUrlRenamed for clarity
created_atcreatedAtSame purpose, RFC 3339 format
timelinestatusStatus now a single field instead of timeline array
web3_datatransactionHashTransaction hash available directly on the response

Status mapping

Understanding status transitions is crucial for order fulfillment:
Charge API StatusCheckouts API StatusDescription
NEWACTIVEPayment request is active and awaiting payment
SIGNEDACTIVEIn Checkouts, signing happens within the payment flow
PENDINGPROCESSINGPayment detected, awaiting confirmation
COMPLETEDCOMPLETEDPayment confirmed and finalized
EXPIREDEXPIREDPayment request expired without payment
FAILEDFAILEDPayment attempt failed
N/ADEACTIVATEDCheckout manually deactivated
Important considerations:
  • Checkouts API focuses on the checkout status, not individual transaction status
  • Use webhooks for real-time payment status notifications (see Webhooks documentation)
  • Once a payment is detected and confirmed, the status changes to COMPLETED

Webhooks

Charge API webhooks

Commerce provides webhook events:
  • charge:created
  • charge:pending
  • charge:confirmed
  • charge:failed

Checkouts API webhooks

Checkouts API supports webhooks for real-time payment notifications:
  • checkout.payment.success - Checkout successfully paid
  • checkout.payment.failed - Checkout payment failed
  • checkout.payment.expired - Checkout expired without payment
See the Webhooks documentation for detailed setup instructions, including:
  • Creating webhook subscriptions using CDP API
  • Webhook signature verification
  • Sample event payloads
If you prefer not to use webhooks, you can also monitor payment status by periodically polling the GET endpoint to check checkout status.

Node.js implementation examples

const axios = require('axios');

async function createCharge(orderData) {
  const response = await axios.post(
    'https://api.commerce.coinbase.com/charges',
    {
      name: orderData.name,
      description: orderData.description,
      pricing_type: 'fixed_price',
      local_price: {
        amount: orderData.amount,
        currency: 'USD'
      },
      redirect_url: orderData.successUrl,
      cancel_url: orderData.cancelUrl,
      metadata: orderData.metadata
    },
    {
      headers: {
        'X-CC-Api-Key': process.env.COMMERCE_API_KEY,
        'Content-Type': 'application/json'
      }
    }
  );

  return {
    id: response.data.id,
    hostedUrl: response.data.hosted_url,
    expiresAt: response.data.expires_at
  };
}

async function getChargeStatus(chargeId) {
  const response = await axios.get(
    `https://api.commerce.coinbase.com/charges/${chargeId}`,
    {
      headers: {
        'X-CC-Api-Key': process.env.COMMERCE_API_KEY
      }
    }
  );

  const timeline = response.data.timeline;
  const currentStatus = timeline[timeline.length - 1].status;

  return currentStatus;
}