Skip to content

1.11.0 (stable) / 2018-03-13

Choose a tag to compare

@bhelx bhelx released this 13 Mar 23:34
54b8c99

This includes the changes needed for API version 2.10. There are a few breaking changes:

Upgrade Notes

1. InvoiceCollection

When creating or failing invoices, we now return an InvoiceCollection object rather than an Invoice. If you wish to upgrade your application without changing functionality, we recommend that you use the ChargeInvoice property on the InvoiceCollection to get the charge Invoice. Example:

// Change this:
var invoice = account.InvoicePendingCharges();

// To this
var invoiceCollection = account.InvoicePendingCharges();
var invoice = invoiceCollection.ChargeInvoice;

// Invoice.MarkFailed now returns a new collection
// Change this
invoice.MarkFailed();

// To this
var invoiceCollection = invoice.MarkFailed();
var failedInvoice = invoiceCollection.ChargeInvoice;

2. Invoice Subtotal* changes

If you want to preserve functionality, change any use of Invoice#SubtotalAfterDiscountInCents to Invoice#SubtotalInCents. If you were previously using Invoice#SubtotalInCents, this has been changed to Invoice#SubtotalBeforeDiscountInCents.

3. Invoice Refund -- refund_apply_order changed to refund_method

The RefundOrderPriority enum was changed to RefundMethod. Change use of RefundOrderPriority.Credit to RefundMethod.CreditFirst and RefundOrderPriority.Transaction to RefundMethod.TransactionFirst.

4. Invoice States

If you are checking Invoice#State anywhere, you will want to check that you have the new correct values. collected has changed to paid and open has changed to pending. Example:

// Change this
if (invoice.State == Invoice.InvoiceState.Collected) {
// To this
if (invoice.State == Invoice.InvoiceState.Paid) {

// Change this
if (invoice.State == Invoice.InvoiceState.Open) {
// To this
if (invoice.State == Invoice.InvoiceState.Pending) {

5. Invoices on Subscription Previews

If you are using Subscription#Invoice on subscription previews, you will need to change this to use Subscription#InvoiceCollection. To keep functionality the same:

// Change this
subscription.Preview();
var invoice = subscription.Invoice;

// To this
subscription.Preview();
var invoice = subscription.InvoiceCollection.ChargeInvoice;