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.
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.
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
Check that status is active, card_type is virtual, and spending_controls.daily_transaction_limit is above the amount.
2. Read the balance
balance must cover the amount.
3. Match what you see
| What you see | Likely cause | Fix |
|---|---|---|
status freeze | The card is frozen | Unfreeze it |
status blocked | The card is closed | Issue a new card |
status inactive, or card_type physical | A physical card cannot spend today | Use a virtual card |
balance below the amount | The card does not hold enough money | Top up the card |
daily_transaction_limit 0 | You sent an update without limit | Set the limit |
| Today's payments add up past the limit | The daily limit is reached | Wait 24 hours, or raise the limit |
| Everything above is fine | A merchant rule, a card network rule or a fraud rule | Contact 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
| Response | Why | Fix |
|---|---|---|
400 card does not exist | The card id is wrong | Check the id |
Several failed payments in a row, and all checks pass | The cause is not visible through the API | Contact 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.