BchainPayBchainPay

Confirm a payment intent

POST/v1/payment-intents/:id/confirm

Confirms a payment intent, transitioning it through intermediate states into processing. The API automatically walks through the required state transitions (createdrequires_actionprocessing).

This endpoint is idempotent: if the intent is already in the processing state, the current state is returned without side effects.

Path parameters

FieldTypeRequiredDescription
idstringrequiredPayment intent ID (e.g. pi_3L9kX42).

Request body

No request body is required.

Example

curl -X POST https://api.bchainpay.com/v1/payment-intents/pi_3L9kX42/confirm \
  -H "Authorization: Bearer $BCHAINPAY_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"

Response — 200 OK

Returns the full PaymentIntentResponse with the updated status.

{
  "id": "pi_3L9kX42",
  "merchant_id": "merch_abc123",
  "amount_cents": 4999,
  "received_amount_cents": 0,
  "remaining_amount_cents": 4999,
  "currency": "USD",
  "network": "ethereum",
  "token": "USDC",
  "crypto_amount": "4990000",
  "crypto_amount_decimal": "4.99",
  "token_price_cents": 100,
  "status": "processing",
  "reference": "order_2026_001",
  "metadata": {
    "blockchain_address": "0x9f3a...b41C"
  },
  "created_at": "2026-04-27T12:00:00Z",
  "updated_at": "2026-04-27T12:01:30Z"
}

State transitions

Previous statusResult
createdAutomatically transitions through requires_actionprocessing.
requires_actionTransitions to processing.
processingNo-op — returns current state (idempotent).
succeeded or canceledReturns 409 invalid_state_transition. Terminal states cannot be confirmed.

Errors

StatusCodeMeaning
400missing_idempotency_keyIdempotency-Key header was not provided.
401unauthorizedInvalid or missing API key.
404not_foundPayment intent does not exist.
409invalid_state_transitionThe intent is in a terminal state and cannot be confirmed.
Last updated Edit on GitHub