Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event charge.succeeded event object #1812

Open
blagi opened this issue Feb 5, 2025 · 2 comments
Open

Event charge.succeeded event object #1812

blagi opened this issue Feb 5, 2025 · 2 comments
Labels

Comments

@blagi
Copy link

blagi commented Feb 5, 2025

Describe the bug

To get some new features I upgraded from stripe-php v13.18.0 to v.16.5.0. Now have issue with charge.succeeded event. My webhook expected event object like this:

Stripe\Event Object
(
    [id] => evt_xxxx...
    [object] => event
    [api_version] => 2022-11-15
    [created] => 1738626948
    [data] => Stripe\StripeObject Object
        (
            [object] => Stripe\Charge Object
                (
                    [id] => ch_xxxxxxxxxxxxxxxxxxx
                    [object] => charge


But got event object wit charge object replaced with Stripe object:

Stripe\Event Object
(
    [id] => evt_xxxx...
    [object] => event
    [api_version] => 2022-11-15
    [created] => 1738743518
    [data] => Stripe\StripeObject Object
        (
            [object] => Stripe\StripeObject Object
                (
                    [id] => ch_xxxxxxxxxxxxxxxxx
                    [object] => charge

Instead of Charge object there is a StripeObject and that breaks my code that expects Charge object.
Reading breakings in changelog I didn't notice any such change.

I'm afraid I'll have some other issues like this one in other parts of application. Where can I find such breaking changes? When this change in stripe-php occurred?

To Reproduce

  1. The code in webhook controller should call method like this with type hinting:
public function charge_succeeded(\Stripe\Charge $charge)
     {
           
     }
  1. Get event charge.succeeded in v. stripe-php v13.18.0 env
  2. copy event id
  3. Using Stripe CLI resend event in installation with stripe-php v16.5.0. stripe events resend <event_id>
  4. Error 500 should occurre

Expected behavior

Charge object should be inside Event object instead StripeObject or which one leatest stripe-php version work by returning Charge instead StripeObject

Code snippets

OS

Windows 11

PHP version

PHP 7.0.33

Library version

stripe-pho 16.5.0

API version

2022-11-15, same with 2024-12-18.acacia

Additional context

No response

@blagi blagi added the bug label Feb 5, 2025
@xavdid-stripe
Copy link
Member

Thanks for the report! We'll take a look.

@helenye-stripe
Copy link
Contributor

helenye-stripe commented Feb 19, 2025

Hi @blagi, sorry for the delay. Could you provide a snippet of how you are processing the webhook? I have created my own webhook endpoint and have not been able to reproduce, I am getting the correct \Stripe\Charge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants