#sinoea - no such customer

1 messages · Page 1 of 1 (latest)

pure pebble
#

So Stripe objects like customers "live" on the account they were created on. It sounds like you may have made this customer object on the platform account and then tried to use it in a call on the connected account, you will need to recreate the customer on the connected account in order to use it in calls there

marble dirge
#

Hello @pure pebble , thanks for the links. If want to only save customers to a connected acccount, each connected account will have its own customers. Do I need to create a customer for the master Stripe Connect acccount too?

#

Currently, I am generating a token using the connected account ID (Stripe-Account header)

#

and when creating a customer and attaching the payment method I also pass the Stripe-Account header

#

I am passing the Stripe-Account header on all API calls, thinking that the transaction, customer , payment method is isolated to the connected account

#

I am not saving customers on the platform account, is that even required?

pure pebble
#

This all depends on what you are trying to do.

#

To quickly clarify, are you taking mostly card payments here or are you using other payment methods as well?

marble dirge
#

mostly card payments

#

only card payments

#

@pure pebble

pure pebble
#

Sorry still busy and jumping around between threads. Will be back in a minute

marble dirge
#

ok sure

pure pebble
#

So with cards it can often make sense to have a Custom record on your platform. Basically, you can copy card details from your platform to your connected accounts without having to re-collect details but you can't copy them the other way. https://stripe.com/docs/payments/payment-methods/connect

#

So storing the details on the platform can enable you to re-use cards more easily across accounts if that is desirable to you.

#

And to answer the rest of your questions, yes, each account that needs to interact with the Customer will need its own copy of the Customer object. This can get a bit complicated because the Customer details are not automatically copied between accounts. So you will need to manually update the details as needed. Sometimes it may make more sense to keep all of your customer data on your platform account or on your servers and pull from there instead of trying to keep everything update. But that is all up to you

marble dirge
#

let me see if I have the basics right first then. The secret and public key is set from the platform account, and I also include the connected account's ID in the header

#

that's what I do for all API transactions

#

Is that correct?

pure pebble
#

Yes. The key is for your platform so without the account ID header, all API calls will happen on your platform. To make a payment on the connected account, you will need to make calls to create the payment intent on the connected account and then a call to charge that payment method on the connected account

#

Actually, taking a step back. Are you using Standard, Express, or Custom connect?

marble dirge
#

Standard

#

So can I create customers, payment methods without passing in the connect account? Keeping them under the platform level?

#

and only when creating the payment intent I pass the connected account ID?

pure pebble
#

Gotcha. So what we are saying is still all relevant. Yes, that would make sense if you want to re-use the card across multiple platforms.

#

The other option would be working entirely on each connected account which can also work. The one difference would be that the user would need to input their card info again each time they are paying a new connected account.

marble dirge
#

ok

#

This is what I am going to do now, for all API transactions I will pass the secret and public key for the platform account

#

I will only include the connected account ID when creating a PaymentIntent and a SetupIntent

#

would that technically work?

