#ishfaq_45594

1 messages ยท Page 1 of 1 (latest)

orchid spokeBOT
crimson arrow
orchid spokeBOT
warm zephyr
#

I'm getting an exception

#

this is my payment method id

static pendant
#

๐Ÿ‘‹ taking over for my colleague. Let me catch up.

warm zephyr
#

I'm getting an exception
"No such PaymentMethod: 'pmc_1LYQyOB27HlkgoNAu******'"

static pendant
#

pmc_xxx isn't a payment method ID

warm zephyr
#

so how I will get this payment method id?

static pendant
warm zephyr
#

again mess

static pendant
#

?

warm zephyr
#

ok let me explain again from start

static pendant
#

you don't have to

warm zephyr
#

than

static pendant
#

in order to collect a Payment you need to collect a Payment Method

#

the guide I sent you shows you how

warm zephyr
#

one throwing me in 1 direction and other in 2nd

#

yes

#

but mess after mess

#

kindly simplify things, don't make it over complicated

static pendant
#

@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

warm zephyr
#

i'm moving in circules from last couple of days, no one have a solution to my problem

static pendant
#

what's your problem

warm zephyr
#

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

static pendant
#

is your account based in India?

warm zephyr
#

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

static pendant
#

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

warm zephyr
#

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

static pendant
warm zephyr
#

and than on success payment we fetch details on the session id, if payment is success, than we do calculation on our end

static pendant
#

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

warm zephyr
#

I already go through these documents

#

I don't what I'm missing

static pendant
#

let's go one step back

#

I think I know what's missing here

#

let me explain

warm zephyr
#

sure

#

it will be good if we can go step by step

static pendant
#

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

#
warm zephyr
#

so you mean, I have to add this line of code in my request which mentioned earlier?

static pendant
#

yes, that's the first step

#

the second step is to create the webhook endpoint that listens to checkout.session.completed

warm zephyr
#

got it

#

let me apply the changes

static pendant
#

where you retrieve the Payment Method ID

#

and save it

#

either in your db

warm zephyr
#

got it

#

kindly gave me 1 favour by not closing this thread

static pendant
#

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

warm zephyr
#

yeah sure

#

no option for future_usage

static pendant
#

it's not SetupIntentData, it's PaymentIntentData

warm zephyr
#

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?

static pendant
#

both are valid options

warm zephyr
#

ok

#

I tried a payment

static pendant
#

was it successful?

warm zephyr
#

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

static pendant
warm zephyr
#

yes, becaues I don't know what is "cu_1NzIamB27HlkgoNAq6GLwo4f"

static pendant
#

this is an example

warm zephyr
#

yes

#

but what should be provide here?

static pendant
#

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

warm zephyr
#

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?

static pendant
#

options.AddExpand("customer")
options.AddExpand("invoice.subscription")
those are wrong

warm zephyr
#

yeah, these are wrong

static pendant
#

instead you should use "payment_intent"

#

options.AddExpand("payment_intent")

warm zephyr
#

yeah

static pendant
#

that's better

orchid spokeBOT
static pendant
#

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

warm zephyr
#

yes, it's test one, that's why didn't care

#

I pick it from the documentation

static pendant
#

it is though better to roll the key once you finish this

#

this is specific to your account

warm zephyr
#

yeah sure thanks

#

but still didn't get the payment method id

static pendant
#

the payment method ID is now found inside stripeSession.PaymentIntent.PaymentMethodId

#

something like that

warm zephyr
#

yeah, it's deap inside

brave canopy
#

๐Ÿ‘‹ taking over and catching up
Let me know if there's anything I can help wtih

warm zephyr
#

one more thing

#

It didn't contain customer id

#

should I add another expand option "customer" right?

static pendant
#

I'll leave you with the safe hands of @brave canopy since I need to step away

warm zephyr
#

@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

brave canopy
#

Yeah that sounds like a valid approach, you'd want to test it out to be 100% certain

warm zephyr
#

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

brave canopy
#

We don't re-open previous threads though

warm zephyr
#

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

brave canopy
#

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

warm zephyr
#

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

brave canopy
#

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.

warm zephyr
#

perfect, but sometime background is good to have.
Anyway thanks
your (@brave canopy and @static pendant ) help is really really appriciated.

brave canopy
#

NP! ๐Ÿ™‚ Happy to help

warm zephyr
#

thanks a million
have a nice day