28
votes

I'm working on setting up recurring payments with stripe. I'm using react-stripe-elements to collect card information and it looks like there's two ways to save a card for later:

  • this.props.stripe.createToken()
  • this.props.stripe.createSource()

Then create a customer on the backend:

  • stripe.customers.create({ source: tokenId })
  • stripe.customers.create({ source: sourceId })

The result in stripe dashboard:

  • tokenId

    • tokenId card enter image description here
  • sourceId

    • sourceId source

enter image description here

  • sourceId card

enter image description here

My question is what is the difference between these two patterns? Should I be using one instead of the other? I notice in the tokenId pattern the card says cvc/zip check passed, while the card doesn't say that in the sourceId pattern. But the sourceId pattern also explicitly says the card is chargeable and reusable, does that imply that the card saved from using the tokenId pattern is not reusable? Are the logs/events in the sourceId card more useful? The return object structure for the two patterns is also different.

Any help would be much appreciated, thanks in advance!

1

1 Answers

18
votes

Token is just a string value result after tokenization of the user card details. You can use token or source for either one time or subscription payment(provided you don't use it to charge immediately before attaching it to customer).

But source gives you more option as it is the only option you have when accept other payment option such as alipay or wechat pay etc, you cannot use token api with other payment method other than card. As @Daniel Winterstein said that token was Stripe old API and stripe decided to keep it just for backward compatibility but you should use source as the standard API to capture use payment details.