我正在关注this documentation.
我在Dasboard中连接了一个帐户(我不知道为什么它在测试模式下没有显示,只有在直播中,但它已经链接了)。
我有以下代码:
require 'vendor/autoload.php';
// Set your secret key: remember to change this to your live secret key in production
// See your keys here: https://dashboard.stripe.com/account/apikeys
\Stripe\Stripe::setApiKey("sk_test_51IfutCF5fAR5qVOD8Eo6D7eQ2pR3TCme8f3q4Co9Ujy9Yj1yzB0lYHcqj1AwFvxLMGMopj22GQKhPU4sZbGr2zVN00bodgyzhI");
// Create a Charge:
$charge = \Stripe\Charge::create(array(
"amount" => 10000,
"currency" => "mxn",
"source" => "tok_visa",
"transfer_group" => "{ORDER10}",
));
// Create a Transfer to a connected account (later):
$transfer = \Stripe\Transfer::create(array(
"amount" => 7000,
"currency" => "mxn",
"destination" => "{sk_test_51IfutCF5fAR5qVOD8Eo6D7eQ2pR3TCme8f3q4Co9Ujy9Yj1yzB0lYHcqj1AwFvxLMGMopj22GQKhPU4sZbGr2zVN00bodgyzhI}",
"transfer_group" => "{ORDER10}",
));
// Create a second Transfer to another connected account (later):
$transfer = \Stripe\Transfer::create(array(
"amount" => 2000,
"currency" => "mxn",
"destination" => "{sk_test_51IfvmAD8agxnza281bhgKir2oXWNz69BhX8lKllHIUhLvpwecxRtfDlVG7t80RBfKL8BIPCJKMErjnuXmbLSoqNN00v4JoDL4B}",
"transfer_group" => "{ORDER10}",
));
当我付款的时候,在第一个账户中存款是正确的,但是100%的费用通过了,没有被分割,然后我得到以下错误:
Fatal error: Uncaught (Status 400) (Request req_WZj0fSnA0RINKN) No such destination: '{sk_test_51IfutCF5fAR5qVOD8Eo6D7eQ2pR3TCme8f3q4Co9Ujy9Yj1yzB0lYHcqj1AwFvxLMGMopj22GQKhPU4sZbGr2zVN00bodgyzhI}' thrown in /opt/lampp/htdocs/stripe-conect/vendor/stripe/stripe-php/lib/Exception/ApiErrorException.php on line 38
我做错了什么?
答案 0 :(得分:0)
destination
字段采用 acct_123
形式的已连接帐户的 Stripe account ID。您传入了一个秘密测试 API 密钥,该密钥不起作用。
您需要立即滚动测试模式密钥,因为它们现在已被泄露。