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

rubenochoa's avatar

Collect card information

Days, months and hours I am trying to figure out how can I use according to stripe documentation(https://stripe.com/docs/js/tokens_sources/create_source_data) the collecting of name card when i see at payments, the information of a payment at my account. As you can see at https://imgur.com/rUkMRMv & https://imgur.com/hu2HCK4 .

stripe
  .createSource({
    type: 'ideal',
    amount: 1099,
    currency: 'eur',
    owner: {
      name: 'Jenny Rosen',
    },
    redirect: {
      return_url: 'https://shop.example.com/crtA6B28E1',
    },
  })
  .then(function(result) {
    // Handle result.error or result.source
  });

At view

<div class="row">
                        <div class="col-md-12 mb-3">
                            <label for="card-name">Cart Name</label>
                            <input type="text" id="card_name" class="form-control" required>
                            <label for="firstName">Enter Card Details</label>
                            <div id="card-element">
                                <!-- A Stripe Element will be inserted here. -->
                            </div>
                        </div>
                    </div>

ProductController

$charge = \Stripe\Charge::create([
                    'amount' => $cart->totalPrice * 100,                    
                    'currency' => 'usd',
                    'description' => Carbon::now().' '.$request->input('card-name'),
                    'source' => "tok_mastercard",
                ]); 

Thank you!

0 likes
1 reply
rubenochoa's avatar
rubenochoa
OP
Best Answer
Level 2

This problem solved by creating order migration during $charge = \Stripe\Charge::create([ function

Please or to participate in this conversation.