stripe-payments

Expanding an Invoice not working in recent Stripe .NET SDK (48.2.0)


When trying to expand an Invoice in order to get the payment intent (card provider, last4 digits) in a single api call to the invoice service, the resulting invoice object does not contain the expanded information at all when using the latest Stripe .NET SDK (48.2.0).

This is the code that the LLM bot on the Stripe website recommends us to use to expand the Invoice when calling the List method on the invoice service, and we are unable to make it work in our case as the PaymentIntent property simply doesn't show up on the resulting Invoice objects.

var invoiceService = new InvoiceService();
var options = new InvoiceListOptions
{
    Limit = 10,
    Expand = new List<string>
    {
        "data.payment_intent",
        "data.payment_intent.payment_method",
        "data.charge",
        "data.charge.payment_method_details"
    }
};

var invoices = invoiceService.List(options);

However, the same request works completely fine when using the Stripe Shell on the website and the expanded information appears correctly in the json with that method.


Solution

  • The 48.2.0 version of our .NET SDK is pinned to the 2025-05-28.basil API version. This release includes breaking changes introduced in the 2025-03-31.basil release, including the removal of the payment_intent property from the Invoice resource:

    Removed the payment_intent, charge, paid, and paid_out_of_band fields from the Invoice object.

    Instead, it is now recommended you leveraging the Invoice Payments API to retrieve details about payments for a specific endpoint.