plaid - 在谷歌函数中使用格子是行不通的
问题描述
所以我正在使用谷歌函数编写一个脚本来自动支付我的工人工资!在我的后端,我已经存储了公共令牌和帐户 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
});
});
解决方案
让你在声明你的客户秘密和东西时使用双“”!
为了测试错误使用 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
});
}
推荐阅读
- jsonata - JSONata:按部分名称提取字段
- memory-leaks - 需要有关 OSGi 内存消耗的经验
- mysql - 使用多个线程执行多个 sequelize 查询
- excel - VBA OnKey 并传递一个变量
- javascript - 如何在 JavaScript 中获取关联数组中最深的对象?
- javascript - Stackblitz.com:在另一个模块中导入模块时出错
- javascript - 无法将对象从 json 分配给变量
- firebase - 如何在颤动的通知屏幕上显示以前的firebase推送通知
- python - 在 Python 中合并嵌套列表的快速、有效的方法
- c - 运行一个eclipse程序