php - Stripe 没有显示这样的令牌:tok_xxxxxxx 用于目的地费用
问题描述
我正在尝试创建从我的客户到其中一个连接帐户的目的地费用。
\Stripe\Stripe::setApiKey(STRIPE_SECRET_KEY); //Origin Stripe Secret Key
try {
$connectd_account_id = 'acct_XXXXXXX';
$customer_id = 'cus_XXXXXXX'
// sharing my customer with connected account and creating a token.
$token = \Stripe\Token::create(
["customer" => $customer_id], //doctor stripe customer id
["stripe_account" => $connectd_account_id]); //Lab Stripe Account
// I am receiving response ** No such token: tok_xxxxxxx **
$charge = \Stripe\Charge::create(array(
"amount" => 10000,
"currency" => 'USD',
"source" => $token->id,
"application_fee_amount" => 2000,
"transfer_data" => [
"destination" => $connectd_account_id,
],
)
);
} catch (Exception $e) {
$error = $e->getMessage();
}
每次我收到 没有这样的令牌:tok_xxxxxxx 我在这里找不到什么错误。请帮忙。
解决方案
如果您正在创建目的地费用,则应在您的平台帐户上创建卡令牌和客户及相关对象。您的平台账户是与持卡人交互并处理付款的平台账户,然后在 Stripe 内将资金转移到目标账户。
您的代码似乎试图将保存的卡详细信息从您的平台复制到目标帐户,这不是您对目标费用所做的(只有在您使用直接费用时,您才会这样做,付款在关联帐户,因此需要在那里复制付款信息)。
简而言之,您应该省略创建令牌的代码,而是在创建收费时,传递类似"source" => $customer_id,
在您的平台上向客户详细信息收费的内容。
推荐阅读
- python-3.x - 第一次尝试在folium中使用等值线图,索引错误
- node.js - 从 github 获取此代码,尝试运行它并抛出此错误,据我所知,错误在 index.js 中,我在此处提供了 index.js 代码
- c++ - Cmake编译器未知
- javascript - Discord.js 机器人在尝试发送命令后崩溃
- database - 功能依赖,这是正确的问题吗
- php - 打开购物车一个博客页面“模板”自动出现在网页视图中(主题广场)
- python - 烧瓶闪烁的消息未显示
- typescript - 如何在 Jest 和 TypeScript 中测试 Azure HTTP 触发功能?
- docker - 如何使用 docker 设置 maildev 电子邮件持久存储
- reactjs - React 使用内联函数给出 301 错误,但内联匿名函数没有