编程语言
首页 > 编程语言> > C#-将元数据添加到客户的条带中

C#-将元数据添加到客户的条带中

作者:互联网

我需要为客户添加一个唯一的标识符.通过条带元数据.这就是我现在完全完成构建的方式,但是我只剩下最后一部分来告诉我用户购买了哪个软件包.

我试图看这里:

Plans to stripe

代码在这里:

  var planType = abonnement.fk_userid != null ? "Business" : "Default";

  planService.Create(new StripePlanCreateOptions()
  {
     Amount = 99 * 100,
     Name = abonnement.mdr + " - (" + planType + ")",
     Currency = "EUR",
     Interval = "month",
     IntervalCount = 6,
     Id = 1,
     Metadata =
     {
         "Pakkeid:" = abonnement.PriceValueUnikId
     }
  }
  );

元数据错误

The left-hand side of an assignment must be a variable, property or
indexer

Invalid initializer member declarator

它是字典

enter image description here

解决方法:

这是一个示例,显示了如何在Stripe.net中使用元数据:https://github.com/jaymedavis/stripe.net#updating-a-bank-account

您应该这样修改代码:

planService.Create(new StripePlanCreateOptions()
{
    Amount = 99 * 100,
    Name = abonnement.mdr + " - (" + planType + ")",
    Currency = "EUR",
    Interval = "month",
    IntervalCount = 6,
    Id = 1,
    Metadata = new Dictionary<string, string>()
    {
        { "Pakkeid", abonnement.PriceValueUnikId }
    }
}
);

标签:stripe-payments,c
来源: https://codeday.me/bug/20191118/2029220.html