添加元数据以对客户进行条带化

Add Metadata to stripe on customers

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

我试着看这里:

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

它是一个词典

下面是一个示例,展示了如何将元数据与 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 }
    }
}
);