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

singh's avatar
Level 1

How to pass the credit card data stored in my db to stripe

Question - How do I store credit data in my own PCI compliant Laravel database and then pass it to stripe for processing?

Stripe provides a great integration through Laravel Cashier. But the limitation is that user has to enter their credit card info that is only partially stored in the Laravel db. Basically stripe wants to keep the control. However, as a subscription business owner I would like to have the flexibility to switch over to another payment processor in the future or build my own payment rails. At that time I don't want to have my customers re-enter the credit card info as it creates the friction and gives them an opportunity to not renew. I am aware of the PCI compliance and hacking risks.

0 likes
6 replies
bugsysha's avatar

How do I store credit data in my own PCI compliant Laravel database and then pass it to stripe for processing?

If your database is PCI compliant then you don't have to use Stripe. You should contact the bank directly and reduce the rate you are paying.

Stripe provides a great integration through Laravel Cashier.

Stripe doesn't provide any integration through Laravel Cashier. That is all work of the Laravel team.

But the limitation is that user has to enter their credit card info that is only partially stored in the Laravel db.

You only use that info to show it to the user so the user knows which card was used for your website. I would advise that you check Laravel Cashier documentation or some videos on YouTube or here on Laracasts. Those videos show you how to use Laravel Cashier to do the most common operations with Stripe.

Basically stripe wants to keep the control. However, as a subscription business owner I would like to have the flexibility to switch over to another payment processor in the future or build my own payment rails.

I would advise that you keep it simple and worry about that once you reach that point. Laravel Cashier already gives you a good starting point from which you can expand. So just keep the current database structure and expand on it when the time comes.

At that time I don't want to have my customers re-enter the credit card info as it creates the friction and gives them an opportunity to not renew.

They don't have to reenter anything. Like I said. Watch videos and you will get it. But in a nutshell, you will have Stripe customer id saved to the database and that is used to communicate with Stripe API through Laravel Cashier.

I am aware of the PCI compliance and hacking risks.

I'm not sure you do understand based on all those small misunderstandings in your initial post. But everybody can do it so just watch those videos and give it a try.

1 like
Snapey's avatar

i'm amazed you even consider storing credit card details

What does your CISO say?

1 like
martinbean's avatar

@singh Good luck, buddy.

There’s no point in using Stripe if you’re not going to use Stripe properly.

1 like
jlrdw's avatar

@singh to add, learn how to use a payment gateway, you just can't charge payments yourself. Not saying you are, but storing card information is also not good.

Watch @jeffreyway videos and study those stripe docs. And implement good security on your site.

I know customer experience is important, but put security the highest priority always, even above customer user experience.

Please or to participate in this conversation.