#jhonny_api
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always 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/1225214612786647082
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi there! Which docs have you read so far?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
this one
it even created a payment and appears balance in my dashboard (test mode)
Okay, got it. Where are you blocked exactly? The screenshot shows you created two PaymentIntents, each for $20. One of these PaymentIntents is tied to a successful charge.
yeah, but like, I didnt pass any credit card info
where did it get the money from
like, there is no customer, no bank info, no nothing
if I'm buying something I need to fill some infos, like my credit card info, so the money will go from my bank account to somewhere
in this payment intent, this doesnt happen
I just "magically" get the money
maybe I got it wrong and I'm looking for something else? @craggy zinc
You must have passed the 4242 test card somewhere when you created this PaymentIntent
Could you copy/paste the PaymentIntent ID?
const paymentIntent = await stripe.paymentIntents.create({
amount: 2000,
currency: 'usd',
automatic_payment_methods: {
enabled: true,
},
});
that's the code I used
sure
pi_3MtwBwLkdIwHu7ix28a3tqPa
Hold on a second. That PI is not in the screenshot you shared above
This appears to be one from our docs
let me create another one
pi_3P1d3QHmET8UmikH1pGUjuDn
const paymentIntent = await stripe.paymentIntents.create({
amount: 2000,
currency: 'usd',
automatic_payment_methods: {
enabled: true,
},
});
await stripe.paymentIntents.confirm(
paymentIntent.id,
{
payment_method: 'pm_card_visa',
return_url: 'https://www.example.com',
}
);
Yep, that's it. You're using one of our test PaymentMethods, pm_card_visa to confirm the PaymentIntent. This is the 4242 test card you see on the same testing page: https://docs.stripe.com/testing#cards
So what you've tested above is confirming a PaymentIntent with a PaymentMethod that already exists on Stripe (because the customer shared their card details with Stripe at some point prior)
if I'm buying something I need to fill some infos, like my credit card info, so the money will go from my bank account to somewhere
You have a few different options for doing this. You can use Stripe Checkout, which redirects customers to a Stripe-hosted payment page, or you can use the PaymentElement to embed/add a payment module to your checkout page
I recommend starting here: https://docs.stripe.com/payments/quickstart
and toggling between "Stripe-hosted page", "embedded form", and "Custom payment flow"
hmm, got it, but since I'm making an app with very customized screens, I want to use the API
my API will consume stripe and maybe other payment gateways too
I strongly recommend using Elements (that corresponds to the "custom payment flow" tab in the guide above). This way you can add the PaymentElement to a page you own/manage and you ensure that all customer payment details are only ever shared with Stripe (payment details never touch your code)
got it, but I really want to use the API haha
so... how do I create a card on paymentIntents?
If you want to use raw card numbers to create PaymentMethods, you'll need to work with our support team to enable this feature in test mode: https://support.stripe.com/questions/enabling-access-to-raw-card-data-apis
is there another way?
No, there's no other way
Working with raw card numbers requires additional PCI compliance so you'll have to meet the requirements mentioned in the support doc above if you plan on working with raw card numbers
does this generates something to "save" the card?
I have a screen where all the user cards are listed
Not sure I follow
like this
using the elements
do I get those infos?
am I able to save the customer card?
The PaymentElement won't list a customer's saved cards. However, you can use the PaymentElement to save cards for future use.
hmm got it
If you need to show your customers a list of their saved PaymentMethods, you can do so by listing their PaymentMethods: https://docs.stripe.com/api/payment_methods/customer_list
Then choosing what information about this list to display client side
Sure thing, happy to help!