#some1ataplace
1 messages ยท Page 1 of 1 (latest)
Hi ๐
Those create two different types of objects.
stripe.account.create creates an Account object (for use with Stripe Connect)
stripe.customer.create creates a Customer object:
https://stripe.com/docs/api/customers/object
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Yes one is for connect and the other for a customer. But for customer.create I am directly linking an existing account to a new customer?
Why would you do that exactly?
Is that exactly the same as setting up a foreign key in a database
link an exsiting account id to a new customer. If I do that, would I need to ever have a customer id in the database? I just need to store account id?
If I have both a customer who buys subscriptions on my website and a user on my website can also use connect for affiliate marketing and getting rewards for sharing a link I give them, which one would I use?
I have both scenarios where I would need both an account object and customer object
When you use the stripe-account header, you're making a request for your Connected Account:
https://stripe.com/docs/api/connected_accounts
So the difference between:
stripe.customer.create(stripe_account=<accountid>)
and:
stripe.customer.create()
is where the Customer object gets created.
With the first line, the Customer object is created on the Connected Account, so it can be used by other objects on that account. When working with Connect, that is our Direct Charges pattern, where payments are performed directly on the Connected Account so all objects those payments need to reference must also be there. Accounts are blocked from interacting with objects from other accounts.
The latter approach will create the Customer object on the Platform Account. That's typically done when working with Destination Charge flows, where payments happen on the Platform Account and then funds from those payments are transferred to your Connected Accounts.
Oh so only when you use direct charges would you ever need stripe.customer.create(stripe_account=<accountid>)?
Yup, if you are processing payments on your Platform account, then you likely don't need to create Customers on your Connected Account.