#Jeni

1 messages · Page 1 of 1 (latest)

bleak kilnBOT
clever gate
#

Hi! Let me help you with this.

#

What type of charges are you making?
Direct or Destination?

rigid knoll
#

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

clever gate
rigid knoll
#

Sure

#

req_owt0Hs5MffL0UO

clever gate
#

It seems you're sending a GET request here.

#

Is this the error you're getting when calling stripe.paymentIntents.create()?

rigid knoll
#

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

clever gate
#

This is a GET request: req_owt0Hs5MffL0UO
But stripe.paymentIntents.create() sends a POST request. Is there code after this that you're executing?

rigid knoll
#

yes but i don't have that code

#

this payment intent is used for making payment from frontend

rigid knoll
clever gate
#

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?

rigid knoll
#

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 };
}
}

clever gate
#

Okay, does this function fail?

bleak kilnBOT
rigid knoll
#

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

clever gate
#

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

rigid knoll
#

Ok thanks

clever gate
#

Happy to help. Please, let me know if you have any other questions.

rigid knoll
#

Can u show how to pass the stripeAccount header

subtle tusk
rigid knoll
#

Ok thanks

rigid knoll
#

Hi i am already passing in the header

rigid knoll
subtle tusk
#

Which part is failing exactly?

#

Seems you're trying to retrieve the Payment Intent? You also need to use the stripeAccount parameter there