Payments
1 min
POST
https://api.butterpayments.com/recover/payments
Body Parameters
- bodypaymentsrequired
- customercustomerrequired
- idstringrequiredExampleDescription
- psp_idstringExampleDescription
- created_attimestampExampleDescription
- postal_codepostal_codeExampleDescription
- subscriptionsubscriptionrequired
- idstringrequiredExampleDescription
- start_datetimestamprequiredExampleDescription
- end_datetimestampExampleDescription
- discounted_or_free_periodbooleanDescription
- product_idstringExampleDescription
- billingobject
- periodstring<day | week | month | year>ExampleDescription
- frequencyintegerExampleDescription
- invoiceinvoicerequired
- idstringrequiredExampleDescription
- created_attimestamprequiredExample
- transactionstransaction[]requiredDescription
- idstringrequiredExampleDescription
- psp_transaction_idstringrequiredExampleDescription
- network_transaction_idstringExampleDescription
- pspstring<adyen | braintree | recurly | recharge | stripe | worldpay>requiredExampleDescription
- midstringExampleDescription
- reporting_groupstringExampleDescription
- acquirer_countrystringrequiredExampleDescription
- amountnumberrequiredExampleDescription
- billing_postal_codepostal_codeExampleDescription
- authbooleanDescription
- binstringExampleDescription
- capturedbooleanDescription
- currencystringrequiredExampleDescription
- funding_sourcestring<CREDIT | DEBIT | MIXED | PAYPAL | PREPAID | UNCATEGORIZED | UNKNOWN>requiredExampleDescription
- issuer_countrystringExampleDescription
- outcomeobjectrequired
- raw_response_messagestringrequiredExampleDescription
- psp_response_messagestringExampleDescription
- processor_response_codenumberExampleDescription
- network_statusstringExampleDescription
- response_typestringExampleDescription
- payment_method_idstringrequiredDescription
- psp_transaction_created_attimestamprequiredExample
- refundedbooleanDescription
- schemestringrequiredExampleDescription
- successbooleanrequiredDescription
- descriptionstringDescription
- statement_descriptorstringExampleDescription
- enhanced_dataenhanced_dataDescription
- level_2level_2Description
- purchase_order_numberstringExampleDescription
- total_tax_amountstringExampleDescription
- total_discount_amountstringExampleDescription
- level_3level_3Description
- line_itemsobject[]Description
- customobjectDescription
Responses
200
- inline_response_200
- messagestringExampleDefaultRequest submitted for processing
- request_idstringExampleDefault2c941653-b229-4528-b576-70fcfd388543:49645839701979566120793328447151049151317978254208401410:000000000000
400
- inline_response_400
- messagestringExampleDefaultInvalid request body
- errorsobject[]Example
[ { "('subscription', 'start_date')": "Field required" } ]Default{"('subscription', 'start_date')":"Field required"}
403
- inline_response_403
- messagestringExampleDefaultForbidden
- errorsstringExampleDefaultInvalid API Key
404
- inline_response_404
- messagestringExampleDefaultMethod/Path combination not found.
415
- inline_response_415
- messagestringExampleDefaultUnsupported Media Type
- errorsstringExampleDefaultContent-Type must be application/json
500
curl
curl --request POST \
--url https://api.butterpayments.com/recover/payments \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"customer": {
"id": "11223344"
},
"subscription": {
"id": "sub_1234",
"start_date": "2023-10-25T03:57:26Z"
},
"invoice": {
"id": "inv_12345",
"created_at": "2023-10-25T03:57:26Z"
},
"transactions": [
{
"id": "ts_12345",
"psp_transaction_id": "ts_12345",
"psp": "Worldpay",
"acquirer_country": "US",
"amount": 12.23,
"currency": "USD",
"funding_source": "CREDIT",
"outcome": {
"raw_response_message": "insufficient_funds"
},
"payment_method_id": "",
"psp_transaction_created_at": "2023-10-25T03:57:26Z",
"scheme": "visa",
"success": false
}
]
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var raw = JSON.stringify({
"customer": {
"id": "11223344"
},
"subscription": {
"id": "sub_1234",
"start_date": "2023-10-25T03:57:26Z"
},
"invoice": {
"id": "inv_12345",
"created_at": "2023-10-25T03:57:26Z"
},
"transactions": [
{
"id": "ts_12345",
"psp_transaction_id": "ts_12345",
"psp": "Worldpay",
"acquirer_country": "US",
"amount": 12.23,
"currency": "USD",
"funding_source": "CREDIT",
"outcome": {
"raw_response_message": "insufficient_funds"
},
"payment_method_id": "",
"psp_transaction_created_at": "2023-10-25T03:57:26Z",
"scheme": "visa",
"success": false
}
]
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.butterpayments.com/recover/payments", 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.butterpayments.com/recover/payments")
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.body = JSON.dump({
"customer": {
"id": "11223344"
},
"subscription": {
"id": "sub_1234",
"start_date": "2023-10-25T03:57:26Z"
},
"invoice": {
"id": "inv_12345",
"created_at": "2023-10-25T03:57:26Z"
},
"transactions": [
{
"id": "ts_12345",
"psp_transaction_id": "ts_12345",
"psp": "Worldpay",
"acquirer_country": "US",
"amount": 12.23,
"currency": "USD",
"funding_source": "CREDIT",
"outcome": {
"raw_response_message": "insufficient_funds"
},
"payment_method_id": "",
"psp_transaction_created_at": "2023-10-25T03:57:26Z",
"scheme": "visa",
"success": false
}
]
})
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.butterpayments.com/recover/payments"
payload = json.dumps({
"customer": {
"id": "11223344"
},
"subscription": {
"id": "sub_1234",
"start_date": "2023-10-25T03:57:26Z"
},
"invoice": {
"id": "inv_12345",
"created_at": "2023-10-25T03:57:26Z"
},
"transactions": [
{
"id": "ts_12345",
"psp_transaction_id": "ts_12345",
"psp": "Worldpay",
"acquirer_country": "US",
"amount": 12.23,
"currency": "USD",
"funding_source": "CREDIT",
"outcome": {
"raw_response_message": "insufficient_funds"
},
"payment_method_id": "",
"psp_transaction_created_at": "2023-10-25T03:57:26Z",
"scheme": "visa",
"success": False
}
]
})
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
200
// Request Successful
{
"message": "Request submitted for processing",
"request_id": "2c941653-b229-4528-b576-70fcfd388543:49645839701979566120793328447151049151317978254208401410:000000000000"
}400
// Request Failed Validation
{
"message": "Invalid request body",
"errors": [
{}
]
}403
// Invalid API Key
{
"message": "Forbidden",
"errors": "Invalid API Key"
}404
// Method/Path Not Found
{
"message": "Method/Path combination not found."
}415
// Unsupported Media Type
{
"message": "Unsupported Media Type",
"errors": "Content-Type must be application/json"
}500
// Server Error
This endpoint serves as the entry point into Recover for all transaction events related to payment processing, including successful payments, failed payments, and Butter retry events. All transaction events, besides disputes, should be sent by the merchant to this endpoint.
Expand the objects below and add field values to create an example payload on the right side of the screen.