phpcodeigniterstripe-payment-intent

How to Create Stripe PaymentIntent in PHP Codeigniter


Message: Call to private method Stripe\ApiResource: :_validateParams() from context 'Stripe\PaymentIntent'

require_once('application/libraries/stripe/init.php');

  \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc');

  \Stripe\PaymentIntent::create([
     'payment_method_types' => ['card'],
     'amount' => 1099,
     'currency' => 'usd',
     'customer' => '{{CUSTOMER_ID}}',
     'payment_method' => '{{CARD_ID}}',
  ]);

Solution

  • As pre stripe documents, stripe use StripeClient() to set the apikey.

    Replace

    \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc');
    

    with

    \Stripe\StripeClient("sk_test_4eC39HqLyjWDarjtT1zdp7dc");
    

    Source