How to Create Stripe PaymentIntent in PHP Codeigniter

774 views Asked by At

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}}',
  ]);
1

There are 1 answers

2
CaPs LoCk On BEST ANSWER

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