Stripe文档here显示我应该得到一个带有id值的响应,这是使用该客户进行其他API调用所需要的。我从此代码中获得的唯一响应是{ status: true }
。我已经从lambda控制台记录了事件参数,但这并没有给我所需的响应。这是我的代码:
import stripePackage from "stripe";
import handler from "./libs/handler-lib";
export const main = handler(async (event, context, callback) => {
const { email, description } = JSON.parse(event.body);
// Load our secret key from the environment variables
const stripe = stripePackage(process.env.stripeSecretKey);
await stripe.customers.create({
email,
description
});
return { status: true };
});