【问题标题】:Stripe - does not have access to account '{{XX}}' (or that account does not exist)Stripe - 无权访问帐户“{{XX}}”(或该帐户不存在)
【发布时间】:2020-01-01 13:54:48
【问题描述】:

我正在使用 Stripe Connect,并且我已成功加入 3 个商家。我正在尝试生成付款意图,并且我一直在获得

" 无权访问帐户 '{{acct_1FvpC4JkgwMoBOTZ}}'(或该帐户不存在)。" 然而我使用的 SECRET api 密钥匹配并且没有改变。我的平台显然也吸引了客户和商家:

商家:

客户:

NODE.JS 初始化:

const stripe = require('stripe')(StripeKey);

@param CONNECTED_STRIPE_ACCOUNT_ID = acct_1FvpC4JkgwMoBOTZ

@param customerId = cus_GSe2V6snvtLlQs

代码:

exports.onDonationFinance = functions.database.ref("/Stripe/{donationId}").onCreate((snapshot,context)=>{
var amount = snapshot.child("amount").val();
var email = snapshot.child("email").val();
const CONNECTED_STRIPE_ACCOUNT_ID = snapshot.child("conn_id").val();
const customerId = snapshot.child("cus_id").val();
const id = context.params.donationId;
const token = generateToken(customerId,CONNECTED_STRIPE_ACCOUNT_ID);
if(amount===0){
    amount =250;
}else if(amount ===1){
    amount =500;
}else if(amount ===2){
    amount =1000;
}else if(amount ===3){
    amount =1500;
}
const applicationFee = Math.round((amount/100)*1.45);
stripe.customers.create({
    source: token
  }, {
    stripe_account: CONNECTED_STRIPE_ACCOUNT_ID,
  });
(async () => {

    const paymentIntent = await stripe.paymentIntents.create({
        payment_method_types: ['card'],
        amount: 1000,
        currency: 'gbp',
        application_fee_amount: applicationFee,
        customer: customerId,
      }, {
        stripe_account: CONNECTED_STRIPE_ACCOUNT_ID,
      }).then(function(paymentIntent) {
        // asynchronously called
        const clientSecret = paymentIntent.client_secret
            const donationStripeCleanup = admin.database().ref(`Stripe/${id}`)
            return admin.database().ref(`Stripe/${id}/clientSecret`).set(clientSecret);

      });



  })();
});

Android 代码:

  extraParams.put("setup_future_usage", "off_session");
                                        confirmparams = ConfirmPaymentIntentParams.createWithPaymentMethodCreateParams(params,dataSnapshot.getValue().toString(), null, false, extraParams);

                                        stripe = new Stripe(MakeUserPayment.this, PaymentConfiguration.getInstance(getApplicationContext()).getPublishableKey());
                                        stripe.confirmPayment(MakeUserPayment.this,confirmparams);
                                        secretListener.removeEventListener(this);

@Param connectedAccount = 测试模式客户端 ID

生成令牌:

function generateToken(customerId, connectedAccount){
    stripe.tokens.create({
        customer: customerId,
      }, {
        stripe_account: `{{${connectedAccount}}}`,
      }).then(function(token) {
        // asynchronously called
        console.log('Token :', token);
        return token;
      }).catch((error) => {
                return console.log('Token Error:', error);
           }); 

}

我收到的令牌错误:提供的密钥 'sk_test_hB****************************EYq3' does not have access to account '{{acct_1FvpC4JkgwMoBOTZ}}' (or that account does not exist). Application access may have been revoked.

有人知道我在哪里出错了吗?最终用例是:客户向商家付款,我的平台收取该金额的申请费。

【问题讨论】:

  • 请控制台记录令牌值
  • 已添加,我收到令牌错误
  • 好的,我正在检查
  • 请检查密钥设置
  • 秘钥是来自accounts API的测试密钥...我觉得没问题

标签: node.js stripe-payments


【解决方案1】:

您实际上是在发送{{${connectedAccount}}},它变成{{acct_ABCXYZ123}},这是不正确的;试试这个:

stripe.tokens.create({
    customer: customerId,
  }, {
    stripe_account: `${connectedAccount}`,
  }).then(function(token) {

【讨论】:

  • 谢谢 Lomas,我已经解决了这个问题并修复了上面的问题......我现在已经包含了 android 代码(这是问题所在)......如果你可以定制你解决问题的答案我会给你正确的答案:)。
  • 我不明白你的意思 - 我描述的初始错误仍在你的 node.js 代码中。
  • 可能是您将 Stripe 帐户 ID 与数据库中的 ID 一起存储?
  • 对不起 Lomas,我的意思是在 Node.js 代码中更改它,您的答案是正确的,但不能解决问题(更改它仍然会出现相同的问题)。最后的问题是在Android Java代码中,使用Stripe connect时需要使用连接的条带ID(使用consutrctor)启动Stripe。
  • 洛马斯,我收回我的最后一句话,你的回答确实解决了我最初提出的问题。我很抱歉。
【解决方案2】:

由于同样的(愚蠢的)错误,我在 ruby​​ 中遇到了同样的错误。

我有

Stripe::Account.create_login_link('account.id')

但应该有

Stripe::Account.create_login_link(account.id)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-08-01
    • 2018-03-29
    • 2020-01-12
    • 2017-03-15
    • 1970-01-01
    • 2014-09-27
    • 1970-01-01
    相关资源
    最近更新 更多