End of Dunning
1 min
POST
https://api.<merchant-url>.com/webhooks/end-of-dunning
Header Parameters
- X-Butter-Webhook-Typestring
- X-Butter-Webhook-ExpirationintegerDescriptionDefault1698251668
- X-Butter-Webhook-Signaturestring<hmac>DescriptionDefault06cf8a25ef73841fea0b20f13499f173e7767da53cccba2412b261816515f30d
- X-Butter-Webhook-Deduplication-IDstring<md5>DescriptionDefault47bce5c74f589f4867dbd57e9ca9f808
Body Parameters
- bodyend_of_dunningrequiredDescription
- timestamptimestampDescriptionDefault2023-10-25T03:57:26Z
- invoice_idstringDescriptionDefaultinv_12345
- recoveredbooleanDescriptionDefaulttrue
- customobjectExample
{ "brand": "DTC" }Description
Responses
200
- inline_response_200Description
- detailstringExampleDefaultEvent delivered successfully
500
- inline_response_500Description
- detailstringExampleDefaultServer is unavailable
curl
curl --request POST \
--url https://api.<merchant-url>.com/webhooks/end-of-dunning \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'x-butter-webhook-expiration: 1698251668' \
--header 'x-butter-webhook-signature: 06cf8a25ef73841fea0b20f13499f173e7767da53cccba2412b261816515f30d' \
--header 'x-butter-webhook-deduplication-id: 47bce5c74f589f4867dbd57e9ca9f808' \
--data '{
"timestamp": "2023-10-25T03:57:26Z",
"invoice_id": "inv_12345",
"recovered": true
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
myHeaders.append("x-butter-webhook-expiration", "1698251668");
myHeaders.append("x-butter-webhook-signature", "06cf8a25ef73841fea0b20f13499f173e7767da53cccba2412b261816515f30d");
myHeaders.append("x-butter-webhook-deduplication-id", "47bce5c74f589f4867dbd57e9ca9f808");
var raw = JSON.stringify({
"timestamp": "2023-10-25T03:57:26Z",
"invoice_id": "inv_12345",
"recovered": true
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.<merchant-url>.com/webhooks/end-of-dunning", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.<merchant-url>.com/webhooks/end-of-dunning")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request["x-butter-webhook-expiration"] = "1698251668"
request["x-butter-webhook-signature"] = "06cf8a25ef73841fea0b20f13499f173e7767da53cccba2412b261816515f30d"
request["x-butter-webhook-deduplication-id"] = "47bce5c74f589f4867dbd57e9ca9f808"
request.body = JSON.dump({
"timestamp": "2023-10-25T03:57:26Z",
"invoice_id": "inv_12345",
"recovered": true
})
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.<merchant-url>.com/webhooks/end-of-dunning"
payload = json.dumps({
"timestamp": "2023-10-25T03:57:26Z",
"invoice_id": "inv_12345",
"recovered": True
})
headers = {
'accept': 'application/json',
'content-type': 'application/json',
'x-butter-webhook-expiration': '1698251668',
'x-butter-webhook-signature': '06cf8a25ef73841fea0b20f13499f173e7767da53cccba2412b261816515f30d',
'x-butter-webhook-deduplication-id': '47bce5c74f589f4867dbd57e9ca9f808'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
200
// Event Delivered Successfully
{
"detail": "Event delivered successfully"
}500
// Event Not Delivered
{
"detail": "Server is unavailable"
}Butter will send webhooks via HTTP POST requests to this endpoint when dunning is complete and we will no longer make attempts to recover the payment. Butter guarantees 'at least once' delivery of events, and provides a deduplication ID to enable integrators to handle duplicate event delivery.
Note - The Butter webhook payload is a simple JSON object containing the attributes specified below. The payload does not contain a higher-level 'body' object that contains the other attributes.
Add field values in the boxes below to create an example payload on the right side of the screen.