首页 > 解决方案 > C#.NET 4.6 中的条带充电

问题描述

我从 nuget 安装了最新的条带库。这是 .NET 的原始 Stripe 库。

我有相同的旧库,现有代码运行正常。最新的库不支持这些类。如何使用最新的库作为现有代码收费?

    public void ChargeStripe(string stripeEmail, string stripeToken, string payAmount, string 
                             currency, string customerId, string paymentDescription) 
                                 
    {
        // public ActionResult Charge(string stripeEmail, string stripeToken)
        var customers = new StripeCustomerService();
        var charges = new StripeChargeService();

        var customer = customers.Create(new StripeCustomerCreateOptions
        {
            Email = stripeEmail,
            SourceToken = stripeToken
        });

        var charge = charges.Create(new StripeChargeCreateOptions
        {
            Amount = payAmount,  // charge in cents
            Description = paymentDescription,
            Currency = currency,
            CustomerId = customerId
        });
    }

标签: c#.netstripe-payments

解决方案


请查看Stripe 更新日志。我看到他们在版本之间更改了一些名称。可能您只需要更改它们。


推荐阅读