【问题标题】:Stripe.Net direct chargeStripe.Net 直充
【发布时间】:2016-01-03 03:02:16
【问题描述】:

我正在尝试使用 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);

这似乎在测试模式下工作。这是我的 3 个问题:

  1. 这里的 1000 是 10 美元 - 对吧?

  2. 这是否也可以使用实时键?我听说 Stripe 不允许直接收费,并要求我们使用他们的 Javascript 并存储令牌以供我们实际收费?在测试模式下如何工作?

  3. stripeChargeCreateOptions.Capture = true; 的重要性是什么如果我将它设置为 false 会发生什么?

【问题讨论】:

  • 这提出了 3 个问题... :)
  • @Thomas:已更新。谢谢! :)

标签: c# .net stripe-payments stripe.net


【解决方案1】:
  1. 是的,没错。所有金额均以美分/便士为单位。

  2. 恐怕我对 Stripe 的了解不够,无法帮助您解决这个问题。

  3. 这告诉 Stripe 使用什么流程来执行交易 - 这是之前创建的费用的后半部分,其中 Capture 属性设置为“false”。因此,您稍后需要调用 API 并将其设置为 true 才能真正完成收费。有关详细信息,请参阅 API:https://stripe.com/docs/api?lang=php#capture_charge

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-03-14
    • 2018-08-05
    • 2017-10-08
    • 2020-09-19
    • 2015-04-11
    • 2014-12-16
    • 2016-09-04
    • 1970-01-01
    相关资源
    最近更新 更多