#CAMOU
1 messages · Page 1 of 1 (latest)
Specifically which event?
charge.dispute.created
looking to get the metadata from it can be either a dispute for a subscription or a one-time payment
Which object is the metadata set on?
It won't be available in the webhook payload either way, you'd need to make a subsequent API request to 'expand' the charge field: https://stripe.com/docs/api/disputes/object#dispute_object-charge
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
it's set on either the subscription or the one-time payment
oh okay gotcha
but I can't add a charge ID or something to the stripe trigger command so I can test it properly with meta data right?
not really, you could write a small script to call the API (create a Charge with metadata using the test card for declines) instead of using stripe trigger, or write your own fixture' for the Stripe CLi
This may work: stripe trigger charge.dispute.created --override dispute:charge=ch_xxx
ch_xxx being an actual Charge object on your account
actually stripe trigger charge.dispute.created --override charge:metadata.foo=bar might work
oh awesome thanks guys!
how would I add multiple items to the metadata?
stripe trigger charge.dispute.created --override charge:metadata.foo=bar charge:metadata.bar=foo like this?
AFAIK yes, did it work when you tried ?
so the charge itself doesnt show up
but I cant do an api call either because with the trigger tehre is no actual charge or is it?
i think im just gonna use the right test card for it didnt know there is one for disputes
there is
all the trigger does is it calls the API and creates a charge, which then creates a dispute
you can see at https://github.com/stripe/stripe-cli/blob/master/pkg/fixtures/triggers/charge.disputed.created.json that all the stripe trigger charge.dispute.created does is create a Charge using the test card. Using override lets you add extra parameters to that API call creating the Charge(such as metadata)
ah gotcha
so now the only problem i see is, from the dispute I get through the webhook how can I receive the Stripe Account ID? Because i use stripe connect so to continue with an api reqeust for the Paymetn Intent for example I would need the stripe account id that was the dispute belong sto