首页 > 解决方案 > 在谷歌函数中使用格子是行不通的

问题描述

所以我正在使用谷歌函数编写一个脚本来自动支付我的工人工资!在我的后端,我已经存储了公共令牌和帐户 ID。我正在尝试使用格子变成条纹令牌,然后使用条纹进行转移!条纹的东西正在工作,但格子函数不会返回新的条纹银行帐号..有什么想法吗?

plaidClient.exchangePublicToken("public-sandbox-6be57fb5-3286-4bc8-a770-54a16ea39283", 
res => { 
var accessToken = res.access_token; 
// debugging = exchangedata.access_token; 
//debugging = err.message; 
// Generate a bank account token 
plaidClient.createStripeToken(accessToken, snapshot.val().plaid_account_id, 
res => { 
bankAccountToken = res.stripe_bank_account_token; 
stripe.transfers.create({ 
amount: (Number(appointmentchildSnapshot.val().price)/3).toString(), 
currency: "usd", 
destination:bankAccountToken, 
transfer_group: "ORDER_95" 
},(_err, transfer)=> { 
// asynchronously called 
}); 
});

标签: plaid

解决方案


让你在声明你的客户秘密和东西时使用双“”!

为了测试错误使用 res.json(Error:responsetowhatfunction you are using)

-- 不幸的是,某些银行令牌在沙盒中无法与 Plaid 一起使用,并且它们也会很快过期,因此如果它不起作用,请创建一个新令牌并重试

---使用错误日志内容,您可以跟踪发生这种情况的时间

   await plaidClient.exchangePublicToken(snapshot.val().plaid_token, 
      async (error,response1) => {
        if (error !== null) {
          res.json({error:snapshot.val().plaid_token});
        } else {

        var accessToken = response1.access_token;
        //res.json(accessToken);
       // debugging = exchangedata.access_token;
        //debugging = err.message;
        // Generate a bank account token
       debugging = await plaidClient.createStripeToken(accessToken, snapshot.val().plaid_account_id, 
        async (error2,response2) => {

          if(error2!==null){
            res.json({error:snapshot.val().plaid_account_id});

          }else{
          //res.json({error:response2});
         // bankAccountToken = response2.stripe_bank_account_token;
          stripe.transfers.create({
            amount: (Number(appointmentchildSnapshot.val().price)/3).toString(),
            currency: "usd",
            destination:response2.stripe_bank_account_token,
            transfer_group: "ORDER_95"
          },(_err, transfer)=> {
            // asynchronously called
          });
        }

推荐阅读