如何将元数据添加到 Stripe 中的新订阅?

How to add metadata to a new subscription in Stripe?

我有这段代码,来自 Stripe API 文档站点上的示例:

stripe.Key = "my_key"

s, err := sub.New(&stripe.SubParams{
    Customer: "test_customer",
    Plan: "month-plan",

})

这段代码工作得很好。但是我找不到如何向这个请求添加元数据,比如 Product: "special-services".

我可以在创建订阅的一个请求中完成吗?如果可以,那么怎么做?

谢谢!

subParams := &stripe.SubParams{
    Customer: "test_customer",
    Plan: "month-plan",
}
subParams.AddMeta("Product","special-services")
s, err := sub.New(subParams)

stripe.SubParams embeds stripe.Params which has a method AddMeta,将元信息添加到 map[string]string.