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

Changes in the webhook event object in newer API versions #124

Open
vu3rdd opened this issue Oct 23, 2019 · 3 comments
Open

Changes in the webhook event object in newer API versions #124

vu3rdd opened this issue Oct 23, 2019 · 3 comments

Comments

@vu3rdd
Copy link

vu3rdd commented Oct 23, 2019

It looks like the request property of the Event object that one gets from a webhook has changed in the newer versions of the API, resulting in an error:

Error in $.request: parsing Text failed, expected String, but encountered Object

The eventRequest has a type Maybe Text, however, one gets an object from Stripe:

...
    "livemode": false,
    "pending_webhooks": 2,
    "request": {
        "id": "req_XYZ",
        "idempotency_key": null
    },
    "type": "charge.succeeded"
...

This change happened in version 2017-05-25.

Are there any plans to support newer versions?

@exarkun
Copy link

exarkun commented Oct 23, 2019

Perhaps worth noting is that newly created Stripe accounts seem to use the newest Stripe API at the time of their creation and there is no option to downgrade.

@dmjio
Copy link
Owner

dmjio commented Oct 23, 2019

AFAIK the Events API (webhooks specifically) follow the latest stripe version, but other APIs (customers, etc.) use the version that is hard-coded in the HTTP header. So it's possible to use your own JSON decoding method just for stripe webhooks (that corresponds with the API version on your account), and this library for everything else.

@exarkun
Copy link

exarkun commented Nov 2, 2022

For what it's worth, it turns out you can request specific API versions for webhook payloads. You can do this either in the dashboard UI when creating webhooks or when using the API to create webhooks. If you use the dashboard, you are limited to choosing API versions at least as new as the default for your account and if that restricts your options to only one API version, the UI for choosing a version doesn't even appear. If you use the API, as far as I can tell, you can ask for any version you want.

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

No branches or pull requests

3 participants