stripe / stripe-node

Node.js library for the Stripe API.
https://stripe.com
MIT License
3.73k stars 728 forks source link

PaymentIntent interafce does not have charges object in it even tho it is sent from stripe webhook on payment_intent.succeeded event #2112

Closed Hackerokuz closed 3 weeks ago

Hackerokuz commented 3 weeks ago

Describe the bug

PaymentIntent interafce does not have charges object in it even tho it is sent from stripe webhook on payment_intent.succeeded event.

To Reproduce

Check if type Stripe.PaymentIntentSucceededEvent['data']['object'] for charges type. charges object does not exist even tho it is sent from stripe servers.

Expected behavior

Stripe.PaymentIntentSucceededEvent['data']['object'] should contain charges object as it is sent in the Payment Intent Succeeded Event.

Code snippets

No response

OS

Windows 10

Node version

Node v20.13.1

Library version

stripe 14.25.0

API version

2020-08-27

Additional context

No response

remi-stripe commented 3 weeks ago

The charges property on PaymentIntent is deprecated and it was removed in the API version 2022-11-15 where we say

The charges property on PaymentIntent has been removed. You can use the latest_charge property instead.

You likely have an old integration and your Stripe account has a default API version older than this so you are still getting the charges property on those (otherwise it'd be breaking a lot of existing integration). The types in the stripe-node SDK match the latest API version which is why they have latest_charge and not charges anymore.

If you have any follow up questions, please work directly with our support team for 1:1 integration support help: https://support.stripe.com/contact