webhookEndpoint a decision
request for each authorization its checks approve, and your response decides whether the
authorization proceeds. Use it to apply your own fraud rules,
merchant restrictions, or velocity limits.
Real-time authorization covers cards whose authorization decisions Grid
makes: those whose cardCapabilities.supportsSpendLimitsAtIssuance is true.
It never loosens Grid’s own checks.
How it works
- A cardholder uses the card, and the card network asks Grid to authorize it.
- Grid runs its checks: card status, card and platform spend limits, merchant category rules, and network support. If any check declines, Grid declines the authorization and does not send a decision request.
- Grid sends your
webhookEndpointa signedCARD_AUTHORIZATION.REQUEST. - Your handler returns
APPROVEorDECLINEwithin 1.5 seconds. - If you approve, Grid reserves the amount from the funding source. If the
funding source cannot cover it, Grid declines with
INSUFFICIENT_FUNDS. - Grid sends the final outcome to your
webhookEndpointasCARD_TRANSACTION.AUTHORIZEDorCARD_TRANSACTION.DECLINED.
Turn it on
SetcardConfigs.realTimeAuthorization with PATCH /platform/config.
cURL
webhookEndpoint handler that answers CARD_AUTHORIZATION.REQUEST
with a decision before you turn it on. A handler that returns an empty 200
is not a valid decision, so Grid applies timeoutBehavior to every
authorization.
To stop, set cardConfigs.realTimeAuthorization to null. Grid’s own checks
then decide every authorization.
Test in sandbox
In sandbox, yourwebhookEndpoint receives the requests that the
POST /sandbox/cards/{id}/simulate/authorization simulator produces, as long
as Grid’s own checks approve them. To test timeoutBehavior, have your
handler return a non-200 status or wait longer than 1.5 seconds.
Respond to requests
Each request uses the standard webhook envelope and carries the authorization indata:
X-Grid-Signature header as you do for other webhooks, and reject
requests whose timestamp is more than a few minutes old. Then return HTTP
200 with your decision:
declineReason to the card network, so choose the most specific
one:
A decline you return reaches your
webhookEndpoint as
CARD_TRANSACTION.DECLINED with cardDeclinedReason: PLATFORM_DECLINED and
your declineReason in platformDeclineReason.
approvedAmount is the amount Grid authorizes if you approve. It becomes
authorizedAmount on the resulting CardTransaction.
Timeouts and errors
Respond within 1.5 seconds. The card network holds the cardholder at the terminal while Grid waits, so keep the decision path fast and avoid calls to slow dependencies. If your handler times out, returns a status other than200, or returns an
invalid body, Grid applies cardConfigs.realTimeAuthorization.timeoutBehavior:
Grid does not retry an authorization request.
Duplicate requests
The card network can retry an authorization, so you can receive the same authorization more than once. Each delivery has a newid, but
data.transactionId and data.issuerTransactionToken stay the same. Return
the same decision each time.