次のように 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`
}
);
ソースは、Stripe ネイティブチェックアウト ハンドラを使用して取得できます。
しかし、マーケットプレイスを持っていて、作成者が異なる複数のアイテムのチェックアウトを実行したい場合、どのように進めればよいでしょうか?
問題は、1 つのソースから複数の料金を作成する必要があることです。しかし、合計金額 (stripeToken ソースを取得するときに使用される) が (個々のアイテムの) 個々の金額と一致しないため、システムはエラーがあると見なします。