#tiago_test-cards

1 messages ¡ Page 1 of 1 (latest)

calm foxBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1252648813051646014

📝 Have more to share? Add details, code, screenshots, videos, etc. below.

subtle carbon
#

@brittle nacelle We don't let you do this server-side. You should never need to do that to test anything though. We have test card numbers with magic ids such as pm_card_visa instead, see https://stripe.com/docs/testing#cards

#

tiago_test-cards

brittle nacelle
#

We tried with pm_card_visa but the same error came out. Does stripe support raw card registration passthrough or has this been discontinued?
We did as described in the documentation https://docs.stripe.com/api/payment_methods/object?lang=node


const stripe = require('stripe')(env.SECRET);
const paymentMethod = await stripe.paymentMethods.create({
  type: 'card',
  card: {
    number: '4242424242424242',
    exp_month: 8,
    exp_year: 2026,
    cvc: '314',
  },
});
subtle carbon
#

It's supported but it comes with strict rules and approval. Really never call this server-side. It won't work and you don't need it.
Instead do this: const paymentMethod = await stripe.paymentMethods.retrieve('pm_card_visa'); and it's going to create a PaymentMethod based on that 4242 card for you

calm foxBOT
brittle nacelle
#

Okay, let's try this approach on our platform.