php - Stripe 与 Auth 和 Capture 连接,在 PHP 中检索 Charge
问题描述
我正在使用 auth 和 Capture 实现 Stripe Connect,到目前为止我已经成功了,但是当我尝试捕获经过身份验证的数量时,我无法这样做。因为条纹不允许我们将多个参数传递给Stripe:: Retrieve函数,但它可以处理我开发的 curl 请求。如下。
curl https://api.stripe.com/v1/charges/ch_1CfTe5Dye6RVcYtHp*****/capture \
-u sk_test_C5uYX8juNRT9kTj******: \
-d application_fee=1000 \
-H "Stripe-Account: acct_1CNbqaDy*****" \
-X POST
这工作正常,但是当我尝试做同样的事情时,它给我一个未知参数的错误,我可以理解 bcoz Stripe:: Retrieve does not accept extra parameter 我试图在 PHP 中这样做
$stripe = array(
"secret_key" => "sk_test_C5uYX8juNRT9k********",
"publishable_key" => "pk_test_b2gp9tSHK9iP******"
);
$keystripe = \Stripe\Stripe::setApiKey($stripe['secret_key']);
$res = \Stripe\Charge::retrieve(array(
"id" =>"ch_1CfTe5Dye6RVcYtHp********",
"application_fee" => 1000),
array("stripe_account" => "acct_1CNbqaDy*****"));
$re = $res->capture();
有人可以建议我如何在 PHP 中存档吗?
解决方案
我找到了这样的解决方案。
$keystripe = \Stripe\Stripe::setApiKey('sk_test_C5uYX8juNRT9kTj9wj******');
$res = \Stripe\Charge::retrieve('ch_1CjkyXDye6RVcYt******', ["stripe_account" => "acct_xxx"]);
$re = $res->capture(["application_fee" =>1000]);
通过使用这个我解决了我的问题
推荐阅读
- string - 如何在特定字符之后和之前删除字符串
- python - 关于矩阵对角化的 Python 例程
- php - 正则表达式 - 排除带有单词的行(php)
- python - ValueError:没有为任何变量提供梯度 - Tensorflow 2.0/Keras
- eclipse - 为 Maven Web 项目启动 Tomcat 服务器的问题
- java - 在 Java 中重载和覆盖静态和非静态方法
- ios - 更新 SCNNode 镜像
- react-native - 'expo-splash-screen-command'命令后的expo裸应用程序崩溃
- php - Laravel 数据库查询读取不使用 get
- sql - 信息架构中的 referential_constraints.unique_constraint_* 列的 NULL 值