将元数据添加到客户的条带中 [英] Add Metadata to stripe on customers

查看:35
本文介绍了将元数据添加到客户的条带中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

我试着看这里:

解决方案

以下示例展示了如何通过 Stripe.net:https://github.com/jaymedavis/stripe.net#updating-a-bank-account

你应该像这样修改你的代码:

planService.Create(new StripePlanCreateOptions(){金额 = 99 * 100,名称 = abonnement.mdr + " - (" + planType + ")",货币 = "欧元",间隔 = "月",间隔计数 = 6,编号 = 1,元数据 = 新字典<字符串,字符串>(){{ "Pakkeid", abonnement.PriceValueUnikId }}});

It is such that I need to add a unique identifier to the customer. via stripe metadata. This is how I built it completely finished now but I have however just the last part as to tell me which package the user has purchased.

I've tried to look here:

Plans to stripe

Code here:

  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
     }
  }
  );

Error on Metadata

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

Invalid initializer member declarator

Its a Dictionary

解决方案

Here's an example showing how to use metadata with Stripe.net: https://github.com/jaymedavis/stripe.net#updating-a-bank-account

You should modify your code like this:

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 }
    }
}
);

这篇关于将元数据添加到客户的条带中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