Gravv
/Docs
Search docs or ask a question⌘K
DocsAgent
ChangelogTry sandbox
Recipes Card issuing Find out why a payment was declined

Find out why a payment was declined

Read the decline reason from the webhook, and work out the cause from the card's status, limit and balance when the reason is missing.

3 min read

Use this recipe to find out why a card payment was declined. The webhook carries declined_reason when the card program gives one. When it is null, you check the card's status, limit and balance.

Who it is for. A support agent at any card issuer answering "my card was declined".

Status. Available. declined_reason is null when the card program gives no reason, and the checks below then find the most likely cause.

Money example

Ada tries to pay 45 USD and it is declined.

1.
Her card holds 30 USD. You top it up with 20 USD, and she pays.
2.
Or her card holds 200 USD, but its daily limit reads 0 because you sent an update without limit. You set the limit back to 300, and she pays.

Before you start

You need the card id. Read it from event_data.card.id in the cards.transaction.payment webhook, or from GET /v1/cards?customer_id=….

Find out what is required

A declined payment arrives as cards.transaction.payment with transaction.status failed and transaction.declined_reason, such as insufficient_funds. See the codes in Card decline reasons. For each payment, Gravv sends pending, then completed or failed.

Steps

1. Read the card

cURLNodePython
curl --request GET \
--url https://api.gravv.xyz/v1/cards/a14ec356-f33d-4384-ba68-4d9bfa19765b \
--header 'Api-Key: <API_KEY>'

Check that status is active, card_type is virtual, and spending_controls.daily_transaction_limit is above the amount.

2. Read the balance

cURLNodePython
curl --request GET \
--url https://api.gravv.xyz/v1/cards/a14ec356-f33d-4384-ba68-4d9bfa19765b/balance \
--header 'Api-Key: <API_KEY>'

balance must cover the amount.

3. Match what you see

What you seeLikely causeFix
status freezeThe card is frozenUnfreeze it
status blockedThe card is closedIssue a new card
status inactive, or card_type physicalA physical card cannot spend todayUse a virtual card
balance below the amountThe card does not hold enough moneyTop up the card
daily_transaction_limit 0You sent an update without limitSet the limit
Today's payments add up past the limitThe daily limit is reachedWait 24 hours, or raise the limit
Everything above is fineA merchant rule, a card network rule or a fraud ruleContact support with the card id, amount and time

Tell the cardholder that this is the most likely cause. None of these checks proves it.

What can go wrong

ResponseWhyFix
400 card does not existThe card id is wrongCheck the id
Several failed payments in a row, and all checks passThe cause is not visible through the APIContact support

Webhooks you will receive

You receive cards.transaction.payment with transaction.status pending, completed or failed, transaction.amount (a JSON number in dollars), transaction.declined_reason and transaction.transaction_type card_payment.

Testing in sandbox

Spend and decline simulation through the API is Not yet available. To test your handler, post a recorded cards.transaction.payment payload to your own endpoint, or resend a stored event. Gravv signs a resend like any other delivery.

Reference

Was this page helpful? Yes No