2

I'm working with Laravel and Stripe, and I want to create a customer via code. Still, I can't do it cause the payment method fails. Stripe puts the default card, and I want to create it before the payment method. I'm working with Omnipay, so I can't get the card number and other properties from my card. It's necessary to create my payment method to assign it to my customer. The card element doesn't permit me to get that information. How can I get the information from my card to register a specific payment method and create my customer after that?

$metodopago = \Stripe\PaymentMethod::create([
    'type' => 'card',
    'card' => [
        'number' => 4242424242424242,
        'exp_month' => 8,
        'exp_year' => 2022,
        'cvc' => '314',
    ],
]);

I want to get this information from my card element.

'number' => ?,
'exp_month' => ?,
'exp_year' => ?,
'cvc' => ?,

When I get my payment method only need 'ID' to payment_method.

$customer = \Stripe\Customer::create([
    'name' => '',
    'email' => '',
    'payment_method' => 'pm_card_visa',
    'invoice_settings' => [
        'default_payment_method' => 'pm_card_visa',
    ],
]);
Karl Hill
  • 12,937
  • 5
  • 58
  • 95

0 Answers0