#antonioricardof_clone-payment-method

1 messages ยท Page 1 of 1 (latest)

strange pewterBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can start a new thread if you have another question.

๐Ÿ”— 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/1250080469534375957

๐Ÿ“ Have more to share? Add details, code, screenshots, videos, etc. below.

gloomy fossilBOT
#

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.

rugged star
#

Hi ๐Ÿ‘‹ can you share the ID of a request you made to try to clone a Payment Method that you can share, so I can gather more insight on what you're doing?

narrow light
#

sure

#

req_F0AxJoS7uZYUZu

rugged star
#

Ah, I see. You need to provide the ID of the Customer object from your Platform account that you're copying the Payment Method from, rather than the ID of the Customer in your Connected Account that you want to create the copy for. That will give you a Payment Method, that you can then attach to the Customer on the Connected Account by making a request to do that.

strange pewterBOT
#

antonioricardof_clone-payment-method

narrow light
#

Okay, but yesterday the support guy here told me the opposite.

#

"You would need to create a new Customer and use that object's ID" it was the answer from you yesterday

#

I'm confused now

#

when I say "you" is not you

rugged star
#

If you follow my advice does the error subside?

narrow light
#

lol

#

Okay, one sec

#

@rugged star if I uses this method for example:

stripe.PaymentMethod.create(
payment_method=payment_method,
customer=customer['id'],
stripe_account=stripe_account
)

they will create the customer for me there? I don't need to recreate right?

rugged star
#

Nope, no Customer is created by a request to create a Payment Method.

narrow light
#

okay

#

I will receive the error that the customer doesn't exist

#

right?

rugged star
#

No, you'll provide the ID of the existing Customer from your Platform account, which has to exist in order for you to copy a Payment Method from them.

narrow light
#

How do I use the customer id as you said, if that doesn't exist in that account.

rugged star
#

The flow is:

  1. Make the request to clone the Payment Method from your existing Customer on your Platform. Use the ID of the existing Payment Method and Customer there.
  2. Create a Customer on your Connected Account, if the one you want to use doesn't already exist
  3. Make a request to attach the newly created Payment Method, from step 1, to the Customer mentioned in step 2
#

Let me know if that doesn't work for you.

narrow light
#

An error occurred: Request req_IQVbmgd1VRNf9w: No such customer: 'cus_QGhJzajDeNNQM8'

#

error returned:

2024-06-11T13:48:14.705Z Customer created: cus_QH39qsQ9wkzbXc 2024-06-11T13:48:15.020Z Payment method attached to customer: pm_1PQ9vRK0S1AwmKXa6B74ncIi 2024-06-11T13:48:15.020Z Attempting to create payment intent for 7.085 usd for customer cus_QGhJzajDeNNQM8 2024-06-11T13:48:15.021Z Creating payment intent for 7.085 usd 2024-06-11T13:48:15.208Z An error occurred: Request req_IQVbmgd1VRNf9w: No such customer: 'cus_QGhJzajDeNNQM8'

rugged star
#

That's expected there. The Customer you specified exists on your Platform account, but you made the request to retrieve their Payment Methods from your Connected Account.

#

You would need to make that request as your Platform.

narrow light
#

wait, but I'm trying to make a payment in the connected account

rugged star
#

Okay, then you need to look at the Customer in your Connected Account.

narrow light
#

but you said to use the same id lol

#

I'm confused

rugged star
#

When you're cloning the Payment Method, you use the ID of the Customer from your Platform account. You've now moved on to doing other things where you shouldn't use that ID anymore.

narrow light
#

I'd like to clone, not move.

rugged star
#

What do you mean by move, that isn't one of our concepts that I recognize offhand?

narrow light
#

you said move

rugged star
#

I see the confusion. I meant at first you, as the developer, were writing request to clone a payment method. You, as the developer, have now moved on to writing a different part of the integration where you're trying to charge the newly cloned payment method. I was not referring to moving objects within Stripe.

narrow light
#

anyway, if I understand correctly:

pm = stripe.PaymentMethod.create( payment_method=payment_method, customer=customer_id, stripe_account=stripe_account ) print(f"Payment method created to customer: {payment_method}, {customer_id}") stripe.PaymentMethod.attach( payment_method=pm['id'], customer=customer['id'], stripe_account=stripe_account )

rugged star
#

In there, the first request should use the ID of the Customer object from your Platform account. The second request should use the ID of the Customer from your Connected Account.

narrow light
#

okay

#

it's right so

#

lemme test now

#

i did

#

looks like works