#rzhang139 - customer object
1 messages · Page 1 of 1 (latest)
ok thanks!
i mean like a customer object with no filled information.
and if i pass it into stripe.checkout.sessions.create
Ah yeah
If they successfully check out, the payment method will be attached to them
what is the field in the customer object that gets changed after checkout? is it "default_payment_method": null
To answer your question about whether the customer will be created on the platform or connect account depends
If you don't pass in the stripe account header or specify the connect account's api key, it will be the platform
You can find payment methods attached to a customer (after checkout) here: https://stripe.com/docs/api/payment_methods/list#list_payment_methods-customer
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
The default payment method can be set in a few ways though
That can be done here: https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
where do i get payment method ID from customer object?
im trying to follow https://stripe.com/docs/connect/cloning-customers-across-accounts
Ah ok
Are you attempting this in test mode?
You should be able to print out the customer object to see
Is it not showing up in sources
ohhh are the IDs in sources the payment methods?
yes im in test mode
Or actually Im not sure if cloning is the solution. I have created a cutomer object through platform and now am calling const customer = await stripe.customers.retrieve(customerID); with the customerID, and it gives this error No such customer: 'cus_LcIuS36cT6msJS. When I retrieve, am I getting customer from our platform? Do I need to clone still?
"Or actually Im not sure if cloning is the solution."
What is the problem statement and end goal? That way I can provide a recomendation
Its more debugging issue. Here is how logic that reproduces error goes:
- I created a customer like this and saved customerID
const customer = await stripe.customers.create({
name: 'Richard',
email,
});
- Then I used customerID in
stripe.checkout.sessions.create:
const session = await stripe.checkout.sessions.create({
success_url: `https://${req.headers.host}/`, // TODO: talk w frontend on which route to redirect
cancel_url: `https://${req.headers.host}/`,
line_items: [{
price: price.id,
quantity: buyAmount,
}],
metadata: { // most of this will be data necessary to create new Offer row
ownershipID: 1, // this is needed to handle post-payment logic
buyerID: userID,
buyAmount,
pricePerCreditOffered,
},
mode: 'setup', // CRITICAL
customer: customer.id,
customer_update: {
address: 'auto',
shipping: 'auto',
},
}, {
stripeAccount: stripeAccountID,
});
Is it because the customer object currently exists on our platform and not the vendor's stripe account?
Ah I see. You will have to provide the relevant object ID's for me to verify. What kind of charges are you using (destination, etc.)? And what type of Connect accounts?
We are using standard accounts, and im not sure what u mean by charges. Doesnt checkout session create a new charge?
Standard accounts use direct charges meaning all the Stripe objects live on the connected account: https://stripe.com/docs/connect/direct-charges
You should be creating the customer objects on the connected account
Is it possible for us to keep track of customers and payment info? EX: Once we clone it, and passed the cloned customer object into creating the session checkout, is there a way to update our platform's customer object with the cloned customer object after checkout?
Why do you need to clone here just curious?
Customer objects should live on the connected account in the first place with standard accounts
Is there a specific reason?
Say a user buys from one vendor, we want to save their information if the same user buys from another vendor. Simply tracking payment info of the user so it can be used for all vendors
Got it that helps
Unfortunately (from step 3):
Charges that are made on the cloned customer aren’t reflected on the original customer. This feature is intended for multiple connected accounts that need to charge the same user.
I see thanks. Is there a way around this? Or should I just not store information and have the buyer input their payment info each time they interact with a new vendor?
That's up to you but there's not really a way around it unfortunately
what connect account will allow us to control custome object?
You can use Express and Custom accounts for that. The Customer object as well as the PaymentIntent, etc. will all live on the platform account
You can read more about that here: https://stripe.com/docs/connect/destination-charges
Ok thanks! That was very helpfu have a good day!