#sandip5831

1 messages · Page 1 of 1 (latest)

high cedarBOT
tiny cape
boreal hill
#

1.] How we attach default payment method before create payment intent API?

-> We use create payment intent api

tiny cape
#

How are you creating the Payment Method objects though?

boreal hill
#

And using client secret key we launch paymentsheet

tiny cape
boreal hill
#

My current Flow is like :

Step 1.] We create Ephemeral key
Step 2.] Create payment intent api
Step 3.] Launch paymentsheet using client_secret , customer and ephemeral key
Step 4.] Add card detail
Step 5.] Payment will successed but that payment method not saved in customer

tiny cape
#

Did you read the last doc I sent? You're likely just missing the setup_future_usage param from your Payment Intent creation

boreal hill
#

Yes, we have already set that param in API.

tiny cape
#

Can you share a pi_xxx ID?

boreal hill
#

ok 2 min

#

Check this intent_id : pi_3NQRLKSD4HidQvDB1jGDXjNS

tiny cape
#

Checking

boreal hill
#

Yup

tiny cape
boreal hill
#

We are creating the customer into connect account that's why is not create customer object in above payment intent?

tiny cape
#

I guess so yep

boreal hill
#

So, what your suggestion for us about that flow? How we will implement?

#

You get my flow right?

tiny cape
#

You need to create a Customer object on the account where you're creating the PI

pale elk
#

@tiny cape Hi, me and @boreal hill Both are working on the same issue

We do not want to create new customer every time when creating payment intent

We just want to clone customer into connect account so we can reuse the same customerID

As welll when customer is trying to make payment, He can see cards list which he had made payment before

tiny cape
#

I'm going to close your thread @pale elk . Let's all chat here

pale elk
#

Yeah sure!!

tiny cape
#

We do not want to create new customer every time when creating payment intent
Sure seems reasonable. You'd persist the cus_xxx ID that maps with a specific customer in your own database or similar

pale elk
#

Yes, we have our own database where we have stored main platform customerID

tiny cape
#

I'd recommend look at this guide: https://stripe.com/docs/payments/payment-methods/connect

The idea for standard platforms, like yourself, is:

  1. Create an initial Customer object at the platform level.
  2. Collect their payment details via a Setup Intent and save the PM to that Customer.
  3. You can then clone that Customer, and the attached PMs, to your connected accounts.

Considerations for Stripe Connect platforms adding support for new payment methods using the Payment Methods API.

pale elk
#

Yes exactly

tiny cape
#

The issue you're going to run into with your existing flow is that you can't clone from connected account to connected account

#

You need to consider the platform account the 'master' account where all Customers and payment methods exist

#

Then when customer X wants to make a payment on connected account Y, you clone customer X to connected account Y and create the PI as you currently are

pale elk
#

No, I think you miss-understood little

Let me explain you again

#

I have platform "Master" customer ID in our database

We want to clone customer from main platform to connected account

Now the thing is currently customer don't have any default payment method
So customer can't be cloned into connect account without default payment method right

Now what we are thinking, We will first check if the customer have default payment method or not

If not then we will initiate setup intent where we will attach payment method to customer

Then we are able to clone customer into connect account

#

So we want to ask you that if this flow will work or not ? That's our first question

tiny cape
#

Sure, sounds reasonable

boreal hill
#

@tiny cape So we want to ask you that if this flow will work or not ? That's our first question

tiny cape
#

As I said, yes I believe it will work if your intention is to clone a Customer without a PM

high cedarBOT
hoary flume
#

👋 taking over for my colleague. Let me know if there's any follow-up Qs I can answer!

pale elk
#

Yes, So in last dicussion with @tiny cape

I asked him about possibility on clone platform customer to connect account

But customer don't have any default payment method

hoary flume
#

he already answered that question

#

any follow-ups?

pale elk
#

While implementing above flow in our existing code

I have another question about cards

hoary flume
#

sure

pale elk
#

After we implement default payment method to customer and clone platform customer into connect account

