#zen-card-cloning

1 messages ยท Page 1 of 1 (latest)

vapid pewterBOT
woeful inlet
#

Hi ๐Ÿ‘‹

Can you share the Request ID for the API request that returns the error?

marble light
#

req_VBBtmHtV5zEQIW

woeful inlet
marble light
#

sure..i thought that i am cloning it to be used against the connected account though?

#

i mentioned I ran a call to get a new payment method id...

#

Am I not understanding what is meant by "cloning" ?

woeful inlet
#

The call to create the Payment method did not include the Stripe Account header

#

Which we show in the last code snippet in the doc you referenced

marble light
#

hmm

#

i see it in my postman

woeful inlet
#

No Stripe Account header present

marble light
#

hmm.. ok, let me focus on that part then and see if I can't get it to work

#

hang on

#

why does it show the request having a token? in my postman I am sending a customer id, a payment method id and the account header

#

that request body does not seem to be what I am actually sending

#

let me try it again and grab request id

#

that is what I am sending to "clone" the payment method

#

and then I'd use the returned payment_method id + existing customer id.....

#

@woeful inlet any thoughts?

vapid pewterBOT
woeful inlet
#

Okay and what happens when you try to charge this payment method?

marble light
#

that is when I get that error I initially mentioned

woeful inlet
#

Can you share the API request that returns an error using the newly generated Payment Method ID pm_1NUuxoGg57Ont9I34gIqZNon?

marble light
#

one sec... I think I see what is going on

#

req_3fASbJFyObgAH1

#

ok, this is the new error
No such customer: 'cus_OHSjyYpzU6Irl8'

#

Shouldn't I be using the customer id I got back in the original charge that went to the platform account?

woeful inlet
#

No it needs to be a Customer that exists on the Connected Account as well

marble light
#

so I will have to create a new customer first?

woeful inlet
#

At the end of this doc we say you will need to attach the new payment method to a Customer if you want to re-use it

#

That customer needs to be on the Connected Account

marble light
#

so the steps then are

  1. clone the payment method
  2. create a new customer on the connected account
  3. ????
  4. Process the charge with new customer id and new payment method id
#

for unknown step 3... do I need to attach that payment method to the customer object or will that be done as part of the PaymentIntent creation?

haughty halo
#

What is the reason for you to want to re-use that specific PaymentMethod on the connected account @marble light

#

zen-card-cloning

marble light
#

i was thinking it'd be "setup already" if we need to charge that customer/payment method again as a direct charge which is possible in our use case

haughty halo
#

Usually you just clone again next time. That way if the PaymentMethod changed since then your flow still works

marble light
#

ok, so we should just clone/create new each time if this flow is invoked

haughty halo
#

yes that's what we recommend

marble light
#

ok, let me try it out with this approach

#

sorry.. still running into trouble

#

here's what I have done

cloned the customer and received a new customer id. I verify that this customer is linked to the target connected account

#

this is cus_OHUXMbZX5jAE3h. (req_6NbkNolyJu3zsE)

#

this example shows including a customer_id so I try to use this new ^ customer I just created and I get an error

message": "No such customer: 'cus_OHUXMbZX5jAE3h'",

req_zXrAIxCdrWXISp

#

if I take the customer_id out of the POST request, I get

"The payment method you provided is attached to a customer so for security purposes you must provide the customer in the request."

req_Udm6m9BSHS9aUS

#

What am I doing wrong?

haughty halo
#

why do you create the Customer on the connected account? I thought we agreed earlier that you would not do that and you were testing with it

marble light
#

i am trying to get a payment to the connected account by using (cloning) the details from a payment already made to our platform account

#

I thought we just said i needed to create a customer on the Connected account?

#

Snufkin_stripe โ€” Today at 12:28 PM
No it needs to be a Customer that exists on the Connected Account as well

haughty halo
#

๐Ÿ˜…

#

You and I just spoke minutes before and I explained not to do that though

#

You are a platform. You store the Customer and PaymentMethod on the platform. Then when you want to create a Direct Charge you do

  1. Clone the PaymentMethod
  2. Use that cloned PaymentMethod on a PaymentIntent
marble light
#

im really confused by this now... dont we need a customer to create a PaymentIntent?

haughty halo
#

no

marble light
#

where is

-d customer={{CUSTOMER_ID}} \

coming from ??

#

this goes back to what I said, if I try to "just" clone the payment method and do not include a customer, I get an error

"The payment method you provided is attached to a customer so for security purposes you must provide the customer in the request."

#

example: req_Qc6bKEJpVn81g4

haughty halo
#

Sorry, you're rushing through everything, that's the problem

#

Step 1: Clone the PaymentMethod from the platform to the connected account curl https://api.stripe.com/v1/payment_methods \ -u sk_test_123: \ -d customer={{CUSTOMER_ID}} \ -d payment_method={{PAYMENT_METHOD_ID}} \ -H "Stripe-Account: {{CONNECTED_ACCOUNT_ID}}"

#

This expects the Customer id and the PaymentMethod id from the platform. What you are cloning.

marble light
#

ok..

#

you still have not commented on

customer={{CUSTOMER_ID}}

#

what customer is that?

haughty halo
#

This expects the Customer id and the PaymentMethod id from the platform. What you are cloning.

#

I just said this above

marble light
#

i'm sorry that you are repeating. I feel like I've tried this... let me try to get a pm_id from just this step.. one sec

haughty halo
#

All good. You kind of got lost and likely tried many different things. This flow is really easy once you get it, but it's a pain to have it "click" in your head

#

So try what I just said first, if it doesn't work let's debug that together

marble light
#

I think I got it to work now. I have a payment into the connected account. And yes, you are right.. it makes more sense now that I see it working. Thank you for being patience with me.

haughty halo
#

Of course! I'm sorry this is so hard. We're working on a bit of a better flow where you can create a PaymentIntent on the connected account and at the same time pass the platform's Customer and PaymentMethod id clearly as part of the "clone operation" all in one request to make this easier in the future