#phant
1 messages ยท Page 1 of 1 (latest)
Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
Hello! Payment Methods represent someones payment info, like a credit card. Payment Intents represent someone's specific intent to pay. The Payment Method associated with a Payment Intent is the payment info they use to pay.
so what are the options that can i fill in it?
Not sure I understand your question. Can you tell me more about what you're trying to do and what's stopping you?
You would provide an existing Payment Method ID there. They start with pm_.
where do i create these?
There are many ways to create them. The most common way is using Stripe Elements: https://stripe.com/docs/payments/elements
sorry not able to follow this documentation
how can i create these id's from dashboard?
oh like this one pm_1OjO2BCqhyxGoBc4MJwEFnc0
this was created when a subsction payment happened
so can use right away this?
like i want to charge before a user cancels his subsription
Yes, you can use that one.
with payment method id i cannot create a payment intent?
I don't understand what you mean. In order to help I need you to provide a lot more detail.
like i want to charge user before a user cancels his subsription
Okay. What's stopping you from doing that?
payment method id
How is that stopping you?
why cant user select that on the payment page
Stripe Checkout will show saved Payment Methods if you specify a Customer when you create the Checkout Session and they have eligible saved Payment Methods: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=checkout#handling-existing-customers
But it sounds like you're not using Stripe Checkout?
but what if there are none of saved payment methods?
Then you need to collect a new one using something like Stripe Elements.
Okay, so what specific step there are you having an issue with?
Okay, so take the client secret from that Payment Intent, pass it client-side, then confirm the payment with it.
pass it client side?
The client secret is designed to be sent to the client for use client-side. Typically the client in a situation like this is a web browser, where your frontend JavaScript code is.
Client secrets are sensitive and we don't generally recommend you put them in a URL. Typically your JavaScript would make a fetch request to your server which would trigger the creation of the Payment Intent and the response would have the client secret in it.
๐ taking over here as Rubeus needs to step away soon
alright
Have you seen this doc already?
It explains the whole process of sending the client-secret to your client-side code and how you can use it to collect payment method details
https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements#web-collect-payment-details
yes i tried please its been an hour and couldnt get a resolution on these simple steps
wrote this and getting client_secret key
passing the whole thing to frontend
what now?
so that's step 2 in the guide...
I'd recommend implementing step 3
where you use the client-secret to collect payment details with Stripe Elements
where is that step
That code is for Stripe hosted Checkout page which is a different flow.
The code you've shared in the beginning is for custom flow which utilizes our APIs and Elements.
What exactly is your usecase? What are you trying to integrate?
i just want to go to stripe one time payment page to get money from user
thats all
go to strip customer page
get money
one time payment
Gotcha. This is the simplest guide to follow for that.
https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=checkout
We also have a video tutorial
https://www.youtube.com/watch?v=4KogT5i7Guk&list=PLy1nL-pvL2M4bDg02XQr_Y68h4um-vLk3&index=18
okay so webhook event wont be triggered when mode is payment?
It should be triggered
it wont trigger invoice.paid?
One-time payments don't generate invoices by default.
are you trying to create invoices for one-time payments?
If so, you'd need to set invoice_creation parameter when creating the checkout session for payment mode
https://stripe.com/docs/receipts?payment-ui=checkout#paid-invoices
for what purpose exactly?
to be sure that the payment has been successful, for one time or subscription
Either of them work. Ideally, guides suggest to rely on invoice.paid since that event is generated when invoice status gets updated
oh got it thanks
NP! ๐ Happy to help
how will i know in the triggered event if its a subscription or a one time payment
For invoice.paid event?
yes
invoice.paid event delivers an invoice object as payload.
You can look at the object and see if it has a value in subscription parameter
https://docs.stripe.com/api/invoices/object#invoice_object-subscription
if its null then the invoice was a one-time payment
or else it would be an id right?
yes