#Cvijo

1 messages ยท Page 1 of 1 (latest)

stone oxideBOT
wind olive
#

Hi there

royal geyser
#

hi @wind olive ๐Ÿ™‚

wind olive
#

Have you added logging to ensure you are hitting your server and it is returning a client secret to your client?

royal geyser
#

yes, brekpoint in my javascript has client secret and i am passing it to confirmSetup

#

"seti_1MtBlcIKC68yQBO4o9OvYXKx_secret_NeUlv5ch0QjhL6sXL66Tx0dG6Jd9F50"

#

setup intent is "seti_1MtBlcIKC68yQBO4o9OvYXKx" and it is saved on stripe

wind olive
#

Okay can you share your relevant client-side code ?

royal geyser
#

const options = {
mode: 'setup',
currency: currencyCode,
loader: 'always',
paymentMethodTypes: ['card'],
locale: $rootScope.language.Key
};
vm.elements = stripeService.Stripe.elements(options);
vm.paymentElement = vm.elements.create("payment");
vm.paymentElement.mount('#stripe-payment-element');
vm.paymentElement.on('change', (event) => vm.setPayDisabled(!event.complete))

#

sorry wrong code ๐Ÿ™‚

wind olive
#

No worries, you can also use three backticks to make it cleaner like this

royal geyser
#

` async function confirmSetup(elements, clientSecret) {
const error = await stripe.confirmSetup({
elements: elements,
clientSecret: clientSecret,
confirmParams: {
//todo
return_url: 'https://example.com/order/123/complete',
},
redirect: 'if_required'
});

    if (error) {
        console.log(error.message)
    }
    return error;
}

`

#

this is mine service

#

and i am calling it like this

#

const responseConfirmSetupIntent = await stripeService.confirmSetup(vm.elements, responseCreateSetupIntent.data.ClientSecret);

#

pasing pazment elements and mz client secret

wind olive
#

Okay you are following our deferred intent flow correct?

royal geyser
#

well i am not sure i am on your website atm and was following instructions there

wind olive
royal geyser
#

my goal is to setup payment method to customer

#

no i didnt call it

wind olive
#

Okay well you will need to add that

#

But you should be seeing an error stating that as well

#

Can you add a log right below async function confirmSetup(elements, clientSecret) { ...
to ensure you are entering that block?

#

So just something like async function confirmSetup(elements, clientSecret) { console.log('inside confirmSetup function');

royal geyser
#

after i added elements.submit() it worked ๐Ÿ™‚

#

but its strange i dont get any error tho

wind olive
#

Hmm I'll check on that! We should definitely be throwing an error there

#

I'll file some feedback on that if I can repro

#

So we add an error

#

But glad it is working now ๐Ÿ™‚

royal geyser
#

i was debuging your stripe js and it got lost there

#

thank you as always you are awasome

#

btw

#

one more question

#

you asked if i am using something obsoloete

#

i am trying to add payment method do customer is that proper way ?

wind olive
#

Yep this is a good way to save a PaymentMethod for future use

#

Definitely not obsolete

royal geyser
#

tnx m8