0
votes

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:

  1. Storing customers, with a payment method, on the platform account

  2. Making tokens to clone the payment method when it’s time to charge the customer on behalf of a connected account

  3. Creating charges using the new tokens

  1. 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 ?
  2. When should i do it, at the time when i create stripe.checkout.session or in the webhook under this event checkout.session.completed?
  3. 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.

1

1 Answers

0
votes

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.

You can't do this, directly. The connected account has no visibility of the platform customers. You could create a customer on the connected account and use metadata to label it with your platform customer, though. eg, set metadata.platform_cust_id=cus_123

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 ?

You'd follow the guide you linked, generally, but you can't do this with Stripe Checkout. Checkout always collects a new Payment Method, so the idea of cloning from the platform is moot.

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: 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,

Some clarifications:

  • Sources is an older API mostly not relevant to Checkout. It uses the newer Payment Methods API.
  • I'd suggest looking at Payment Methods and focusing on using that
  • If you want to clone Payment Methods to connected account, review this doc.
  • For later payments, you should create Payment Intents supplying both the customer and payment_method using the customers saved payment methods (checkout will create these).