Joh*_*ews 4 node.js stripe-payments stripe-connect
我们可以使用 NodeJS 中的 Stripe connect 创建付款并收取 application_fee,如下所示:
// Get the credit card details submitted by the form
var token = request.body.stripeToken;
// Create the charge on Stripe's servers - this will charge the user's card
stripe.charges.create(
{
amount: 1000, // amount in cents
currency: "eur",
source: token,
description: "Example charge",
application_fee: 123 // amount in cents
},
{stripe_account: CONNECTED_STRIPE_ACCOUNT_ID},
function(err, charge) {
// check for `err`
// do something with `charge`
}
);
Run Code Online (Sandbox Code Playgroud)
可以使用 Stripe 本机结帐处理程序获取源代码。
但是,如果我有一个市场并且我想要对具有不同作者的多个项目进行结帐,那么我将如何进行?
问题是我需要从一个来源创建多个费用。但随后系统会认为存在错误,因为总金额(在检索 stripeToken 源时使用)与(单个项目的)单个金额不匹配。
如果有人仍然遇到这个问题,看起来 Stripe 现在有一个transfer_group可以放置在PaymentIntent. 这transfer_group是您想出的一些字符串,可以将其附加到多个传输中。
在这里阅读更多相关信息:https ://stripe.com/docs/connect/charges-transfers
您可以看到在示例中,同一个 发生了多次传输PaymentIntent。
| 归档时间: |
|
| 查看次数: |
3737 次 |
| 最近记录: |