获取jaymedavis / stripe.net代码的银行帐户“验证”功能的“已接收未知参数:金额”。

时间:2016-04-25 14:23:29

标签: wcf stripe.net

我正在实施WCF服务,使用github jaymedavis / stripe.net代码(https://github.com/jaymedavis/stripe.net#charges)实现在线网上银行。 这是我创建客户,银行账户和银行账户服务的代码,用于验证银行账户和创建费用。

代码:

//1. Create Customer
var myCustomer = new StripeCustomerCreateOptions();
myCustomer.Email = "pork@email.com";
myCustomer.Description = "Johnny Tenderloin (pork@email.com)";

//myCustomer.SourceToken = *token*;
//myCustomer.PlanId = *planId*;                          // only if you have a plan
//myCustomer.TaxPercent = 20;                            // only if you are passing a plan, this tax percent will be added to the price.
//myCustomer.Coupon = *couponId*;                        // only if you have a coupon
//myCustomer.TrialEnd = DateTime.UtcNow.AddMonths(1);    // when the customers trial ends (overrides the plan if applicable)
//myCustomer.Quantity = 1;                               // optional, defaults to 1

//2. Create Customer Service
var customerService = new StripeCustomerService(StripeApiKey);
StripeCustomer stripeCustomer = customerService.Create(myCustomer);

//3. Create bankAccount
var myBankAccount = new BankAccountCreateOptions
{
    SourceBankAccount = new SourceBankAccount()
    {
        AccountNumber = "000123456789", //,
        Country = "US",
        Currency = "usd",
        AccountHolderName = "Frank", //"Johnny Tenderloin",
        AccountHolderType = BankAccountHolderType.Individual,
        RoutingNumber = "110000000", //"021000021",
        Metadata = new Dictionary<string, string>
        {
            { "Name", "Ray Barone" },
            { "OftenSays", "Thatttttt's right" }
        }
    }
};

//4. Create bankAccount Service
var bankAccountService = new BankAccountService(StripeApiKey);           
CustomerBankAccount bankAccount = bankAccountService.Create(stripeCustomer.Id, myBankAccount);
BankAccountVerifyOptions bankAccountVerifyOpt = new BankAccountVerifyOptions();
bankAccountVerifyOpt.AmountOne = 32;
bankAccountVerifyOpt.AmountTwo = 45;
//

//5. Verify bankAccount or service
bankAccount = bankAccountService.Verify(stripeCustomer.Id, bankAccount.Id, bankAccountVerifyOpt );


//6. Create Charge
var myChargeBank = new StripeChargeCreateOptions();
// amount = Returnamount.amount;

myChargeBank.Amount = int.Parse("250") * 100;
myChargeBank.Currency = "usd";
myChargeBank.CustomerId = stripeCustomer.Id;
myChargeBank.Capture = true;

StripeCharge stripeCharge = null;
stripeCharge = new StripeCharge();
var chargeService = new StripeChargeService(StripeApiKey);
stripeCharge = chargeService.Create(myChargeBank);


if (stripeCharge.Status.ToLower() == "succeeded" & stripeCharge.Paid == true) {

} else {

}

在此代码中,我得到: Stripe Exception for Verify method (bankAccountService.Verify(stripeCustomer.Id, bankAccount.Id, bankAccountVerifyOpt );)

例外是Received unknown parameter: amounts

关于“验证银行帐户”的“https://github.com/jaymedavis/stripe.net#charges”实施已失踪,请帮我解决此问题,以便银行帐户成功验证。

1 个答案:

答案 0 :(得分:0)

我有同样的问题,我做了两件事:

1)在stripe.com上,我访问了我的帐户API设置并更新了它们以使用已过时的API。

2)我更新了Stripe.net Nuget包

之后一切都很完美。