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}/validateRequired scope: gateway:write.
Request fields
| Field | Description |
|---|---|
credential | Required. 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
| Status | Code | What to do |
|---|---|---|
400 | invalid_payment_credential | Forward the full payment credential for the matching payment. |
401 | unauthorized | Check your API key and gateway permissions. |
404 | gateway_payment_not_found | Use a payment ID created in the key's account. |
410 | payment_expired | Request 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.