#rzhang139 - customer object

1 messages · Page 1 of 1 (latest)

hidden plinth
#

Hello. One moment

fallen needle
#

ok thanks!

hidden plinth
#

What do you mean by blank?

#

Like an empty string?

fallen needle
#

i mean like a customer object with no filled information.

#

and if i pass it into stripe.checkout.sessions.create

hidden plinth
#

Ah yeah

#

If they successfully check out, the payment method will be attached to them

fallen needle
#

what is the field in the customer object that gets changed after checkout? is it "default_payment_method": null

hidden plinth
#

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

#

The default payment method can be set in a few ways though

fallen needle
#

where do i get payment method ID from customer object?

hidden plinth
#

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

fallen needle
#

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?

hidden plinth
#

"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

fallen needle
#

Its more debugging issue. Here is how logic that reproduces error goes:

  1. I created a customer like this and saved customerID
  const customer = await stripe.customers.create({
    name: 'Richard',
    email,
  });
  1. 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?

hidden plinth
#

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?

fallen needle
#

We are using standard accounts, and im not sure what u mean by charges. Doesnt checkout session create a new charge?

hidden plinth
#

You should be creating the customer objects on the connected account

fallen needle
#

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?

hidden plinth
#

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?

fallen needle
#

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

hidden plinth
#

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.

fallen needle
#

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?

hidden plinth
#

That's up to you but there's not really a way around it unfortunately

fallen needle
#

what connect account will allow us to control custome object?

hidden plinth
#

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

fallen needle
#

Ok thanks! That was very helpfu have a good day!