Skip to content

Event charge.succeeded event object #1812

Open
@blagi

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions