#sandip5831
1 messages · Page 1 of 1 (latest)
How we attach default payment method before create payment intent API?
You'd use a Setup Intent: https://stripe.com/docs/payments/save-and-reuse?platform=web&ui=elements
How we know that customer have default payment method?
This field: How we know that customer have default payment method?
Is it possible to fetch card before create stripe intent?
I don't understand the question
1.] How we attach default payment method before create payment intent API?
-> We use create payment intent api
How are you creating the Payment Method objects though?
And using client secret key we launch paymentsheet
How do you expect to save the Payment Method before creating the Payment Intent? Anyway, you should use the setup_future_usage param to save during the payment: https://stripe.com/docs/payments/save-during-payment?platform=android&ui=payment-sheet
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
Did you read the last doc I sent? You're likely just missing the setup_future_usage param from your Payment Intent creation
Yes, we have already set that param in API.
Can you share a pi_xxx ID?
Checking
Yup
You need to create a Customer object and pass it via the customer parameter whern you create the PI: https://stripe.com/docs/payments/save-during-payment?platform=android&ui=payment-sheet#add-server-endpoint:~:text=A Customer. To,customer’s account later.
You aren't doing that here: https://dashboard.stripe.com/test/logs/req_6vf4EEMI9V3GYG
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
We are creating the customer into connect account that's why is not create customer object in above payment intent?
I guess so yep
So, what your suggestion for us about that flow? How we will implement?
You get my flow right?
You need to create a Customer object on the account where you're creating the PI
@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
I'm going to close your thread @pale elk . Let's all chat here
Yeah sure!!
We do not want to create new customer every time when creating payment intent
Sure seems reasonable. You'd persist thecus_xxxID that maps with a specific customer in your own database or similar
Yes, we have our own database where we have stored main platform customerID
I'd recommend look at this guide: https://stripe.com/docs/payments/payment-methods/connect
The idea for standard platforms, like yourself, is:
- Create an initial Customer object at the platform level.
- Collect their payment details via a Setup Intent and save the PM to that Customer.
- You can then clone that Customer, and the attached PMs, to your connected accounts.
Yes exactly
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
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
Sure, sounds reasonable
@tiny cape So we want to ask you that if this flow will work or not ? That's our first question
As I said, yes I believe it will work if your intention is to clone a Customer without a PM
👋 taking over for my colleague. Let me know if there's any follow-up Qs I can answer!
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
While implementing above flow in our existing code
I have another question about cards
sure
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
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
Hmm..Okay, Let us first try cloning platform customer into connect account and see what happens
ok sure
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 ?
when you say default for that customer are we talking about billing?
or for one-off payments? the "Default" tag on the dashboard?
no, In the customer object there is an parameter called invoice_settinngs, Under that param there is default_payment_method
this is only for billing
Ahh, so which param from customer object i should use to check if the customer have default payment method set or not ?
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
So after updating invoice_settings.default_payment_method
Stripe will allow to clone customer into connect account right ?
you don't need a Payment Method to clone a customer
But stripe is throwing error for the same
When we clone platform customer into connect account
let me share you error message
@hoary flume ?
would you mind copying the request ID? it's req_xxx
please be patient will be with you shortly
Why are you using the /tokens endpoint? That won't work with Payment Methods
Is what you need
But for clone payment method, First we need a payment method which is not possible for indian cards
How is that not possible? You use a Setup Intent, which generates a pm_xxx object, like we talked about
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
Correct, you'd like want a webhook that listens for setup_intent.succeeded events which will contain the pm_xxx ID: https://stripe.com/docs/api/setup_intents/object#setup_intent_object-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.
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 ?
The issue stems from this API request: https://dashboard.stripe.com/test/logs/req_43eHYhHPDOyTSU
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
This is just wrong, you don't use /tokens when you're integrating with Payment Methods. What you need to do is this: https://stripe.com/docs/payments/payment-methods/connect#cloning-payment-methods
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
You can either get that:
- Via the API: https://stripe.com/docs/api/payment_methods/customer
- Via a webhook endpoint
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
@tiny cape And @pale elk We are using paymentsheet so are not able to track webhook callback in android sdk.
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
I have another question.
I have one customer he has already added one payment method and it's default.
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
So why i do not get that card here as saved card?
@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
Have you tried anything I've advised above?
Until you do that we can't help any further
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
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