#itsoppong-direct-pi

1 messages · Page 1 of 1 (latest)

mellow prismBOT
#

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.

full solar
#

👋 Can you clarify what you mean by "moving from transfering payments to direct charges"?

mellow prismBOT
#

itsoppong-direct-pi

maiden gyro
#

yea definitely,

#

so connected accounts for my app are standard, and I was advised for cross border payments, and future issues, its better to use direct charge instead of what i was using const paymentIntent = await stripe.paymentIntents.create({ amount: amount, currency: paymentObj.currency, payment_method_types: ['card', 'klarna'], receipt_email: paymentObj.email, customer: customer.id, application_fee_amount: totalFeeAmount, // Set the total fee amount transfer_data: { destination: stripeAccountId, }, description: paymentObj.description, metadata: { ...paymentObj, }, });

full solar
#

customer can remain in your PI create call. However, this customer object needs to "live" on the connected account

maiden gyro
#

ok so for the customer, i get this error The customer must have an active payment source attached.

#
    let customer = await stripe.customers.list({ email: paymentObj.email });

    console.log('custssomer1', customer);
    if (customer.data.length === 0) {
      customer = await stripe.customers.create({ email: paymentObj.email });

      const token = await stripe.tokens.create(
        {
          customer: customer.id,
        },
        {
          stripeAccount: stripeAccountId,
        },
      );

      customer = await stripe.customers.create(
        {
          source: token.id,
        },
        {
          stripeAccount: stripeAccountId,
        },
      );
      console.log('custssomer2', customer);```
full solar
#

Can you share the request ID associated with the error you get?

maiden gyro
#

req_gLyy5p4QT6nG5P

full solar
#

Which guide are you following at the moment?

full solar
#

Thanks!

#

but, hold on a second. Are you cloning payment methods from the platform to the connected account because you want to be able to charge the customer from either accounts?

maiden gyro
#

naw, I'll only charge them once

#

so only from the connected

full solar
#

I see, okay. I don't recommend cloning at all in that case. What you should do in your code above is create the customer on the connected account from the very beginning

#

customer = await stripe.customers.create({ email: paymentObj.email });
This should happen on the connected account; you should include the stripeAccount header here

maiden gyro
#

customer = await stripe.customers.create({ email: paymentObj.email},stripeAccount:'{{CONNECTED_ACCOUNT_ID}}',}) so something like this?

full solar
#

yep!

maiden gyro
#

i get a no such customer error No such customer: 'cus_PZLDx7widVV3yl'

#

I am assuming it is because the customer exists on my customers, but not on the connected accounts right?

full solar
#

Can you share the request ID for that error?

maiden gyro
#

req_dlfToCOwE9XtNM

full solar
#

cus_PZLDx7widVV3yl was created on your platform, not the connected account

#

If your goal is to charge this customer from the connected account only, the customer should be created on the connected account

maiden gyro
#

like this right let customer = await stripe.customers.list({ email: paymentObj.email }); if (customer.data.length === 0) { customer = await stripe.customers.create({ email: paymentObj.email }, { stripeAccount: '{{CONNECTED_ACCOUNT_ID}}' }); } else { customer = customer.data[0]; }

full solar
#

Yep, that looks right

maiden gyro
#

hmm, I'm getting the same error

#

this is how my code looks let customer = await stripe.customers.list({ email: paymentObj.email }, { stripeAccount: stripeAccountId }); if (customer.data.length === 0) { customer = await stripe.customers.create({ email: paymentObj.email }, { stripeAccount: stripeAccountId }); } else { customer = customer.data[0]; }

full solar
#

Okay, that's only one part of your code, and this is creating a customer on the connected account. Where are you getting an error?

maiden gyro
#

ahh thanks for that, my error was here const ephemeralKey = await stripe.ephemeralKeys.create( { customer: customer.id, }, { apiVersion: '2020-08-27', stripeAccount: stripeAccountId }, );

#

didnt know I had to pass stripeAccount here also

#

ah ok now an error with the payment sheet on the client side, would you know a typical reason why id get this error No such payment_intent

full solar
maiden gyro
#

ah interesting, so instead of merchantIdentifier={STRIPE_MERCHANT}, i would use the stripeAccountId={{CONNECTED_ACCOUNT_ID}}

#

because Im using react native

full solar