Dani Banai
Dani Banai

Reputation: 1140

laravel cashier - save creditcard last 4 number and expire date

I'm using laravel 5.2 with cashier package this is the form that i'm using in order to get the client creditcard token:

<form action="/your-server-side-code" method="POST">
  <script
    src="https://checkout.stripe.com/checkout.js" class="stripe-button"
    data-key="test_token"
    data-amount="999"
    data-name="Demo Site"
    data-description="Widget"
    data-image="https://stripe.com/img/documentation/checkout/marketplace.png"
    data-locale="auto">
  </script>
</form>

after it the form is submitted automatically And i get the regular answer from the server that contain the client token.

How i can save the credit-card last 4 number and expire date that the user enter? I Know that i don't need it for credit card transactions. i just want to save it in order to show it to my customer which card thy entered.

Thank!

Upvotes: 2

Views: 1598

Answers (1)

Tom
Tom

Reputation: 1068

I don't believe you need it.

If you look at Laravel's Cashier documentation, you just pass a credit card token when creating a new subscription:

$user->newSubscription('main', 'monthly')->create($creditCardToken);

So you don't need the last 4 digits or expiry date, just the token (which you already have).

Upvotes: 1

Related Questions