Now customer is trying to make payment with another card not the one which is default selected

So that card will be saved for customer or it will be saved only under connect account ?

#

New card which customer made the payment either in same connect account or either in different connect account

hoary flume
#

after cloning a customer it becomes a separate entity

#

and attaching a PM to that customer doesn't result in it being propagated across accounts

pale elk
#

Hmm..Okay, Let us first try cloning platform customer into connect account and see what happens

hoary flume
#

ok sure

pale elk
#

Hey @hoary flume After setup intent, How can we set that payment method as default for that customer ?

Do we have to pass any flag or value while creating setup intent ?

hoary flume
#

or for one-off payments? the "Default" tag on the dashboard?

pale elk
#

no, In the customer object there is an parameter called invoice_settinngs, Under that param there is default_payment_method

hoary flume
#

this is only for billing

pale elk
#

Ahh, so which param from customer object i should use to check if the customer have default payment method set or not ?

hoary flume
#

if you want to update the invoice_settings.default_payment_method, you can listen to the setup_intent.succeeded event

#

and update your customer with the payment method value from the setup intent

pale elk
#

So after updating invoice_settings.default_payment_method

Stripe will allow to clone customer into connect account right ?

hoary flume
#

you don't need a Payment Method to clone a customer

pale elk
#

But stripe is throwing error for the same

#

When we clone platform customer into connect account

#

let me share you error message

boreal hill
#

@hoary flume ?

hoary flume
#

would you mind copying the request ID? it's req_xxx

pale elk
#

yeah, Just a moment

#

req_43eHYhHPDOyTSU

#

@hoary flume Did you find anything ?

hoary flume
#

please be patient will be with you shortly

high cedarBOT
tiny cape
#

Why are you using the /tokens endpoint? That won't work with Payment Methods

#

Is what you need

pale elk
#

But for clone payment method, First we need a payment method which is not possible for indian cards

tiny cape
#

How is that not possible? You use a Setup Intent, which generates a pm_xxx object, like we talked about

boreal hill
#

First we create setup intent and then we use that's client secret key and launch paymentsheet at that time we have no any payment method right?

#

Then we will fill the card detail and click on setup.

#

Here problem is like setup success but we not get any detail in paymentsheet callback.

#

We only get this flags

tiny cape
pale elk
#

Can you suggest us, where we have to use that pm_xxx ? Because event will call and specific end point which will be our backend api url

Backend will receive pm_xxx but how we will create payment intent which is requested by specific customer for specific connect account for specific purchase

Or you are saying that webhook will be used in android SDK ?

tiny cape
#

As you can see in that code, you need the ID of the Payment Method created by the Setup Intent on the platform in order the clone it

boreal hill
#

@tiny cape And @pale elk We are using paymentsheet so are not able to track webhook callback in android sdk.

tiny cape
#

Correct, you're not. You'd need a backend server for that

#

But you'll likely have one anyway to facilitate API requests

#

I've shared the documentation for you to follow and given you some pointers. I'd recommend stepping away for now and trying to implement our recommendations

#

We've been chatting for almost 3 hours at this point

boreal hill
#

I have another question.

#

I have one customer he has already added one payment method and it's default.

tiny cape
#

I'd prefer if you stepped away to make the changes we've talked about, and then returned with any follow-up questions

#

We can't continue to help you right now

boreal hill
#

So why i do not get that card here as saved card?

pale elk
#

@tiny cape Let us focus on the main point, we are stuck at a point where we can't go further or can't go back

We really need your help

tiny cape
#

Have you tried anything I've advised above?

#

Until you do that we can't help any further

pale elk
#

But the problem i am having with payment method is when we create setup intent and process further steps, You said it will trigger an event on webhook right, That webhook will call server api end point

So how this is helpfull when app request for payment intent creation ? At that time they don't have payment method but the server have it at some other end point

tiny cape
#

Did you read the message? There's an endpoint you can use to retrieve the pm_xxx IDs in order for you to clone it