首页 > 解决方案 > 谷歌云功能不执行条纹调用

问题描述

我在承诺结构中运行一系列条纹收费。当我只运行一次收费时,一切正常。但是,当我尝试运行多个条带收费代码行时,根本不会执行。

有没有人了解我的代码结构或谷歌云函数会阻止执行多个条带调用的发生?

const idempotency_key = randomstring.generate();  // prevent duplicate charges

    const amount = total + 30;
    const currency = "usd";

    console.log("Blue Scarfs", idempotency_key);
    console.log("Blue Scarfs", user_ID);

    return docRef2.doc(`/users_stripe/${user_ID}`).get()
            .then(snapshot => {

            console.log("the dollars", snapshot);
            console.log("the dollars", user_ID);
            const customer = snapshot.data().id;
            const charge = {amount, currency, customer};
            console.log("Bills", charge);
            return stripe.charges.create(charge , { idempotency_key });
            console.log("Bills");
            })

标签: javascriptgoogle-cloud-firestoregoogle-cloud-functionsstripe-payments

解决方案


推荐阅读