#antonioricardof_clone-payment-method
1 messages ยท Page 1 of 1 (latest)
๐ 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.
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.
- antonioricardof_api, 16 hours ago, 27 messages
- antonioricardof_api, 3 days ago, 18 messages
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?
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.
antonioricardof_clone-payment-method
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
If you follow my advice does the error subside?
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?
Nope, no Customer is created by a request to create a Payment Method.
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.
How do I use the customer id as you said, if that doesn't exist in that account.
The flow is:
- 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.
- Create a Customer on your Connected Account, if the one you want to use doesn't already exist
- 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.
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'
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.
wait, but I'm trying to make a payment in the connected account
Okay, then you need to look at the Customer in your Connected Account.
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.
is there a huge difference between clone and move
I'd like to clone, not move.
What do you mean by move, that isn't one of our concepts that I recognize offhand?
you said move
moved*
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.
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 )
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.