#paly-payment-method
1 messages · Page 1 of 1 (latest)
Hi there 👋 when you say "card_id", are you referring to an object where it's id has a value of card_XXX?
yes
I need to show a card widget where user can add their card but after that I need to have a payment method for creating subscription (future payment)
Steps:
- Create a card
- Create a payment method using this card
- Link payment method to the customer
You can checkout req_bXTa89svqGFLHe
How are you creating those cards currently, as Sources?
I am using UI widget for react native
https://stripe.com/docs/payments/accept-card-payments?platform=react-native&ui=custom
Can you share one of the card IDs? I believe that approach already creates Payment Methods.
card_1LADC3EdiiuN6A9dSoUMTf17
I can see the card_id under this cus_LpJwckdVjXmwxA
but payment method should starts with pm_ correct?
because In future I need to create a subscritption
So that looks like it was created as a source, as you can see the request to create it was made to a sources endpoint, and did not come from a React Native flow:
https://dashboard.stripe.com/test/logs/req_df6pGkvj1t76Br
Sources are the predecessor to Payment Methods, and you don't create a Payment Method from a Source, instead you create a Payment Method from the beginning.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Yes, I was trying with curl request on a test account
so How can I create a payment method using card element widget?
This is our guide that walks through using the Card Element to collect payment details and create a Payment Method that can be used later:
https://stripe.com/docs/payments/save-and-reuse-cards-only?platform=react-native
Got it. Laat thing. How can I get the default payment method for a customer
Will it be available in list of payment method?
The ID of the a customer's default payment method lives on the Customer object, in the invoice_settings.default_payment_method field:
https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_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.
Got it. Thanks
Any time!
I have one last question:
How can I create a token (source) from card UI widget?
or generate a token so that I can pass that token to a stripe API
I wouldn't, Sources are legacy at this point and new integrations shouldn't leverage them.
So how can I add a card to a customer (sorry back to the basic question now)
I am using react native stripe cardUI element
The guide linked previously walks through that process, is there a particular part of it that is giving you troubles?
Ok let me explain
- I need to add the card to a customer
- I want to do it to make a future payment
But When I am seeing the information that stripe card elements provides me is just the minimal info of card. But to call the create card API I need full information of card
You'll notice that flow doesn't directly call a method to create a Payment Method, because it doesn't need to. The purpose of a Setup Intent is to create and prepare a Payment Method for use in the future.
The Setup Intents API lets you save a customer’s card without an initial payment. This is helpful if you want to onboard customers now, set them up for payments, and charge them in the future—when they’re offline.
Use this integration to set up recurring payments or to create one-time payments with a final amount determined later, often after the customer receives your service.
That means I need to create a payment intent and that payment intent will save the card information to the customer dashboard as well?
correct?
You will need to create a Setup Intent, as explained in the guide I provided (a Payment Intent would be used to process a payment).
Can you clarify what you're referring to when you say "customer dashboard"?
Understood. So I need to create a Setup Intent. But to create a Setup Intent I need to attach with the payment method. right?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
No, as shown in the spec, that is an optional field:
https://stripe.com/docs/api/setup_intents/create#create_setup_intent-payment_method
Please review the guide that I provided. It walks through how to do exactly what you asked for (collecting payment details, creating a payment method from them, and setting that payment method up for future use, in react native, using the card element) step-by-step.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ok but to get it. Let me go step by step
-
Customer needs a widget just to enter their card information - I am using react native card element
-
Now I need to create setup intent but to create a setup intent I need a payment method.
But to create a payment method / card I nee to have a card information. so that I can make a request to payment method API
I am stuck at 3rd point
No, you do not need a Payment Method to create a Setup Intent. Notice that in Step 3, when creating a Setup Intent, the provided code snippets do not show a Payment Method being provided during the Setup Intent creation request:
https://stripe.com/docs/payments/save-and-reuse-cards-only?platform=react-native#react-native-create-setup-intent
Your server creates the Setup Intent, the Card Element collects payment method details, and the request to confirm the Setup Intent pulls information from the element to create a Payment Method.
Thanks and this following portion of the code will add card to the customer
const { setupIntent, error } = await confirmSetupIntent(clientSecret, {
paymentMethodType: 'Card',
paymentMethodData: {
billingDetails,
}
});
"confirmSetupIntent"
Hello 👋
Taking over here
Give me a moment to catch up, thanks 🙂
Hello Hanzo..Could You helo me out in setup intent
basically I have client secret key for a setup intent now I need to add the card to the customer
yes the code above once confirmed, should do the trick
It will fetch the card detail from the session or CardField widget. correct?
yes