#heisend3rp

1 messages Β· Page 1 of 1 (latest)

primal thunderBOT
onyx cairn
jaunty timber
#

okay. thank you

onyx cairn
#

Happy to help πŸ™‚

jaunty timber
#
  -d type=card \
  -d "card[number]"=4242424242424242 \
  -d "card[exp_month]"=10 \
  -d "card[exp_year]"=2022 \
  -d "card[cvc]"=314
{
  "error": {
    "code": "invalid_expiry_month",
    "doc_url": "https://stripe.com/docs/error-codes/invalid-expiry-month",
    "message": "Your card's expiration month is invalid.",
    "param": "exp_month",
    "request_log_url": "https://dashboard.stripe.com/test/logs/req_i5LPj2FaYXb3CU?t=1671470901",
    "type": "card_error"
  }
}
#

doesn't work

#

πŸ€·β€β™‚οΈ

onyx cairn
#

That's not what I said to do

#

Wait NVM

#

The point here is to return this error for your testing

jaunty timber
#

I would also like to have an expired card saved to my testing customer so I can check the ui works.
E.g. Disabling the select for this payment method or not showing it at all

onyx cairn
#

You can save a valid card and then update it with an expiration date in the past

jaunty timber
#

I tried:

#
curl https://api.stripe.com/v1/payment_methods/pm_1MGjnyJ7hRt0Zipdk6T6cjSL \
  -u {{sk_test}}: \
  -H 'Stripe-Account: {{connected_acct}}' \
  -d "card[exp_year]"=2021
#

Got the following error:

#
{
  "error": {
    "code": "invalid_expiry_year",
    "doc_url": "https://stripe.com/docs/error-codes/invalid-expiry-year",
    "message": "Your card's expiration year is invalid.",
    "param": "exp_year",
    "request_log_url": "https://dashboard.stripe.com/acct_1Iabp9J7hRt0Zipd/test/logs/req_gcoCt1K4aKPv0M?t=1671472065",
    "type": "card_error"
  }
}
onyx cairn
#

Okay no what you need to do is create the payment method using card[token]=tok_chargeDeclinedExpiredCard

#

This should allow you to create a payment method that will fail due to an expired card

jaunty timber
#
curl https://api.stripe.com/v1/payment_methods/pm_1MGnYCJ7hRt0Zipdf36iUN8N/attach \
  -u ***: \
  -H 'Stripe-Account: ***' \
  -d customer=cus_KUI154HhNt3jaz
{
  "error": {
    "code": "expired_card",
    "doc_url": "https://stripe.com/docs/error-codes/expired-card",
    "message": "Your card has expired.",
    "param": "exp_month",
    "request_log_url": "https://dashboard.stripe.com/acct_1Iabp9J7hRt0Zipd/test/logs/req_rM1oi915y4c20D?t=1671472537",
    "type": "card_error"
  }
}
#

I can indeed create it but I cannot attach it to a customer now

jaunty timber
#

@onyx cairn so it’s not possible?

onyx cairn
#

Well the attaching will trigger validation so no I don't think that's a specific scenario you can test.