InvoiceId在条带C#上返回null

时间:2018-11-04 15:57:32

标签: c# stripe-payments stripe-invoices

我在尝试获取发票ID时遇到问题,它返回null 那是我的代码:

       var myCharge = new StripeChargeCreateOptions();
        myCharge.Amount = (Int32)(amount*100);
        myCharge.Currency = "usd";
        myCharge.ReceiptEmail = stripeEmail;
        myCharge.Description = Description;
        myCharge.SourceTokenOrExistingSourceId = stripeToken;
        myCharge.Capture = true;
        myCharge.CustomerId = customer.Id;

        var chargeService = new StripeChargeService(token);
        StripeCharge stripeCharge = chargeService.Create(myCharge);
        string Invoice= stripeCharge.Invoice.Id;

发票总是以null返回,有人知道原因吗?

1 个答案:

答案 0 :(得分:1)

invoice property仅在收费对象是订阅发票的付款(即,如果您使用Stripe的Billing API)上才存在于收费对象上。在这种情况下,您只是在创建未链接到任何发票的普通费用,因此该字段为空是正常的。