transaction_not_allowed HTTP 402 Stripe Declines Stripe Error: transaction_not_allowed –
The transaction_not_allowed error is triggered at the API level when Stripe's systems decline a transaction without providing a specific reason. This does not necessarily mean the card or account is invalid, but rather that Stripe's risk assessment has flagged the transaction as high-risk.
Root Causes
Unknown Reason
Stripe's systems decline transactions for various reasons, including but not limited to, suspicious activity, high-risk behavior, or incomplete information.
Risk Assessment
Stripe continuously assesses the risk of each transaction and may decline it if deemed too high.
Resolution
1.Verify Card Information
Ensure all card details are correct and up-to-date.
2.Check Account Status
Verify the account status and ensure it is not suspended or restricted.
Code Examples
stripe.api_key = 'YOUR_TEST_SECRET_KEY'
try:
token = stripe.Token.create(card=card)
except stripe.error.CardError as e:
print(e)
const stripe = require('stripe')('YOUR_TEST_SECRET_KEY');
try {
const token = await stripe.tokens.create({ card: card });
} catch (err) {
console.log(err);
}
$stripe = new Stripe('\u0000YOUR_TEST_SECRET_KEY\u0000');
try {
$token = $stripe->tokens->create(['card' => $card]);
} catch (Stripe\CardError $e) {
print($e);
}
curl -X POST https://api.stripe.com/v1/tokens \
-u 'YOUR_TEST_SECRET_KEY:' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'card[exp_month]=12&card[exp_year]=2025&card[number]=4242424242424242'
FAQ
What does 'transaction_not_allowed' mean? ▾
It means Stripe's systems have declined the transaction without providing a specific reason.
How do I prevent this error from occurring? ▾
Verify card information, check account status, and ensure all details are correct and up-to-date.
Independent reference. Always verify against the official Stripe Declines documentation.