C# 直接收费

C# 直接收费,c#,.net,stripe-payments,stripe.net,C#,.net,Stripe Payments,Stripe.net,我正试图使用Stripe直接向客户收费。我正在使用以下示例代码: var stripeChargeCreateOptions = new StripeChargeCreateOptions(); stripeChargeCreateOptions.Amount = 1000; stripeChargeCreateOptions.Currency = "usd"; stripeChargeCreateOptions.Description = "Test"; stripeChargeCrea

我正试图使用Stripe直接向客户收费。我正在使用以下示例代码:

var stripeChargeCreateOptions = new StripeChargeCreateOptions();

stripeChargeCreateOptions.Amount = 1000;
stripeChargeCreateOptions.Currency = "usd";

stripeChargeCreateOptions.Description = "Test";

stripeChargeCreateOptions.Source = new StripeSourceOptions()
{

    Number = "4242424242424242",
    ExpirationYear = "2022",
    ExpirationMonth = "10",
    AddressCountry = "US",                // optional
    AddressLine1 = "24 Beef Flank St",    // optional
    AddressLine2 = "Apt 24",              // optional
    AddressCity = "Biggie Smalls",        // optional
    AddressState = "NC",                  // optional
    AddressZip = "27617",                 // optional
    Name = "Joe Meatballs",               // optional
    Cvc = "1223"                          // optional
};

stripeChargeCreateOptions.Capture = true;

var stripeChargeService = new StripeChargeService();
StripeCharge stripeCharge = stripeChargeService.Create(stripeChargeCreateOptions);
这似乎在测试模式下工作。以下是我的三个问题:

  • 这里1000美元是10美元,对吗

  • 使用活动密钥也可以吗?我听说Stripe不允许直接收费,并要求我们访问他们的Javascript和存储令牌,以便我们实际收费?它是如何在测试模式下工作的

  • stripeChargeCreateOptions.Capture=true的重要性是什么如果我将其设置为false会发生什么

  • 是的,没错。所有金额均以美分/便士为单位

  • 恐怕我对Stripe了解不够,帮不了你做这件事

  • 这将告诉Stripe使用什么流程来执行事务-这是之前创建的费用的后半部分,捕获属性设置为“false”。因此,您以后需要调用API并将其设置为true,以实际完成充电。有关更多信息,请参阅API:


  • 这就产生了三个问题……:)@托马斯:更新了。谢谢!:)