#ishfaq_45594
1 messages ยท Page 1 of 1 (latest)
Can you share the ID (req_xxx) of the failing API request? https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
๐ taking over for my colleague. Let me catch up.
I'm getting an exception
"No such PaymentMethod: 'pmc_1LYQyOB27HlkgoNAu******'"
pmc_xxx isn't a payment method ID
this is the Payment Method configuration ID https://stripe.com/docs/api/payment_method_configurations
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 is used for example when creating a Payment Intent https://stripe.com/docs/api/payment_intents/create#create_payment_intent-payment_method_configuration to specify which Payment Method Types can be displayed
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
you can read more about it here https://stripe.com/docs/payments/multiple-payment-method-configs?dashboard-or-api=api
have you looked at this https://stripe.com/docs/payments/quickstart ?
again mess
?
ok let me explain again from start
you don't have to
than
in order to collect a Payment you need to collect a Payment Method
the guide I sent you shows you how
one throwing me in 1 direction and other in 2nd
yes
but mess after mess
kindly simplify things, don't make it over complicated
@warm zephyr there's no mess. If you want to collect a Payment you need to collect a Payment Method from your customer
you can download a running app from the quickstart link I sent you earlier
i'm moving in circules from last couple of days, no one have a solution to my problem
what's your problem
We already integrated stripe Checkout in our application and it's running fine from last couple of years
now, we have a requirment of RCP (future payments).
like
A customer pay some amount first time, and allow system that you can deducted the agreed amount on the due date when come
is your account based in India?
so we need a solution for that in stripe as we're not saving a card details with oursalves, everything is with stripe
no, it's in UK
ok
in that case you need to follow this guide
this explains how you save the Payment Method during the Payment
and how to reuse it, in future payments
this is our integrated code
we got a url in this session and redirect our customer to that link, when they provide card destails and proceed payment
okin that case you need to add https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-setup_future_usage
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
and than on success payment we fetch details on the session id, if payment is success, than we do calculation on our end
you can set it to off_session, if the future payments are done without having the customer on session, otherwise you can use on_session
then in future payments you follow this https://stripe.com/docs/payments/save-during-payment?platform=web#charge-saved-payment-method
once your customer finishes the checkout session
if you've use the payment_intent_data.setup_future_usage parameter I mentioned earlier
then you would be able to get that Payment Method Id from the Checkout Session
by expanding https://stripe.com/docs/api/expanding_objects on https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-payment_intent of the Checkout Session
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
so you mean, I have to add this line of code in my request which mentioned earlier?
yes, that's the first step
the second step is to create the webhook endpoint that listens to checkout.session.completed
as explained here https://stripe.com/docs/payments/checkout/fulfill-orders
where you retrieve the Payment Method ID
and save it
either in your db
or by updating the customer's invoice_settings.default_payment_method https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I just have one last step for you
when you need to create the "future" payment
you will either retrieve that Payment Method ID (pm_xxx) from your db or from the Customer's invoice_settings.default_payment_method
and you will use instead of the pmc_xxx you used in your code
it's not SetupIntentData, it's PaymentIntentData
ok
cutomer will be added automatically, by providing name and email in this method?
Or I have to register customer first and then process session checkout?
both are valid options
was it successful?
yes
but have no payment method id in the session
this is how I retrieve information
if I can expend stripeResponse object
also don't have customer id either
you didn't expand as I explained here #1161629095512244235 message
this is an example
in your case you need to add the Expand to the Checkout Session retrieval
you use the same service you're using right now
but you create new options for CheckoutSessionGetOptions and you add the expand I sent you
I didn't get you here
i did change in my code
StripeConfiguration.ApiKey = "sk_test_IIY1m7trX2dRYp3jPSRPD8uf"
Dim service = New SessionService()
Dim options = New SessionGetOptions()
options.AddExpand("customer")
options.AddExpand("invoice.subscription")
Dim stripSession As Stripe.Checkout.Session = service.Get("cs_test_a17dBqwMsynRdmAf9lAUQwgzvloCtjutt1xkxBUOE2gtTVPA61S2ojdELx", options)
Response.Write(stripSession)
what keywords will be used in the AddExpand?
options.AddExpand("customer")
options.AddExpand("invoice.subscription")
those are wrong
yeah, these are wrong
that's better
just one last thing here, in the thread you've shared your secret key (sk_test_xxx), although this is in test mode, it's better to roll that key.
only API keys are confidential and shouldn't be shared
it is though better to roll the key once you finish this
this is specific to your account
the payment method ID is now found inside stripeSession.PaymentIntent.PaymentMethodId
something like that
yeah, it's deap inside
๐ taking over and catching up
Let me know if there's anything I can help wtih
one more thing
It didn't contain customer id
should I add another expand option "customer" right?
when creating the checkout session you can add this option https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-customer_creation always this will create the customer for you
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I'll leave you with the safe hands of @brave canopy since I need to step away
@static pendant thanks , your help is really appreciated.
Before that, other ones played with me like a tennis ball in
If I didn't able to create customer in the same request, than, it's ok
as I'm able to create customer in a separate method
so I will update my flow a little
like
first create customer and save ID with customer details in my DB
then process checkout session with that customer id
save other information on successful payment
and later on use same customer id and payment method id for payment when their charges due
Yeah that sounds like a valid approach, you'd want to test it out to be 100% certain
one last question,
I'm new in this forum, just joined in this week
how I will find my old threads?
as this is my 3rd thread for the same issue
whenever I came back to the thread after apply changes in my code and testing, thread was closed
and I'm unable to proceed with questions
Yes, threads are closed out after a certain inactive time.
We can't keep them open. Totally fine to post a new question in #dev-help
I'm oK with it, if it's not re-open or closed after certain time, but at least I have to mention in my new thread for reference
so that the one who is helping me in new thread , he got the background
Most folks on my team prefer getting a quick summary from you rather than reading a long running thread.
As you might have seen, discord runs pretty busy with many many questions.
so its easier for us to help if developers provide a brief summary of what the issue is and what they've tried so far.
perfect, but sometime background is good to have.
Anyway thanks
your (@brave canopy and @static pendant ) help is really really appriciated.
NP! ๐ Happy to help
thanks a million
have a nice day