0

我正在实施 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 ”上缺少“验证银行账户”的实现,所以请帮我解决这个问题,以便银行账户成功验证。

4

1 回答 1

0

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

1) 在 stripe.com 上,我转到我的帐户 API 设置并更新它们以使用最新的 API。

2) 我更新了 Stripe.net Nuget 包

之后,一切都完美无缺。

于 2017-02-11T23:44:12.563 回答