invalid_expiry_year HTTP 402 Stripe Declines

Stripe Error: invalid_expiry_year –

When the API encounters an invalid expiration year, it triggers this error code. This occurs when the card's expiration date is not correctly formatted or is in the future. It does not mean the card is declined due to insufficient funds.

Official documentation ↗

Root Causes

1.

Invalid Expiration Year

The expiration year is not correctly formatted or is in the future.

2.

Incorrect Card Information

The card information provided does not match the actual card details.

Resolution

1.Verify Card Information

Check that the expiration year is correctly formatted and in the past.

2.Update Expiration Year

Correctly format the expiration year and retry the payment.

Code Examples


            stripe.api_key = 'YOUR_STRIPE_API_KEY'
charge = stripe.Charge.create(amount=100, currency='usd', source='tok_visa')
          

            const stripe = require('stripe')('YOUR_STRIPE_API_KEY');
const charge = await stripe.charges.create({ amount: 100, currency: 'usd', source: 'tok_visa' });
          

            require_once('/path/to/stripe-php/init.php');
$charge = \
Stripe\Charge::create(array('amount' => 100, 'currency' => 'usd', 'source' => 'tok_visa'));
          

            curl -X POST https://api.stripe.com/v1/charges -H 'Authorization: Bearer YOUR_STRIPE_API_KEY'
-H 'Content-Type: application/x-www-form-urlencoded'
-d 'amount=100&currency=usd&source=tok_visa'
          

FAQ

What does this error mean?

This error indicates that the expiration year is invalid or not correctly formatted.

How do I fix this issue?

Verify and correct the expiration year, then retry the payment.

Independent reference. Always verify against the official Stripe Declines documentation.