#Cvijo
1 messages ยท Page 1 of 1 (latest)
Hi there
hi @wind olive ๐
Have you added logging to ensure you are hitting your server and it is returning a client secret to your client?
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
Okay can you share your relevant client-side code ?
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 ๐
No worries, you can also use three backticks to make it cleaner like this
` 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
Okay you are following our deferred intent flow correct?
well i am not sure i am on your website atm and was following instructions there
Are you calling elements.submit() prior to confirmSetup() as we show here: https://stripe.com/docs/payments/accept-a-payment-deferred?type=setup#submit-the-setup
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');
after i added elements.submit() it worked ๐
but its strange i dont get any error tho
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 ๐
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 ?
Yep this is a good way to save a PaymentMethod for future use
Definitely not obsolete
tnx m8