我正在尝试获取 Stripe 中结帐会话的 line_items,以便我可以发送一封包含产品下载链接的电子邮件,但不幸的是,当我尝试检索时,line_items我checkout_session得到一个空值。
前端:Next.js
\n这是我的代码/pages/api/webhooks/index.ts:
检查线路:77
\nimport { buffer } from "micro";\nimport Cors from "micro-cors";\nimport { NextApiRequest, NextApiResponse } from "next";\n\nimport Stripe from "stripe";\nconst stripe = new Stripe(process.env.STRIPE_SECRET_KEY!, {\n // https://github.com/stripe/stripe-node#configuration\n apiVersion: "2020-08-27",\n});\n\nconst webhookSecret: string = process.env.STRIPE_WEBHOOK_SECRET!;\n\n// Stripe requires the raw body to construct the event.\nexport const config = {\n api: {\n bodyParser: false,\n },\n};\n\nconst cors = Cors({\n allowMethods: ["POST", "HEAD"],\n});\n\nconst webhookHandler = async (req: NextApiRequest, res: NextApiResponse) => …Run Code Online (Sandbox Code Playgroud) 最近,dart 发布了名为 null safety 的新功能。我对如何创建带有命名参数的构造函数有点困惑。当我遵循花括号的使用时,出现错误。
这是我的代码:
void main() {
}
class Student {
String name = '';
num age = 0;
List<num> marks = [];
Student({
this.name,
this.age,
this.marks
});
void printStudentDetails() {
print('Student Name: ' + this.name);
}
}
Run Code Online (Sandbox Code Playgroud)