小编Chr*_*oph的帖子

Stripe-Metadata 未响应​​(WebHook/.net-core)

我正在使用 stripe 进行付款。当我创建 SessionCreateOptions 对象时,我添加了 CustomerId 和 ProductId 以供以后在 Webhook 中使用。

 var options = new SessionCreateOptions
        {
            PaymentMethodTypes = new List<string> {
                "card",
            },
            CustomerEmail = buyer.Email,
            LineItems = new List<SessionLineItemOptions> {
                new SessionLineItemOptions {
                    Name = packages.First().Name,
                    Description = packages.First().Description,
                    Amount = (long)(totalAmount * 100),
                     Currency = "eur",
                    Quantity = 1,
               },
            },
            SuccessUrl = appSettings.RedirectHost.Url + "/Checkouts/Show/success?session_id={CHECKOUT_SESSION_ID}",
            CancelUrl = appSettings.RedirectHost.Url + "/Checkouts/Show/failed",
            Metadata = new Dictionary<String, String>()
            {
                 { "CustomerId", buyer.Id.ToString()},
                 { "ProductId", packages.First().Id.ToString()}
            },
        };
Run Code Online (Sandbox Code Playgroud)

成功付款后,将调用 Webhook …

.net c# stripe-payments .net-core

5
推荐指数
1
解决办法
7159
查看次数

标签 统计

.net ×1

.net-core ×1

c# ×1

stripe-payments ×1