#khaled_03640
1 messages · Page 1 of 1 (latest)
Hello
You don't actually clone Customer objects themselves, you would just recreate the Customer on the Connected Account.
In terms of cloining the PaymentMethod, https://stripe.com/docs/payments/payment-methods/connect#cloning-payment-methods shows you how to do that
I used this documentation https://stripe.com/docs/connect/cloning-customers-across-accounts
in second step they told me to clone payment method
That is our legacy documentation that you should only follow if you are still using our Tokens API and not our newer PaymentMethods API
Regardless, even in that documentation you don't actually clone the Customer -- you recreate it and then clone the Token.
okay I see
so I need what i will do is to create another customer with the same data only ?
Yep
so If I need to attach charge that made to this account to the connect account how to do it
What does "attach charge" mean?
what I need to do
is create charge with the customer on platform account then create the same customer to connect account and send to him another charge with same data then delete the customer on platform account
yes now the payment is done on the customer on platform account and I making a transfer with 98% of the charge to connect account now i need when open the connect account can see the payment with the amount and all details for the payment and aslo the customer created
did you get me?
Okay so have you cloned the payment method to your Connected Account yet?
That would be the next step.
no
when try to clone it they need to create payment method and then clone
so why doing this
You already have the payment method if you have already created the initial charge.
So you clone that payment method that is on your platform, assuming you are saving it for future use?
yes so how to get the id
How to get the payment method ID?
yes
You can list PaymentMethods by customer as one way to get it if you wanat to retrieve from our API and don't have the ID: https://stripe.com/docs/api/payment_methods/customer_list
thank you
this step is done
now I have the customer on connect account and his payment methods
what is the next step
If you want to charge it then you create/confirm a PaymentIntent on the Connected Account. So you basically do https://stripe.com/docs/payments/save-and-reuse?platform=web&ui=elements#charge-saved-payment-method but you also need to use the Stripe Account Header (see: https://stripe.com/docs/connect/authentication so that you create it on your Connected Account)
I make transfer in webhook after payment is done and success is it wrong?
Mostly depends on what you are trying to do?
Like do you always want to transfer funds to your Connected Account immediately?
And is it a one-to-one relationship?
yes one to one relation and in this case yes want to transfer immediately but with all details of the payment like derict charge
Hmm not sure what "all details of the payment" entails?
But it sounds like you should be using Destination Charges here
Not creating separate transfers
what I mean, I need when view the payment that created on connect account I can see description and the customer that paid and payment method that custmer used etc
You likely want to set metadata with that information in that case
exactly
after make a transfer I got transfer object has charge id
how to update metadata for this
or am I wrong?
You want to look at the destination_payment (https://stripe.com/docs/api/transfers/object#transfer_object-destination_payment)
That is the Charge on your Connected Account
And the one you want to update with metadata
now I have destination_payment how to update the metadata
how to get the metadata
and when put destination_payment I got
No such charge: 'py_1OgRiRR7tj15pRmknbFw6L60'
You use the Stripe Account Header to make the request on your Connected Account, as I mentioned above.
this how i use it
$transferObject->destination_payment,
['metadata' => ['shipping' => 'express']]
); ```
I don't know what that means
i mean what should I update in this
['metadata' => ['shipping' => 'express']]
That is completely up to you -- you decide on what metadata you want to set
yes I know but from where I can get it
i need it from the payment that made on the platform account
Then you retrieve the platform Charge
how
Depends where you are starting from....
Do you just have the Customer ID?
Or are you tracking any of this in your own database?
Do you have the Charge ID?
I'm start form the webhook and have the webhook response
Which Webhook specifically?
the callback that send after the payment done
payment_intent.succeeded
Okay great, then you want to retrieve the PaymentIntent using https://stripe.com/docs/api/payment_intents/retrieve and expand the latest_charge. See: https://stripe.com/docs/expand which explains how expanding responses works
great thank you
I have now just one thing
now the transfer I made has payment and this payment has customer id is none
how to attach the customer I created on connect account to this payment as the metadata I just updated
When you create the charge on the Connected Account you want to pass the customer parameter with the Customer you created on your Connected Account
So that the charge is associated to that Customer
You wouldn't use metadata for that part
This parameter specifically: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-customer
When you create/confirm your PaymentIntent on the Connected Account
this is what i use not create payment intent
'amount' => $amount * 100,
'currency' => $this->getLineItemsCurrency($stripeRegion),
'transfer_group' => $group,
'destination' => $this->stripe_connect_id,
'source_transaction' => $latest_charge
]);```
That is the one on your platform
Oh wait sorry
You are not talking about the Charge after cloning here
You are talking about the destination payment from your Transfer
You should be able to update that with https://stripe.com/docs/api/charges/update#update_charge-customer
Though honestly I've never tried doing that with a destination payment....
But I'd recommend testing it out
you mean to send it in metadata?
No, you create a Customer object on your Connected Account and then update the Charge to set that Customer object as the customer for the Charge
The "Charge" in this case is your destination_payment
okay I got you
i will try it out
👍