ano*_*ous 6 javascript stripe-payments stripe-connect
尝试使用托管帐户进行付款.基本上,用户需要付费,并且钱将被发送到管理帐户而不是平台帐户.我正在使用"共享客户"我正在使用此链接底部的代码https://stripe.com/docs/connect/shared-customers.检索令牌后,我尝试一次充电,我收到一条错误,说"找不到卡信息",但我在创建令牌时传递了cardId
错误: message: "Could not find payment information"
Stripe.tokens.create(
{ customer: request.params.customerId, card: request.params.cardId },
{ stripe_account: 'acct_xyz' }, // id of the connected account
function(err, token) {
Stripe.charges.create(
{
amount: 1000, // amount in cents
currency: "usd",
source: token,
description: "Example charge",
application_fee: 123 // amount in cents
},
function(err, charge) {
console.log(err);
});
});
Run Code Online (Sandbox Code Playgroud)
这对你有用吗?这里的主要区别是
如果使用共享客户,我会{ stripe_account: 'acct_xyz' }在stripe.charges.create请求中包括这个需要在连接帐户上发生的事情.https://stripe.com/docs/connect/payments-fees#charging-directly
而不是token因为source我只使用id令牌对象的属性(例如tok_xxxyyyzzz).
样品:
// id of connected account you want to create customer on, charge
var connectedAccountId = "acct_16MNx0I5dd9AuSl3";
// id of customer and card you want to create a token from
var platformCustomerId = "cus_8vEdBa4rQTGond";
var platformCustomerCardId = "card_18dOAcFwTuOiiF4uwtDe2Nip";
var stripe = require("stripe")(
"sk_test_xxxyyyyzzz"
);
// create a token using a customer and card on the Platform account
stripe.tokens.create(
{customer: platformCustomerId, card: platformCustomerCardId },
{stripe_account: connectedAccountId},
function(err, token) {
if (err)
throw (err);
stripe.charges.create({
amount: 4444,
currency: "usd",
source: token.id,
description: "Charge on a connected account",
application_fee: 1111
},
{stripe_account: connectedAccountId},
function(err, charge) {
if (err)
throw (err);
console.log(charge);
});
});
Run Code Online (Sandbox Code Playgroud)
或者,如您所说,您正在使用托管帐户,您可能需要考虑通过平台进行收费,这样您就可以完全避免共享客户流,请参阅此处获取示例,https://stripe.com/docs/connect /支付,费用#充电,直通平台
| 归档时间: |
|
| 查看次数: |
2162 次 |
| 最近记录: |