Пример #1
0
        public ActionResult <Invoice> RetryInvoice([FromBody] RetryInvoiceRequest req)
        {
            // Attach payment method
            var options = new PaymentMethodAttachOptions
            {
                Customer = req.Customer,
            };
            var service       = new PaymentMethodService();
            var paymentMethod = service.Attach(req.PaymentMethod, options);

            // Update customer's default invoice payment method
            var customerOptions = new CustomerUpdateOptions
            {
                InvoiceSettings = new CustomerInvoiceSettingsOptions
                {
                    DefaultPaymentMethod = paymentMethod.Id,
                },
            };
            var customerService = new CustomerService();

            customerService.Update(req.Customer, customerOptions);

            var invoiceOptions = new InvoiceGetOptions();

            invoiceOptions.AddExpand("payment_intent");
            var     invoiceService = new InvoiceService();
            Invoice invoice        = invoiceService.Get(req.Invoice, invoiceOptions);

            return(invoice);
        }
Пример #2
0
        public async Task <Invoice> GetInvoiceAsync(string invoiceId)
        {
            var options = new InvoiceGetOptions
            {
            };

            var invoice = await _invoiceService.GetAsync(invoiceId, options);

            return(invoice);
        }
Пример #3
0
 public virtual Task <Invoice> GetAsync(string invoiceId, InvoiceGetOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(this.GetEntityAsync(invoiceId, options, requestOptions, cancellationToken));
 }
Пример #4
0
 public virtual Invoice Get(string invoiceId, InvoiceGetOptions options = null, RequestOptions requestOptions = null)
 {
     return(this.GetEntity(invoiceId, options, requestOptions));
 }