Stripe Connect をセットアップしようとしていますが、セットアップする必要があります
- 最初に顧客を作成して購入者に請求し、
- 次にトークンを生成し、最後に
- このトークンで顧客に請求します。
買い手と売り手が Stripe Connect プラットフォームの所有者でない限り、これは問題なく機能します。
つまり、次の電子メールがアカウント所有者に対応すると仮定しましょう。
admin@admin.com
現在、販売者は 2 名です。
seller_1@sellers.com
admin@admin.com
そして、私たちには1人のバイヤーがいます:
buyer_1@buyers.com
私のコードbuyer_1
は から購入すると機能しseller_1
ます。すべてうまくいき、申請料が請求されます。
buyer_1
ただし、から購入したい場合に問題が発生しadmin@admin.com
ます。はアカウントプラットフォームadmin@admin.com
に接続されていますが (の場合と同じプロセスを実行しますseller_1
)、エラーが発生し続けます。
message: "Must authenticate as a connected account to be able to use customer parameter. See https://stripe.com/docs/api#create_card_token for more details."
param: "customer"
raw: Object
rawType: "invalid_request_error"
requestId: "req_8EtIue0F4JWFmQ"
stack: 400
type: "StripeInvalidRequestError"
次のチュートリアルを使用して、顧客を保存し、顧客に請求します。
// store
// 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
var stripe = require("stripe")("SECRETKEY");
// (Assuming you're using express - expressjs.com)
// Get the credit card details submitted by the form
var tokenID = request.body.stripeToken;
// Create a Customer
stripe.customers.create({
source: tokenID,
description: "Example customer"
}, function(err, customer) {
});
// Create token
// Create a Token from the existing customer on the platform's account
stripe.tokens.create(
{ customer: CUSTOMER_ID, card: CARD_ID },
{ stripe_account: CONNECTED_STRIPE_ACCOUNT_ID }, // id of the connected account
function(err, token) {
// callback
}
);