Recover
...
API Reference
Recover Enterprise API
Payments
1 min
code examples curl location '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 } ] }'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));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 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) responses // request successful { "message" "request submitted for processing", "request id" "2c941653 b229 4528 b576 70fcfd388543 49645839701979566120793328447151049151317978254208401410 000000000000" }// request failed validation { "message" "invalid request body", "errors" \[ {} ] }// invalid api key { "message" "forbidden", "errors" "invalid api key" }// method/path not found { "message" "method/path combination not found " }// unsupported media type { "message" "unsupported media type", "errors" "content type must be application/json" }// server error