#Jeni
1 messages · Page 1 of 1 (latest)
Hi! Let me help you with this.
What type of charges are you making?
Direct or Destination?
Direct
const paymentIntent = await stripe.paymentIntents.create(
{
amount: totalAmount,
currency: "usd",
customer: customerId,
payment_method_types: ["card"],
description: description,
confirm: true,
metadata: {
order_id: metaData.cartId,
qty: metaData.qty,
user_email: metaData.userEmail,
vendor_email: metaData.vendorEmail,
vendor_stripe_account: accountId,
},
application_fee_amount: totalCommission,
},
{
stripeAccount: accountId,
}
);
I used this code but it gave me no such payment intent error
if i try to use Destination the application fees is going my connected account i am not recieving it
here the amount should go to connected account and commission should go to platform account...Can u help
Could you please share the Request ID req_xxx? https://support.stripe.com/questions/finding-the-id-for-an-api-request
And the exact error message.
It seems you're sending a GET request here.
Is this the error you're getting when calling stripe.paymentIntents.create()?
yes
this payment intent is being sent to frontend which is a mobile app...from there the user will enter card details and will make the payment
can u help with the scenario...i am not sure if its the correct way of code i have used
This is a GET request: req_owt0Hs5MffL0UO
But stripe.paymentIntents.create() sends a POST request. Is there code after this that you're executing?
yes but i don't have that code
this payment intent is used for making payment from frontend
How to send commission to platform account using destination?
The API call seems to be correct. However the error you sent me seems to be unrelated.
Could you please provide the full code you use to send a client_secret?
Okay
async createPaymentIntent(amount, accountId, customerId, metaData) {
try {
let description = "Product order by" + " " + metaData.userEmail;
let totalAmount = Math.round(amount * 100);
let commission = Math.round(cnstObj.commissionPercent * totalAmount); //6% commission
let stripeFees = Math.round(
totalAmount * cnstObj.stripeFeePercent + cnstObj.stripeCents
); //2.9% + 30 Cents stripe fees
let totalCommission = commission + stripeFees;
const paymentIntent = await stripe.paymentIntents.create(
{
amount: totalAmount,
currency: "usd",
customer: customerId,
payment_method_types: ["card"],
description: description,
confirm: true,
metadata: {
order_id: metaData.cartId,
qty: metaData.qty,
user_email: metaData.userEmail,
vendor_email: metaData.vendorEmail,
vendor_stripe_account: accountId,
},
application_fee_amount: totalCommission,
},
{
stripeAccount: accountId,
}
);
const clientSecret = await paymentIntent.client_secret;
return { status: true, clientSecret: clientSecret };
} catch (err) {
console.log("Error completing payment.", err);
return { status: false, errorMsg: err };
}
}
Okay, does this function fail?
it will not fail...it is giving payment Intent and client secret
but that payment intent is not working
I have created the customer for the connected account
It seems like it is "not working" because you create it on the Connected account (with stripeAccoutn), but then you access it on the Platform (where it doesn't exist). When you GET your PaymentIntent you also need to include the stripeAccount header
Ok thanks
Happy to help. Please, let me know if you have any other questions.
Can u show how to pass the stripeAccount header
Ok thanks
Hi i am already passing in the header
See in this code i am passing the stripe account