You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When my API receives a webhook request from Stripe via the CLI, I got the error expected required property account to be present and the location attribute is: body. After I created a manual request with the same body and added the attribute account (which is an empty string) I got the same error for the attribute: previous_attributes at the body.data location. After adding this element as well, it worked.
I checked the stripe docs and saw that the account attribute is a nullable string. The previous_attributes is a nullable map. However, the stripe-go-sdk regard these attributes as required attributes and not as optional.
I expect that I can use the stripe.Event object to bind the JSON and it works fine. It should also be able to handle optional attributes like account or previous_attributes.
Describe the bug
When my API receives a webhook request from Stripe via the CLI, I got the error
expected required property account to be present
and the location attribute is:body
. After I created a manual request with the same body and added the attributeaccount
(which is an empty string) I got the same error for the attribute:previous_attributes
at thebody.data
location. After adding this element as well, it worked.I checked the stripe docs and saw that the
account
attribute is anullable string
. Theprevious_attributes
is anullable map
. However, the stripe-go-sdk regard these attributes as required attributes and not as optional.Consider this pull request: #1936
To Reproduce
stripe listen --forward-to localhost:8081/webhook
)Check out this repository (m-mattia-m/stripe-go-event-bug-report) for a working example and all the request and response details (cURL, JSON, ...).
Expected behavior
I expect that I can use the stripe.Event object to bind the JSON and it works fine. It should also be able to handle optional attributes like
account
orprevious_attributes
.Code snippets
OS
macOS 15.0.1
Go version
Go 1.21
stripe-go version
v80.2.0
API version
2022-11-15
Additional context
No response
The text was updated successfully, but these errors were encountered: