小编Leh*_*afa的帖子

Stripe - 检索结帐会话的 line_items

我正在尝试获取 Stripe 中结帐会话的 line_items,以便我可以发送一封包含产品下载链接的电子邮件,但不幸的是,当我尝试检索时,line_items我checkout_session得到一个空值。

\n

前端:Next.js

\n

这是我的代码/pages/api/webhooks/index.ts:

\n

检查线路:77

\n
import { 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)

webhooks stripe-payments reactjs next.js

6
推荐指数
1
解决办法
4136
查看次数

Dart 中的空安全

最近,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)

这是我得到的错误: 在此输入图像描述

oop dart flutter dart-null-safety

2
推荐指数
1
解决办法
137
查看次数