I am working on stripe payments, where i require having a shared customer across different connected accounts, that are connected with the platform
I am using "Express Accounts" in stripe connect for connecting the connected accounts, that are linked with the platform account.
On the frontend (client-side) (Angular), using the "Stripe Prebuilt checkout page", for accepting payment and I am verifying the payment in webhooks(checkout.session.completed) at backend using Django Rest Framework.
I am using Destination Charges, for handling the payments and separate charges and transfers. (That i am able to achieve using stripe prebuilt checkout page by specifying payment_intent_data.application_fee_amount and payment_intent_data.transfer_data.destination)
Now I have a requirement where I need to have shared customers and share customers across the connected accounts,
i need to create token on connected account level and represent the customer there, a way to link the platform-level customer with the connected account without having to create it again.
I tried to follow this article Clone customers across accounts but I have not had any luck, unfortunately.
With Connect, you can accomplish this by following three steps:
Storing customers, with a payment method, on the platform account
Making tokens to clone the payment method when it’s time to charge the customer on behalf of a connected account
Creating charges using the new tokens
- How can i clone a token from the Platform account to a Connect account, at what step should i do in stripe prebuilt checkout page ?
- When should i do it, at the time when i create stripe.checkout.session or in the webhook under this event checkout.session.completed?
- When i created customer on platofrm, it asks for a source,
customer = stripe.Customer.create(email='[email protected]', source='tok_mastercard', )
what will be the source in my case ? where willi get the source in stripe prebuilt checkout page ? , i tried to check the logs and events for all 5 webhooks that take place but i am unable to find the source id anywhere in this 5 events:
- charge.succeeded
- payment_method.attached
- customer.created
- payment_intent.succeeded
- checkout.session.completed
and how i will get it ? as i am using checkout api and not the charges api, right ? I always get this error when i follow that article:
stripe.error.InvalidRequestError: Request req_43rToPlxJsvD: The customer must have an active payment source attached.
I can also attach any code for your review and show you what I have tried by now.
Please let me know in the comments if you need it.