Add metadata to Stripe webhooks using TwiML <Pay>
This is kind of a specific TIL, but hopefully it saves somebody else the time it took me to find the answer.
If you are using the TwiML <Pay> verb there is a noun on <Pay> called <Parameter> which lets you pass parameters to your action.
If your payment provider is Stripe and you want to send custom metadata, you can send a <Parameter> with a name prefaced as metadata_
and it will be added to the Stripe metadata that gets sent out in the webhook.
Here's an example:
<Pay paymentConnector="stripe">
<Parameter name="metadata_testKey" value="value" />
</Pay>
and now the object you receive in your webhook will have the following:
"metadata": {
"testKey": "value"
}
Tweet