Retry Results
1 min
POST
https://api.<merchant-url>.com/webhooks/retry-results
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
- bodyretry_resultDescription
- timestamptimestampDescriptionDefault2023-10-25T03:57:26Z
- butter_idstringDescriptionDefault911536259375759362
- customer_idstringDescriptionDefaultcust_12345
- subscription_idstringDescriptionDefaultsub_12345
- invoice_idstringDescriptionDefaultinv_12345
- transaction_idstringDescriptionDefaultts_12345
- original_psp_transaction_idstringDescriptionDefault9472768581
- psp_transactionspsp_transaction[]Description
- psp_transaction_idstringExampleDescriptionDefault6386243129177352
- network_transaction_idstringExampleDescriptionDefaultQKSX6RP250903
- merchant_payment_method_idstringExampleDescriptionDefaultpm_12566742
- successbooleanExampleDescriptionDefaulttrue
- original_amountnumberDescriptionDefault49.99
- amount_collectednumberDescriptionDefault49.99
- currencystringDescriptionDefaultUSD
- successbooleanDescriptionDefaulttrue
- 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/retry-results \
--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",
"butter_id": "911536259375759362",
"customer_id": "cust_12345",
"subscription_id": "sub_12345",
"invoice_id": "inv_12345",
"transaction_id": "ts_12345",
"original_psp_transaction_id": "9472768581",
"psp_transactions": [
{
"psp_transaction_id": "6386243129177352",
"network_transaction_id": "QKSX6RP250903",
"merchant_payment_method_id": "pm_12566742",
"success": true
}
],
"original_amount": 49.99,
"amount_collected": 49.99,
"currency": "USD",
"success": 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",
"butter_id": "911536259375759362",
"customer_id": "cust_12345",
"subscription_id": "sub_12345",
"invoice_id": "inv_12345",
"transaction_id": "ts_12345",
"original_psp_transaction_id": "9472768581",
"psp_transactions": [
{
"psp_transaction_id": "6386243129177352",
"network_transaction_id": "QKSX6RP250903",
"merchant_payment_method_id": "pm_12566742",
"success": true
}
],
"original_amount": 49.99,
"amount_collected": 49.99,
"currency": "USD",
"success": true
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.<merchant-url>.com/webhooks/retry-results", 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/retry-results")
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",
"butter_id": "911536259375759362",
"customer_id": "cust_12345",
"subscription_id": "sub_12345",
"invoice_id": "inv_12345",
"transaction_id": "ts_12345",
"original_psp_transaction_id": "9472768581",
"psp_transactions": [
{
"psp_transaction_id": "6386243129177352",
"network_transaction_id": "QKSX6RP250903",
"merchant_payment_method_id": "pm_12566742",
"success": true
}
],
"original_amount": 49.99,
"amount_collected": 49.99,
"currency": "USD",
"success": true
})
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.<merchant-url>.com/webhooks/retry-results"
payload = json.dumps({
"timestamp": "2023-10-25T03:57:26Z",
"butter_id": "911536259375759362",
"customer_id": "cust_12345",
"subscription_id": "sub_12345",
"invoice_id": "inv_12345",
"transaction_id": "ts_12345",
"original_psp_transaction_id": "9472768581",
"psp_transactions": [
{
"psp_transaction_id": "6386243129177352",
"network_transaction_id": "QKSX6RP250903",
"merchant_payment_method_id": "pm_12566742",
"success": True
}
],
"original_amount": 49.99,
"amount_collected": 49.99,
"currency": "USD",
"success": 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 each time we try to recover a payment with the results of our retry attempt. 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.