I am trying to setup Stripe Connect and need to
This works fine as long as the buyer and seller are not the owners of the Stripe Connect Platform.
I.e. let's assume the following email corresponds to the account holder:
admin@admin.com
Now, we have two sellers:
seller_1@sellers.com
admin@admin.com
And we have one buyer:
buyer_1@buyers.com
My code works when buyer_1
buys from seller_1
. All goes fine and an application fee is charged.
The problem however arises when buyer_1
wants to buy from admin@admin.com
.
Eventhough admin@admin.com
is connected to the account platform (I go through the same process as for seller_1
), I keep getting the error:
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"
I use the following tutorial to save a customer and charge customers:
// 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
}
);
The answer was to simply change the customer id as the customer and the card is as source.
You can find the complete source code of a working example Stripe Connect with Ionic here: