admin管理员组文章数量:1410674
Trying to used managed accounts for payouts. Basically a user is charged and the money is sent to the managed account instead of the platform account. I am using "sharing customers" I am using the code at the bottom of this link . After retrieving the token I try to do a single charge I get an error saying "Card information not found", but I am passing the cardId when creating the token
Error: 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);
});
});
Trying to used managed accounts for payouts. Basically a user is charged and the money is sent to the managed account instead of the platform account. I am using "sharing customers" I am using the code at the bottom of this link https://stripe./docs/connect/shared-customers. After retrieving the token I try to do a single charge I get an error saying "Card information not found", but I am passing the cardId when creating the token
Error: 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);
});
});
Share
Improve this question
asked Sep 11, 2016 at 0:24
anonymousanonymous
3711 gold badge3 silver badges12 bronze badges
1 Answer
Reset to default 7Does this work for you? The key differences here are
I'm including
{ stripe_account: 'acct_xyz' }
on thestripe.charges.create
request as well as this needs to happen on the connected account itself if using Shared Customers. https://stripe./docs/connect/payments-fees#charging-directlyInstead of
token
assource
I'm using only theid
attribute of the token object (e.g.tok_xxxyyyzzz
).
Sample:
// 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);
});
});
Alternatively, as you said you're using Managed Accounts, you might want to consider charging through the Platform, which allows you to avoid the Shared Customers flow altogether, see here for a sample, https://stripe./docs/connect/payments-fees#charging-through-the-platform
本文标签: javascriptGetting error when I try to payout to managed accountStack Overflow
版权声明:本文标题:javascript - Getting error when I try to payout to managed account - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744994837a2636608.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论