Stripe removed invoice.payment_intent in the basil API and it quietly broke my failed-payment workflow
Описание и применение
Stripe удалил поле invoice.payment_intent в версии API 2025-03-31.basil, что привело к остановке рабочего процесса обработки неудачных платежей. Решение – запросить invoice_payments с расширением payment_intent и использовать last_payment_error.decline_code.
Задача
Stripe’s API version 2025-03-31.basil removed the invoice.payment_intent field, causing a failed-payment workflow to stop silently when the code attempted to access an undefined payment intent.
Результат
The updated approach restores failed-payment handling for hard declines, soft declines, and 3DS cards in the new API version.
Рабочий процесс
- 1. Send GET /v1/invoice_payments?invoice={invoice_id}&limit=1&expand[]=data.payment.payment_intent
- 2. Retrieve data[0].payment.payment_intent
- 3. Access last_payment_error.decline_code from the payment intent
- 4. Proceed with retry or notification logic
Доказательства
From that version the invoice doesn't have payment_intent, charge or paid anymore.
Ask for the invoice's payments and expand the payment intent in the same call: GET /v1/invoice_payments?invoice=in_123&limit=1&expand[]=data.payment.payment_intent
- Дата записи: 2026-10-06T07:55:46.487Z