php - 可以从 strip 标准中检索付款意图吗?

标签 php stripe-payments

我正在使用Stripe standard connection我可以连接用户并创建付款意图作为直接收费,如下所示:

$payment = PaymentIntent::create([
    'amount'   => $amount,
    'currency' => 'usd',
    //'application_fee_amount' => 123,
], [
   'stripe_account' => $stripe_user_id,
]);

我在后端保存了 $ payment->id$ payment->client_secret 这是我需要支付和退款的内容,但我需要检索此付款,当我这样做时,Stripe 给出了此错误: Stripe/Error/InvalidRequest with message 'No such payment_intent: pi_asdjaiudaisda

我正在这样检索付款:

PaymentIntent::retrieve($payment->id);

就像文档所说的那样,但看起来不起作用。

最佳答案

就像您在创建 PaymentIntent 时通过传递 'stripe_account' => $stripe_user_id, 来“代表 Stripe Connect 帐户发出 API 请求”一样

检索 PaymentIntent 时也需要执行相同的操作。

原因是此 PaymentIntent 存在于 Connect 帐户上(因为它是在 Connect 帐户中创建的),因此您必须使用 stripe_account 参数代表 Connect 帐户进行检索/更新 API 调用才能访问PaymentIntent。

https://stripe.com/docs/connect/authentication#stripe-account-header

关于php - 可以从 strip 标准中检索付款意图吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61680872/

相关文章:

javascript - 购买成功后 react 推送查看

javascript - Stripe 安全问题

stripe-payments - Stripe 上的 "No such payment intent: (null)"

javascript - Stripe形式不会创建任何信用卡

javascript - php 重定向包括增加

php - 通过比较日期时间查询以检查预订可用性

php - 在 MySql 数据库中存储表情符号。显示???在 phpmyadmin 中

php - 如何获取标签后的文字

php - 如何用PHP和Flex实现虚拟文件系统?

javascript - Stripe 发票项目并不总是在一张发票中一起发送