Home > Enterprise >  How to Create Stripe PaymentIntent in PHP Codeigniter
How to Create Stripe PaymentIntent in PHP Codeigniter

Time:04-11

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

CodePudding user response:

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

  • Related