我想创建条纹支付转移资金从我的帐户到卖方的帐户。如果卖家没有stripe帐户,我会尝试使用stripe.accouns.create创建一个帐户,然后使用stripe.accouns.createExternalAccount创建一个外部帐户,并将卖家的银行帐户连接到他的stripe帐户。现在,当我尝试创建一个条带支付的过程是失败的这个错误。
我的后台:
import Stripe from 'stripe';
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY, {
apiVersion: '2020-08-27'
});
export default async function handler(req, res) {
if (req.method === 'POST') {
try {
const { amount, recipientId, routingNumber, accountNumber,emailId } = req.body;
let recipientAccountId;
if (recipientId) {
recipientAccountId = recipientId;
} else {
// Create a Custom account for the recipient
const account = await stripe.accounts.create({
type: 'custom',
country: 'US',
email: emailId,
capabilities: {
card_payments: {requested: true},
transfers: {requested: true},
},
});
recipientAccountId = account.id;
console.log("customAccount",account)
// Add the recipient's bank account details
await stripe.accounts.createExternalAccount(recipientAccountId, {
external_account: {
object: 'bank_account',
country: 'US',
currency: 'usd',
routing_number: routingNumber,
account_number: accountNumber
}
});
}
// Create a payout to the recipient's account
const payout = await stripe.payouts.create({
amount,
currency: 'usd',
method: 'standard',
destination: recipientAccountId
});
// // //Create a session ID to pass back to the client
const sessionId = payout.id;
res.status(200).json({ sessionId });
} catch (error) {
console.error(error);
res.status(500).json({ error: 'An error occurred while initiating the payout.' });
}
} else {
res.setHeader('Allow', 'POST');
res.status(405).end('Method Not Allowed');
}
}
错误:
StripeInvalidRequestError: No such external account: 'acct_1N2Aq7GfOcRyeiYj'
at StripeError.generate (file:///C:/Users/gauth/OneDrive/Desktop/AAK/Blockchain-Dev/node_modules/stripe/esm/Error.js:7:20)
at res.toJSON.then.StripeAPIError.message (file:///C:/Users/gauth/OneDrive/Desktop/AAK/Blockchain-Dev/node_modules/stripe/esm/RequestSender.js:102:43)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
type: 'StripeInvalidRequestError',
raw: {
code: 'resource_missing',
doc_url: 'https://stripe.com/docs/error-codes/resource-missing',
message: "No such external account: 'acct_1N2Aq7GfOcRyeiYj'",
param: 'destination',
request_log_url: 'https://dashboard.stripe.com/test/logs/req_qUBEETBOLIdSqF?t=1682763438',
type: 'invalid_request_error',
headers: {
server: 'nginx',
date: 'Sat, 29 Apr 2023 10:17:18 GMT',
'content-type': 'application/json',
'content-length': '353',
connection: 'keep-alive',
'access-control-allow-credentials': 'true',
'access-control-allow-methods': 'GET, POST, HEAD, OPTIONS, DELETE',
'access-control-allow-origin': '*',
'access-control-expose-headers': 'Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required',
'access-control-max-age': '300',
'cache-control': 'no-cache, no-store',
'idempotency-key': '17e2ea5a-6362-4b3c-aabe-a7e6d2925b17',
'original-request': 'req_qUBEETBOLIdSqF',
'request-id': 'req_qUBEETBOLIdSqF',
'stripe-version': '2020-08-27',
'strict-transport-security': 'max-age=63072000; includeSubDomains; preload'
},
statusCode: 400,
requestId: 'req_qUBEETBOLIdSqF'
},
rawType: 'invalid_request_error',
code: 'resource_missing',
doc_url: 'https://stripe.com/docs/error-codes/resource-missing',
param: 'destination',
detail: undefined,
headers: {
server: 'nginx',
date: 'Sat, 29 Apr 2023 10:17:18 GMT',
'content-type': 'application/json',
'content-length': '353',
connection: 'keep-alive',
'access-control-allow-credentials': 'true',
'access-control-allow-methods': 'GET, POST, HEAD, OPTIONS, DELETE',
'access-control-allow-origin': '*',
'access-control-expose-headers': 'Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required',
'access-control-max-age': '300',
'cache-control': 'no-cache, no-store',
'idempotency-key': '17e2ea5a-6362-4b3c-aabe-a7e6d2925b17',
'original-request': 'req_qUBEETBOLIdSqF',
'request-id': 'req_qUBEETBOLIdSqF',
'stripe-version': '2020-08-27',
'strict-transport-security': 'max-age=63072000; includeSubDomains; preload' },
requestId: 'req_qUBEETBOLIdSqF',
statusCode: 400,
charge: undefined,
decline_code: undefined,
payment_intent: undefined,
payment_method: undefined,
payment_method_type: undefined,
setup_intent: undefined,
source: undefined
}
我试着控制我的帐户,得到以下结果。我想知道为什么card_payments和transfers不活动
{
id: 'acct_1N2Aq7GfOcRyeiYj',
object: 'account',
business_profile: {
mcc: null,
name: null,
product_description: null,
support_address: null,
support_email: null,
support_phone: null,
support_url: null,
url: null
},
business_type: null,
capabilities: { card_payments: 'inactive', transfers: 'inactive' },
charges_enabled: false,
country: 'US',
created: 1682763436,
default_currency: 'usd',
details_submitted: false,
email: 'gauthamvijay@rocketmail.com',
external_accounts: {
object: 'list',
data: [],
has_more: false,
total_count: 0,
url: '/v1/accounts/acct_1N2Aq7GfOcRyeiYj/external_accounts'
},
future_requirements: {
alternatives: [],
current_deadline: null,
currently_due: [],
disabled_reason: null,
errors: [],
eventually_due: [],
past_due: [],
pending_verification: []
},
metadata: {},
payouts_enabled: false,
requirements: {
alternatives: [],
current_deadline: null,
currently_due: [
'business_profile.mcc',
'business_profile.url',
'business_type',
'external_account',
'representative.first_name',
'representative.last_name',
'tos_acceptance.date',
'tos_acceptance.ip'
],
disabled_reason: 'requirements.past_due',
errors: [],
eventually_due: [
'business_profile.mcc',
'business_profile.url',
'business_type',
'external_account',
'representative.first_name',
'representative.last_name',
'tos_acceptance.date',
'tos_acceptance.ip'
],
past_due: [
'business_profile.mcc',
'business_profile.url',
'business_type',
'external_account',
'representative.first_name',
'representative.last_name',
'tos_acceptance.date',
'tos_acceptance.ip'
],
pending_verification: []
},
settings: {
bacs_debit_payments: {},
branding: {
icon: null,
logo: null,
primary_color: null,
secondary_color: null
},
card_issuing: { tos_acceptance: [Object] },
card_payments: {
decline_on: [Object],
statement_descriptor_prefix: null,
statement_descriptor_prefix_kana: null,
statement_descriptor_prefix_kanji: null
},
dashboard: { display_name: null, timezone: 'Etc/UTC' },
payments: {
statement_descriptor: null,
statement_descriptor_kana: null,
statement_descriptor_kanji: null
},
payouts: {
debit_negative_balances: false,
schedule: [Object],
statement_descriptor: null
},
sepa_debit_payments: {}
},
tos_acceptance: { date: null, ip: null, user_agent: null },
type: 'custom'
}
1条答案
按热度按时间dm7nw8vv1#
支出表示从Stripe内的Stripe账户余额转移到Stripe外的您自己的银行账户(或借记卡)的资金。
这不是你想要的,因为你正试图将资金转移到你的卖家的银行账户。为此,您首先需要将资金转入卖家的Stripe账户余额。要做到这一点,您必须创建一个转账,它表示在Stripe内的一个Stripe帐户余额与仍在Stripe内的另一个Stripe帐户余额之间移动的资金。
一旦您将资金从您的平台余额转移到卖家的账户余额,您将能够创建一个Payout,将资金从他们的余额发送到他们在Stripe之外的银行账户。
现在,这不仅仅是创建一个传输。要代表第三方卖家接受付款,您必须收集有关该卖家的详细信息,然后他们才能收到资金,例如他们的地址或出生日期。您还必须让他们接受Stripe的服务条款。
花时间阅读Stripe在其文档中提供的有关自定义帐户here的详细信息至关重要。您很可能希望选择不同的方法,例如使用Express帐户和Stripe自己的入职路径。不幸的是,这远远超出了StackOverflow答案所能解释的范围。我建议先仔细查看他们的文档,然后联系他们的支持团队,否则here