CopperPouch Developer docs
Merchant console

Checkout and fulfilment

A checkout saves the price and quantity before the buyer pays. Poll the checkout status to find out when CopperPouch has verified payment.

Create a checkout

Use a store and a published one-time price from the same store. Supply a fresh UUIDv4 as the idempotency key and reuse it when retrying that request.

API=https://api.copperpouch.com
STORE_ID='<your store ID>'
PRICE_ID='<a published one-time price ID>'

curl -sS "$API/v1/checkouts" \
  -H 'Content-Type: application/json' \
  -H "Idempotency-Key: $(node -p 'crypto.randomUUID()')" \
  -d "{\"store_id\":\"$STORE_ID\",\"test_mode\":true,\
\"line_items\":[{\"price_id\":\"$PRICE_ID\",\"quantity\":1}]}"

Save data.id as CHECKOUT_ID and data.token as CHECKOUT_TOKEN. Send that token as Authorization: Bearer <token> on the checkout’s remaining requests. Amounts use minor currency units. The sandbox tax total is simulated.

Start payment

  1. POST /v1/checkouts/{checkout_id}/customer with { "email": "buyer@example.test" }.
  2. GET /v1/checkouts/{checkout_id}/methods. Use the method and provider_connection_id values returned by the API.
  3. POST /v1/checkouts/{checkout_id}/pay with those two values and an idempotency key. requires_action means the attempt is waiting for the next step.

If the checkout response includes a terms policy, show its text and ask the buyer to agree. Send the accepted policy version ID as accepted_terms_id when starting payment.

The local test payment uses sandbox_card. The optional Stripe adapter returns a hosted payment URL for eligible test connections.

Confirm and check access

Send a success event for the local test payment, then check the order’s status. For Stripe tests, CopperPouch verifies the Connect webhook and checks the payment against the connected account.

curl -sS -X POST "$API/v1/checkouts/$CHECKOUT_ID/sandbox" \
  -H "Authorization: Bearer $CHECKOUT_TOKEN" \
  -H "Idempotency-Key: $(node -p 'crypto.randomUUID()')" \
  -H 'Content-Type: application/json' \
  -d '{"outcome":"succeeded"}'

curl -sS "$API/v1/checkouts/$CHECKOUT_ID/status" \
  -H "Authorization: Bearer $CHECKOUT_TOKEN"

When data.paid is true, the verified order is recorded. Fulfilment status is separate. A paid order can still be held for review. Sign in as the buyer to see eligible downloads or licences.