#Felix Cao

1 messages · Page 1 of 1 (latest)

opal sirenBOT
rugged bronze
karmic hazel
#

Thanks
but i can not see the log for today

#

The latest is 25 JUN 202

rugged bronze
#

Or can you share with me the request_log_url?

karmic hazel
rugged bronze
#

No I mean the request_log_url that you can get from the response.

karmic hazel
#

wait a moment
let me check

opal sirenBOT
karmic hazel
empty acorn
#

that PaymentMethod belongs to a different customer

karmic hazel
#

可是我刚新注册的,新加的

empty acorn
#

i'm sorry, but we're only able to help in English here

#

to be clear, that PaymentMethod is attached to cus_O9oeV3HmH8f1rs

karmic hazel
#

But, I register it just now

#

O, I know

#

Is it the reason ?

empty acorn
#

no, the Stripe account header is not the reason.

karmic hazel
#
/**
 * @param {number} amount - will pay the amount
 * @param {string} currency_code
 * @param {string} customer_id
 * @param {string} payment_method_id
 * @param {string} connected_account_id
 * @param {string} reference_number
 */

async function createCharge(amount, currency_code, customer_id,  payment_method_id, connected_account_id, reference_number) {
  try {
    const paymentIntent = await stripe.paymentIntents.create(
      {
        confirm: true,
        customer: customer_id,
        currency: currency_code,
        metadata: { reference_number },
        amount: parseFloat(amount) * 100,
        payment_method: payment_method_id,
        automatic_payment_methods: { enabled: true, allow_redirects: 'never' },
      },
      {
        stripeAccount: connected_account_id,
      }
    );
    return paymentIntent;
  } catch (err) {
    console.log('Stripe Error log message: ', err.raw.message);
    console.log('Stripe Error log URL: ', err.raw.request_log_url);
    throw new Error(err.raw.message);
  }
}
#

So, the above code, I don't need to pass the payment_method_id to stripe ?

rugged bronze
#

Hi @karmic hazel can you tell me what you want to achieve?

karmic hazel
#

I had get the customer_id and payment_method_id
and collected the payment detail
So I want to charge the it

#

Please help me to check:

customer_id: cus_O9oe71luyVtSMU
payment_method: pm_1NNV1UKg0o5MtnuxvTiOEqfN

rugged bronze
#

So you want to create a direct charge on a connected account.

karmic hazel
#

Yes

rugged bronze
#

Ok, did you get any error when you execute createCharge ?

karmic hazel
#

Yes the above error

rugged bronze
#

request ID?

karmic hazel
#

I tried to delete the payment_method_id on the above code

But still get error

rugged bronze
#

In req_3buyL4DKluC2Fo, you didn't specify a payment_method but confirm is set to true

#

In req_5jlE9xiYZwKcGJ, you specifed a payment_method that doesn't belong to the customer.,

#

Use a payment_method that belongs to the customer, and try again.

karmic hazel
#

I use the same card to more than 2 account

Is this the reason?

#

4242 4242 4242 4242 08/24 123 94107

rugged bronze
#

No

#

even if the card number is the same, the payment methods that created from the same card number are considered as different objects.

karmic hazel
#

For this step, how to handle ?

rugged bronze
#

What do you mean?

karmic hazel
#

how to attach the payment_method_id to customer_id

rugged bronze
karmic hazel
#

These code can attach the payment_method_id to customer_id ?