调用Stripe PaymentIntent的search()方法报错:未定义该方法
解决Stripe PaymentIntents search()方法未定义错误
错误信息:
call to undefined method stripe\paymentintent::search()
参考Stripe官方PHP版Payment Intents搜索API文档编写的代码:$stripe = new \Stripe\StripeClient('sk_test_51KgTvKAFnFm5ESP8EPiYuUOkkuXT2SXWKa6kRcmLRIn14Q2QllFSibG6VLyejUNnigCagqttfLfrjvcFZTmZtuY000kcoaH4tS'); $stripe->paymentIntents->search(['query' => 'status:\'succeeded\' AND metadata[\'order_id\']:\'6735\'',]);
- 问题根源:你当前使用的Stripe PHP SDK版本过低,
search()方法是Stripe API后续新增的功能,旧版本SDK未实现该方法。 - 修复步骤:
- 通过Composer升级SDK到最新稳定版,执行命令:
composer update stripe/stripe-php - 升级完成后重新运行代码,你的代码逻辑本身符合官方文档要求,无需修改。
- 通过Composer升级SDK到最新稳定版,执行命令:
内容的提问来源于stack exchange,提问作者sridharnetha
相关产品推荐
相关产品推荐

