#irfanullah7513_api

1 messages · Page 1 of 1 (latest)

native pivotBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question. Thank you for your patience!

⏱️ We automatically close idle threads, which makes them read-only. Make sure you stick around to chat in realtime! If this thread is closed and you have another question you'll need to start a new thread.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1214099798567690331

📝 Have more to share? You can add more detail below, including code, screenshots, videos, etc.

rough ventureBOT
#

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.

uncut spade
#

This request failed because you specified the stripe_account in the request param.

real fox
#

req_QtDvqhRvXaTvAf

uncut spade
#

Ah OK, you passed the connected account ID in the request header in the second request

real fox
#

I already specified the stripe_account

$result = $stripe->paymentMethods->attach(
'pm_1Oq8mXC3fRpXjzyoGStdmEme',
[
'customer' => 'cus_PNbkUIBmefytXN'
],
['stripe_account' => 'acct_1OSa5uC0wiqTfzk5']
);

uncut spade
real fox
#

Okay, let me try with cloning

#

I using the following now I am getting error no customer even the customer exist under the connect account

$result = $stripe->paymentMethods->create([
'customer' => $stripe_customer_id,
'payment_method' => $payment_method_id,
], [
'stripe_account' => $this->connected_account_id
]);

#

req_Ui67j0kuLFiwaJ

uncut spade
#

You must provide the Customer ID in the request when cloning PaymentMethods that are attached to Customers for security purposes.

The customer ID here is the ID of the platform customer of which the payment method is attached to, not the ID of a connected account customer.

real fox
#

Where I can get the platform customer ID, because I have main account where I have created the connect account and under the connect account I created the customers.

uncut spade
#

You need to attach the payment method to a customer before you can clone it to a connected account.

#

If it's not, clone it without specify the customer in the request.

real fox
#

But I am specify the customer but the customer is under the connect account

uncut spade
#

As I said earlier, the customer should belongs to platform, not connected account. If the payment method wasn't attached to any customer, you can should just remove customer from the request.

#

It is possible to clone PaymentMethods to connected accounts without previously attaching them to Customers. However, note that the original PaymentMethod will be consumed, since PaymentMethods that aren’t attached to Customers can only be used once.

real fox
#

So for this I will create first the customer outside of the connect account and create the payment method for it and then I will clone this payment method for the customer under the connect account

uncut spade
#

" the customer outside of the connect account " -> I assume you mean the customer in platform?

real fox
#

Yes

#

?

uncut spade
#

Ok Have you tried?

real fox
#

I used the following code then got the following response, but I am confuse because the payemnt method is not attach to the customer under the connect account
$result = $stripe->paymentMethods->create([
'customer' => 'cus_Pb3unEeVnuSelp',
'payment_method' => $payment_method_id,
], [
'stripe_account' => $this->connected_account_id
]);

Stripe\PaymentMethod Object
(
[id] => pm_1OqW0sC0wiqTfzk5HZxKMD7F
[object] => payment_method
[billing_details] => Stripe\StripeObject Object
(
[address] => Stripe\StripeObject Object
(
[city] =>
[country] =>
[line1] =>
[line2] =>
[postal_code] =>
[state] =>
)

uncut spade
#

That's because you haven't attach it to any customer in the connected account yet.

real fox
#

in this code the customer id will be the connect account customer?

$result = $stripe->paymentMethods->create([
'customer' => 'cus_Pb3unEeVnuSelp',
'payment_method' => $payment_method_id,
], [
'stripe_account' => $this->connected_account_id
]);

uncut spade
#

No. Let me give you a summary so that we can be in the same page.

#
  1. Clone the payment method by using $stripe->paymentMethods->create, the customer in the request param should belongs to platform
  2. Attach the payment method to a customer in connected account by using $stripe->paymentMethods->attach, the customer in the request param should belongs to the connected account.
real fox
#

Okay, but when I created the payment using the Stripe.js, is it not creating as a platform customer

stripe.createPaymentMethod({
type: 'card',
card: elements[0] // Assuming elements[0] represents your card Element
}

uncut spade
#

No, Stripe.js doesn't have an API to create a customer

#

You need to create a customer from your backend

real fox
#

If I create the token using the Stripe.js it also have the same flow?

uncut spade
#

If the question is about whether can can create a customer through tokens API from Stripe.js, No, Stripe.js doesn't have an API to create a customer