admin管理员组文章数量:1292749
I have create payment intent for connected stripe account to our platform from backend and send client secret to frontend.Here problem is when i am trying to confirm that payment with client secret to stripe it is not working but if i pass stripe account id of that connected user it is working but it is not secure because here we have to add stripe account id of connected user in front end so that is any other way or i am making some mistake in collecting payments from stripe for connected user.
I am finding solution for collecting payment for our platform users who has been connected their stripe account to our platform.
Here is my frontend code where i have to pass stripe account id to confirm payment of our connected account user
const stripe = Stripe(stripePublishKey,{
stripeAccount: connectedUserStripeAccountId, //look like acct_****
});
Here is my frontend code for confirm payment where i pass client secret which is fetch from payment intent created from backend for connected user
const { paymentIntent, error } = await stripe.confirmCardPayment(clientSecret, {
payment_method: {
card: card,
billing_details: {
name: document.getElementById("name").value,
address: {
country: document.getElementById("country").value
}
}
},
});
I have create payment intent for connected stripe account to our platform from backend and send client secret to frontend.Here problem is when i am trying to confirm that payment with client secret to stripe it is not working but if i pass stripe account id of that connected user it is working but it is not secure because here we have to add stripe account id of connected user in front end so that is any other way or i am making some mistake in collecting payments from stripe for connected user.
I am finding solution for collecting payment for our platform users who has been connected their stripe account to our platform.
Here is my frontend code where i have to pass stripe account id to confirm payment of our connected account user
const stripe = Stripe(stripePublishKey,{
stripeAccount: connectedUserStripeAccountId, //look like acct_****
});
Here is my frontend code for confirm payment where i pass client secret which is fetch from payment intent created from backend for connected user
const { paymentIntent, error } = await stripe.confirmCardPayment(clientSecret, {
payment_method: {
card: card,
billing_details: {
name: document.getElementById("name").value,
address: {
country: document.getElementById("country").value
}
}
},
});
Share
Improve this question
edited Feb 13 at 6:21
Yuvaraj M
4,6163 gold badges10 silver badges19 bronze badges
asked Feb 13 at 6:12
vivek bhimanivivek bhimani
11 bronze badge
1 Answer
Reset to default 0For something like Stripe Checkout, I use the endpoints and wait for the events.
For example:
app.get('/order/success', async (req, res) => {
console.log('order success');
// fetch session
const session = await stripePayment.checkout.sessions.retrieve(req.query.session_id)
.catch((err) => {
console.error(err);
})
;
// fetch customer deets
const customer = await stripePayment.customers.retrieve(session.customer)
.catch((err) => {
console.error(err);
})
;
This will allow you to get the customer information without it being in the clear.
Here is a link to Stripe's documentation that covers this example as a way to understand the handshake: https://docs.stripe/api/checkout/sessions/retrieve?lang=node
Edit: I'm adding another reference for you to see the front and back end examples of how Stripe reference docs explain it: https://docs.stripe/payments/quickstart
(make sure to choose the appropriate framework and languages at the top, in this case Javascript, HTML, Node.js)
本文标签: nodejsHow to confirm payment intent of connected account in stripe from our platformStack Overflow
版权声明:本文标题:node.js - How to confirm payment intent of connected account in stripe from our platform - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741561274a2385462.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论