0

I'm trying to register a user payment info by directly using fetch to Stripe's API (since it's a React Native app, I can't use Stripe Elements). It follows the usual concept: a user registers his credit card, which is then associated to his account so he can make payments in the app.

I tried to approach this problem by creating a credit card token with the info that the user provides on signup, but I've realized that that token is only worth for one payment, or for associating to a customer.

Meanwhile I saw that Sources are maybe what I need in my app, since we can get back to it and charge it multiple times. However, from what I see in the API docs there's no reference to the credit card info when creating the source.

What do I need to create to be able to do this (registering a card to be used several times) only through the API?

flapas
  • 583
  • 1
  • 11
  • 25
  • I don't have experience with native development, but you probable should look into Stripe Customers API. BTW, qoute from Sources doc: token optional An optional token used to create the source. When passed, token properties will override source parameters. – Evgenii Malikov Jul 18 '19 at 16:13
  • Yes, you're right! Thanks – flapas Jul 18 '19 at 17:35

2 Answers2

1

By creating a token previously, you can then use it as an argument to the creation of the source. Then, the token properties will override source parameters. Thanks to @Evgenii Malikov for the tip.

flapas
  • 583
  • 1
  • 11
  • 25
0

You need to create a token of your card previously. For that, you can use tipsi-stripe package. Perfect package if you want to implement credit card, apple / google pay.

Simon Robert
  • 111
  • 5