'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 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1