Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

JakeB's avatar
Level 1

Is necessary to store the token in DB?

Im studing about stripe and im with a doubt. When the form is submited, by a user with a session initiate, the credit card info is received by stripe and then stripe returns a token right? That token is necessary/is better to store in a database or it can be directly used to charge the card?

0 likes
3 replies
ejdelmonico's avatar
Level 53

I believe it is a one-time token to charge the credit card with. Stripe verifies the card and sends back the token for the transaction. I only save the stripe_id and provider_id for the user from the transaction. If it's a subscription, you will also have a stripe_id from that as well. You can call those columns whatever you want. I would read over the docs because they are very thorough and include examples.

1 like
martinbean's avatar

@JakeB No. You use the token to charge the card. The token is single-use only, so shouldn’t be stored.

1 like

Please or to participate in this conversation.