#
  1. generate token including the connect account ID (and platform account's secret and public key)
  2. save, update, retrieve and delete customers and payment methods using ONLY platform account's secret and public key
  3. create/confirm PaymentIntent and SetupIntent including the connect account ID (and platform account's secret and public key)
#

do the above steps make sense? Would that work

pure pebble
#

Hey I actually have to step out but my colleague @boreal violet can check that out and help you going forward in this thread

boreal violet
#

👋

#

I'm still catching up. There's a lot of context here

marble dirge
#

thanks @boreal violet

boreal violet
#

But if you kept all the records/objects on the Platform account and used Destination charges (so the Charge is also on the Platform account) that would work and ensure all the right objects exist when you try to process payments.

marble dirge
#

if I do as you suggest, then the connected accounts cannot see saved customers/payment methods on their dashboard?

#

basically, this is what we want to achive, we are using Stripe connect because we want to monetise on our 35p application fee

#

the rest goes to the connected account

#

we want the connected account to be able to search for customers, transactions and payment methods on the Stripe dashboard

#

What would be the best and easiest way to achieve this?

boreal violet
#

I am reviewing my test account with Connect accounts and they can see charges created on the platform

#

A good way to test this out is to create some test Connect accounts and a number of charges. Then, in the dashboard, you can navigate to the Connect account and select "View Dashboard as this account" from the menu to see what your Connect accounts will be able to see.

marble dirge
#

Yes we have this set up actually

boreal violet
#

Ah, is it that the Customers do not propagate?

marble dirge
#

I will come back with further questions, but since deployements take time please confirm if this technically works:

#
  1. generate token including the connect account ID (and platform account's secret and public key)
  2. save, update, retrieve and delete customers and payment methods using ONLY platform account's secret and public key
  3. create/confirm PaymentIntent and SetupIntent including the connect account ID (and platform account's secret and public key)
#

for direct charges

#

yes we had problems saving customers, so we are going to do the above steps firs

boreal violet
#

Direct charges will not work because the Customers and Payment Methods will not exist on the Connect Acocunt

marble dirge
#

Where will they live? In the Platform Account?

boreal violet
#

Yes, based on Step 2 you just outlined

#

You have a choice between keeping everything on the Platform or everything on the Connect account

marble dirge
#

So if I achieve the above 3 steps, the next step is to clone the payment methods and customers to the connect account

#

would that then allow them to see customers and payment methods on the connect dashboard?

boreal violet
#

You would want to clone the customer/pm as step 3, before you attempt the payments

#

And yes, they would see the Customers and PMs

marble dirge
#

ok and when generating token we would need the connect account passed in?

boreal violet
#

When you say "generating token" what token are you referring to?

marble dirge
#

Stripe.js , we are usign stripe elements

#

var stripe = Stripe('<%= publicApiKey %>', {stripeAccount:'<%= connectAccount %>'});

#

maybe not necessarily generating a token

boreal violet
#

Ah you mean tokenizing the payment method?

marble dirge
#

yes

#

do we need to include the connect account Id there?

#

or just the platform's secret key will do?

#
  • public key
boreal violet
#

You want to just use the Platform's Public Key since you are creating the PM on the platform before you clone it to the Connect account

marble dirge
#

ok fantastic

#

for new payments without saving card I need to clone the payment method and attach the payment method to the payment intent and pass the connect account ID?

#

when creating a payment intent

boreal violet
#

Yes you will want to use the Connect Account and provide the cloned Payment Method ID when creating the Payment Intent on the Connect Account

marble dirge
#

ok

#

let's see how we get on, thanks for now

marble dirge
#

strange I getting no such payment intent error

icy osprey
#

👋 snufkin had to head out, but I can help!

marble dirge
#

before we even hit our own API or code, this is a straight call to Stripe's API using the platform's public key only

#

Hello @icy osprey trying to use Stripe Connecct

#
  1. generate tokenised payment using ONLY platform account's public key. This is for Stripe.js , Stripe elements
  2. save, update, retrieve and delete customers and payment methods using ONLY platform account's secret and public key
  3. create/confirm PaymentIntent and SetupIntent including the connect account ID (and platform account's secret and public key)[6:07 PM]for direct charges[6:08 PM]
#

trying to use stripe connect

#

and only include the connect account ID when creating a payment intent or set up intent

icy osprey
#

Can you share that Payment Intent ID from the screenshot you just sent over?

marble dirge
#

No such payment_intent: 'pi_3LFLnxJBGhqsviRV0yWU3WNX'

#

thats a new one

#

Any ideas @icy osprey /

icy osprey
#

So just sharing what I see so far - pi_3LFLnxJBGhqsviRV0yWU3WNX was created on a connect account (using the Stripe-Account header). The reason you get the error is because when you confirm it client-side, you're doing so with the publishable key from the platform account. You need to ALSO be confirming the payment client-side with the Stripe-Account header.

#

I'm not fully following why you're doing 1 and 2 here:

  1. generate tokenised payment using ONLY platform account's public key. This is for Stripe.js , Stripe elements
  2. save, update, retrieve and delete customers and payment methods using ONLY platform account's secret and public key

Is your goal to collect payment information on the platform and then clone it to the connect accounts?

marble dirge
#

yes that's my goal

icy osprey
marble dirge
#

yes let me read it again

marble dirge
#

i am geting this error now

#

com.stripe.exception.InvalidRequestException: No such PaymentMethod: 'pm_1LFMXYJBGhqsviRVCHbyfGY1'; code: resource_missing; request-id: req_Oo6FZLHhmyLVRb

icy osprey
#

Let's back up - what is the sequence of events you're going through now?

marble dirge
#

Maybe best to explain what we are trying to do

#

we want to use Stripe Connect with direct charges

#

we want to get our 35p application fee sent to the Platform account, and the rest to the connected account

#

the connected accounts are all Standard Account

#

we want the connected accounts to be liable for charge backs, refunds and Stripe fees

#

We the platform are only interested in our 35p

#

we also want the customer data and payment methods data to be visible on each of the connected accounts

#

customer and payment methods data should be separated by connect account ID

#

each connected account has its own customers/payment methods

#

Now we have Stripe integration in place and it is working for normal Standard Account integration

#

We now want to use Stripe Connect, and thought the integration would be the same as normal. All we need to do is to inckude the connect account id on all API calls

#

Maybe we are wrong?!

#

What's the easiest way to achieve our goal above?

icy osprey
#

Okay, so starting with that failed request you just sent over (req_Oo6FZLHhmyLVRb)- this is failing beause you're trying to retrieve a Payment Method that belongs to a connect account, using your platform account keys. The platform doesn't have any Payment Method pm_1LFMXYJBGhqsviRVCHbyfGY1, only the connect account does, so it makes sense that trying to retrieve this Payment Method as the platform fails.

#

Does that make sense?

marble dirge
#

So I need to retrieve the oayment method by passing in the connect account Id in th header?

#

Stripe-Account: xxx

icy osprey
#

Yes

marble dirge
#

ok that resolved t

#

now I am attaching the customer to the payment method and getting this error:

#

No such customer: 'cus_LxHRQyrHyVfb8Z'; code: resource_missing; request-id: req_dscvKN0IlpvofB

icy osprey
#

Again, you need the Stripe-Account header because that Customer is on the connected account.

marble dirge
#

ok

#

that resolved it

#

So if I pass always the connected account for any API call, what would be the problem?

icy osprey
#

Well it depends on what you're trying to do - Again, if you're making requests for the connect account then you'd use the Stripe-Account header. But if you're making requests for the platform, then you need to not set the Stripe-Account header.

#

It's really important that you understand when to call them

marble dirge
#

This is the card payment flow, I would guess all these requests are for the connected account?

#

The only moment we care about the platform is when we create the payment intent, where we populate the application fee

#

we have authorise and capture auth/cancel auth flow

#

save card details to the connected account

#

save customers to the connected acccount

#

everything is for the connected account

#

Then I guess all we need to do is to include the connect account ID on these calls?

#

we dont care about saving customers and payment methods on platform level

icy osprey
#

Yes, if you don't are about saving customers or payment methods on the platform level at all then you should be making all these requests with the connect accuont ID

#

Even the Payment Intent creation should also be happening on the connect account

marble dirge
#

fantastic, let me try thatt

icy osprey
#

I'm going to head out, but if you need anything else @atomic vector is here