#paly-payment-method

1 messages · Page 1 of 1 (latest)

jade shuttle
#

Hi there 👋 when you say "card_id", are you referring to an object where it's id has a value of card_XXX?

fervent dirge
#

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:

  1. Create a card
  2. Create a payment method using this card
  3. Link payment method to the customer
#

You can checkout req_bXTa89svqGFLHe

jade shuttle
#

How are you creating those cards currently, as Sources?

fervent dirge
jade shuttle
#

Can you share one of the card IDs? I believe that approach already creates Payment Methods.

fervent dirge
#

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

jade shuttle
#

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.

fervent dirge
#

Yes, I was trying with curl request on a test account

#

so How can I create a payment method using card element widget?

jade shuttle
fervent dirge
#

Got it. Laat thing. How can I get the default payment method for a customer

#

Will it be available in list of payment method?

jade shuttle
fervent dirge
#

Got it. Thanks

jade shuttle
#

Any time!

fervent dirge
#

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

jade shuttle
#

I wouldn't, Sources are legacy at this point and new integrations shouldn't leverage them.

fervent dirge
#

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

jade shuttle
#

The guide linked previously walks through that process, is there a particular part of it that is giving you troubles?

fervent dirge
#

Ok let me explain

  1. I need to add the card to a customer
  2. 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

jade shuttle
#

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.

fervent dirge
#

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?

jade shuttle
#

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"?

fervent dirge
#

Understood. So I need to create a Setup Intent. But to create a Setup Intent I need to attach with the payment method. right?

jade shuttle
#

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.

fervent dirge
#

ok but to get it. Let me go step by step

  1. Customer needs a widget just to enter their card information - I am using react native card element

  2. 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

jade shuttle
#

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.

fervent dirge
#

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"

wooden quest
#

Hello 👋
Taking over here
Give me a moment to catch up, thanks 🙂

fervent dirge
#

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

wooden quest
#

yes the code above once confirmed, should do the trick

fervent dirge
#

It will fetch the card detail from the session or CardField widget. correct?

wooden quest
#

yes