#gopi_67606
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.
- gopi_67606, 1 hour ago, 61 messages
- gopi_67606, 21 hours ago, 31 messages
stripe.confirmCardPayment(clientSecret, {
payment_method: {
card: elements.getElement(CardElement)
}
});
This is not working for me in the front end
why?
How can I help?
I am not getting any response after hitting that function
What do you mean by 'not working'? Are there any errors? What happens when that code is called?
I suspect there will be errors in your browser console if you're hitting the confirmCardPayment function but nothing is happening. Can you share the code that calls that function?
For that I am creating the customer & after that I am creating the subscription & after that I am creating the payment Method uding payment Intent Id in the subscription
But my subscription is in incomplete
const { paymentIntent, error } = await stripe.confirmCardPayment(response.data.subscription.latest_invoice.payment_intent.client_secret, {
payment_method: {
card: CardElement,
billing_details: {
name: response.data.subscription.customer_name,
},
},
})
const { paymentIntent, error } = await stripe.confirmCardPayment(clientSecret, {
payment_method: {
card: CardElement,
billing_details: {
name: response.data.subscription.customer_name,
},
},
})
I meant the code which calls that function. It's normally triggered by an event like a button click
sub_1OAWPPD6fLV2vwHg0GvzUiQQ IS this subscription will get success after some time?
I am calling the function after creating the subscription
Hlo there?
I am here yes, please be patient
You need to share the code
const { paymentIntent, error } = await stripe.confirmCardPayment(response.data.subscription.latest_invoice.payment_intent.client_secret, {
payment_method: {
card: CardElement,
billing_details: {
name: response.data.subscription.customer_name,
},
},
})
The above one is the code
You need to add some logging to your code to understand why it isn't being triggered. Without an error I can't really help you
That function is triggering but no result
confirmCardPayment this function is there in stripe?
What do you mean 'no result'? Can you share the ID of the Subscription or Payment Intent?
Yes, it's in the Stripe.js lib: https://stripe.com/docs/js/payment_intents/confirm_card_payment
Yep, in a requires_payment_method state so your confirmCardPayment function hasn't been called
Can I know why the subscription sub_1OAWixD6fLV2vwHg0drOpLy2 is incomplete?
Yes Its not been called
Because the associated payment hasn't been confirmed/paid yet
const subscription = await stripe.subscriptions.create({
customer: customer.id,
items: [{
price: planId == 3 ? environment.priceId : environment.pId, // Replace with your product's price ID
}],
payment_behavior: 'default_incomplete',
payment_settings: { save_default_payment_method: 'on_subscription' },
expand: ['latest_invoice.payment_intent'],
});
Then you need to adding some logging/catch blocks to your code to understand why that is. There is likely an error that you're not catching
I am creating subscription like above one is that correct?
Looks fine to me, that's not the issue here. The issue is in your front-end code where you're receiving the client_secret from your backend and passing it to confirmCardPayment. Can you share your full code where your front-end calls your backend to initialise the Subscription creation?
Ok, and what's the confirmCardPayment code look like?
const { paymentIntent, error } = await stripe.confirmCardPayment({clientSecret}, {
payment_method: {
card: CardElement,
billing_details: {
name: response.data.subscription.customer_name,
},
},
})
This is how it looks like
pi_3OAWzaD6fLV2vwHg0tRxmAAa This is the payment Intent Id for the above error
Ok, and what is your CardElement variable?
One minute
"card": {
"installments": null,
"mandate_options": null,
"network": null,
"request_three_d_secure": "automatic"
},
Can I use this as Card element?
How are you creating that CardElement variable?