I am building a platform where I am using Stripe's concept of a parent "platform" account and Connected Stripe accounts that belong to this platform. (e.g. Lyft model) Following Stripe's documentation, when I create a new customer in Stripe, I create it under the main platform account and also store all the payment methods under that customer. When a customer buys something from the Connected account, I follow this doc, where I clone payment method and create a PaymentIntent that is attached to the specific Connected account. And it all works. However, when I try to get a history of customer's transactions (List of PaymentIntents), it returns an empty list because it runs it against the main platform account:
stripe.PaymentIntent.list(customer='cus_FJDHFGSJHDF')
When I specify a customer AND connected account id, it returns an empty list, because that customer doesn't exist in that Connected account, however, the paymentIntents are present in that Connected account.
So, what is the right way to create a PaymentIntent for a customer for a Connected account and then get the history of payments for that customer PER Connected Stripe account?
Here is how I clone PaymentMethod and create PaymentIntent:
payment_method = stripe.PaymentMethod.create(
customer=customer,
payment_method=customer.invoice_settings.default_payment_method,
stripe_account=stripe_connect_id,
)
intent = stripe.PaymentIntent.create(
payment_method=payment_method,
amount=amount,
currency='usd',
confirm=True,
application_fee_amount=fee_in_cents if fee_in_cents >= 1 else None,
stripe_account=stripe_connect_id,
)