#dilkw
1 messages · Page 1 of 1 (latest)
pi_3JhrxkERyqAJHa2o17NpXiE7
@fickle onyx that PaymentIntent has set customer : cus_KMbAiceVYzAI93, and the payment method pm_1JhryNERyqAJHa2odx5iX6oB. When i look in your account : https://dashboard.stripe.com/test/customers/cus_KMbAiceVYzAI93 - i can see the payment method attached to your customer
how are you pulling the payment methods for the customer in your app? are you using https://stripe.com/docs/api/payment_methods/list?
I am using the SDK internal page, and I can see through the packet capture tool that there is a request https://api.stripe.com/v1/payment_methods?type=card&customer=cus_KMbQOONcP9OLPi
I use this method paymentSession.presentPaymentMethodSelection(null); to start the card selection page
It looks like this through the Charles tool
based off your screenshot, Stripe is returning the correct data, you'll probably need to check your code to see why you're not displaying that payment method in your page
Just now I started the card selection page and requested after clicking Add card, but when I first started the card selection page, no card information was displayed.
Can you tell me that the normal process is the next step to get the card information on the card selection list page?
@fickle onyx the customer id in your screenshot is different from all the other customer ids before
can you verify if you're using the same customer id as the one you can created a card for previously?
if you attach a card to customer_A, you will only see the card previously attached if you make the request to list all payment methods for customer_A
if you're requesting for customer_B which you had not attached a card before, then you would not see any cards when you attempt to list the payment methods for customer_B
Before I start the card selection page, I will request the interface server to call createEphemeralKey to return customer_id.
alright, and then does that customer in the screenshot already have a payment method attached?
I don’t know this. I see that the customer_Id returned by createEphemeralKey is different every time.
The step of createEphemeralKey is done on the server. What parameters are needed in this step?
see that the customer_Id returned by createEphemeralKey is different every time
then you're creating a new customer(you wrote that backend code right?)
What parameters are needed in this step?
the customer ID and an API version
I didn’t write the backend code
Note that you need a customer authentication system in the backend at some point — like you need to be able to map a user of the app to a Stripe customer cus_xxx object and use that Customer in the calls for the ephemeral key when that user is using the app instead of creating new ones.
That's why the example at https://glitch.com/edit/#!/remix/stripe-mobile-payment-sheet notes that it's just a sample and creates a new customer each time, in production you need to replace that with some authentication to re-use customers
Our process:
- The server creates paymentIntent and returns client_secret.
- Start PaymentMethodActivity, which is the card selection page, request the server interface createEphemeralKey, return customer, and get the card list.
- The client creates ConfirmPaymentIntentParams according to client_secret, and then confirm().
- Notify the server to capture after confirm is complete
So, should this be a problem with the createEphemeralKey step of the backend?
what you describe sounds totally normal and correct!
Instead of recreating cus_xxx, what should I do?
Note that you need a customer authentication system in the backend at some point — like you need to be able to map a user of the app to a Stripe customer cus_xxx object and use that Customer in the calls for the ephemeral key when that user is using the app instead of creating new ones.
not sure if it helps you but you can see in this other example app we have (https://github.com/stripe/example-mobile-backend/blob/master/web.rb#L42-L70) how it uses cookies to manage a persistent customer ID for a session
Also, where should I see if the user has tied the card?
what does 'tied' mean?
It is all the cards that the user has bound.
you can see it on the dashboard for each customer (https://dashboard.stripe.com/test/customers) or in the API (https://stripe.com/docs/api/payment_methods/list)