Bag is live — accept USDC & card payments globally. Get started →
BagBag Docs
API ReferenceRefunds

Create Refund

Refund a completed transaction back to the customer's wallet.

Create Refund

POST /api/refunds

Issues a USDC refund for a completed transaction. The refund is sent on-chain via Coinbase CDP to the customer's original wallet address.

Authentication

Requires API key or Supabase session auth.

Request body

FieldTypeRequiredDescription
transactionIdstringYesID of the transaction to refund
amountnumberNoRefund amount in USD. Defaults to the full transaction amount.
reasonstringNoReason for the refund

Partial refunds are supported. The total refunded amount across all refunds for a transaction cannot exceed the original transaction amount.

Constraints

  • Only completed transactions can be refunded.
  • Only EVM networks are supported for refunds (Base, Ethereum, Polygon, and their testnets).
  • The merchant must have a CDP wallet configured.

Response

{
  "status": "success",
  "data": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "transactionId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
    "merchantWalletAddress": "0xYourWallet",
    "customerWalletAddress": "0xCustomerWallet",
    "amount": 29.99,
    "token": "USDC",
    "network": "base",
    "mode": "live",
    "txHash": "0xRefundTxHash...",
    "reason": "Customer requested refund",
    "status": "completed",
    "createdAt": "2026-03-01T12:00:00.000Z"
  }
}

Error responses

StatusCodeDescription
400BAD_REQUESTMissing transactionId, invalid amount, or transaction not eligible
404NOT_FOUNDTransaction not found or doesn't belong to your account
500INTERNAL_ERRORServer error

On this page