API/API reference/Gateway/Validate a payment

Validate a payment

Validate a customer's payment credential before serving a paid operation.

POST/gateway/payments/{id}/validate

Required scope: gateway:write.

Request fields

FieldDescription
credentialRequired. The full value of the customer's payment Authorization header.

Use the original payment ID as {id} in the path. The payment retains its protocol. Send the customer's credential in the JSON body; the bearer header contains your Nodana API key.

Request

curl "https://api.nodana.io/v1/gateway/payments/payment-123/validate" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "credential": "<customer payment Authorization header>"
  }'

Response

200 OK

MPP

{
  "id": "payment-123",
  "protocol": "mpp",
  "status": "paid",
  "receipt": "<receipt returned by Nodana>"
}

Set the Payment-Receipt header on your successful response to the returned receipt value.

L402

{
  "id": "payment-123",
  "protocol": "l402",
  "status": "paid"
}

L402 does not return a receipt.

If an MPP validation response is lost, the same payment ID and valid credential return the original receipt. L402 credentials remain subject to their access restrictions and expiry.

Errors

StatusCodeWhat to do
400invalid_payment_credentialForward the full payment credential for the matching payment.
401unauthorizedCheck your API key and gateway permissions.
404gateway_payment_not_foundUse a payment ID created in the key's account.
410payment_expiredRequest a new payment if the unpaid challenge has expired.

To retrieve the original challenge, use Get payment challenge.

See Accept payments for the complete integration flow and Error handling for other errors.

On this page