Backoffice
Last updated: 2026-03-26
Use the Peach Payments Backoffice integration guide to manage operations like refunds, reversals, captures, chargebacks, rebills, and credits. As a merchant, handle all transaction details to ensure a smooth experience for your team. Go the backoffice payment landscape with confidence.
Initial payments via COPYandPAY or Server-to-Server enable backoffice operations.
Reversal
The merchant voids the entire open amount of a preauthorisation. The preauthorisation expires after some days, depending on the payment method, unless already captured or, cancelled.
Reasons for cancelling a pre-authorised payment before settlement
- Duplicate transactions: Errors in payment or delivery information, or delays in finalising the purchase.
- Customer change of mind: The customer decides to cancel the transaction.
- Product unavailability: The purchased product or service is no longer available.
1. Pre-authorise payment
Start a server-to-server POST request with the required payment data. The issuer verifies the payment details and reserves the funds. A successful request returns an ID, which you should store and use to reverse the preauthorisation.
curl https://sandbox-card.peachpayments.com/v1/payments \
-d "entityId=8a8294174e735d0c014e78cf26461790" \
-d "amount=92.00" \
-d "currency=EUR" \
-d "paymentBrand=VISA" \
-d "paymentType=PA" \
-d "card.number=4200000000000000" \
-d "card.holder=Jane Jones" \
-d "card.expiryMonth=05" \
-d "card.expiryYear=2034" \
-d "card.cvv=123" \
-H "Authorization: Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ="public Dictionary<string, dynamic> Request() {
Dictionary<string, dynamic> responseData;
string data = "entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"¤cy=EUR" +
"&paymentBrand=VISA" +
"&paymentType=PA" +
"&card.number=4200000000000000" +
"&card.holder=Jane Jones" +
"&card.expiryMonth=05" +
"&card.expiryYear=2034" +
"&card.cvv=123";
string url = "https://sandbox-card.peachpayments.com/v1/payments";
byte[] buffer = Encoding.ASCII.GetBytes(data);
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
request.Method = "POST";
request.Headers["Authorization"] = "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=";
request.ContentType = "application/x-www-form-urlencoded";
Stream PostData = request.GetRequestStream();
PostData.Write(buffer, 0, buffer.Length);
PostData.Close();
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) {
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
var s = new JavaScriptSerializer();
responseData = s.Deserialize<Dictionary<string, dynamic>>(reader.ReadToEnd());
reader.Close();
dataStream.Close();
}
return responseData;
}
responseData = Request()["result"]["description"];import groovy.json.JsonSlurper
public static String request() {
def data = "entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"¤cy=EUR" +
"&paymentBrand=VISA" +
"&paymentType=PA" +
"&card.number=4200000000000000" +
"&card.holder=Jane Jones" +
"&card.expiryMonth=05" +
"&card.expiryYear=2034" +
"&card.cvv=123"
def url = "https://sandbox-card.peachpayments.com/v1/payments".toURL()
def connection = url.openConnection()
connection.setRequestMethod("POST")
connection.setRequestProperty("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
connection.doOutput = true
connection.outputStream << data
def json = new JsonSlurper().parseText(connection.inputStream.text)
json
}
println request()private String request() throws IOException {
URL url = new URL("https://sandbox-card.peachpayments.com/v1/payments");
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=");
conn.setDoInput(true);
conn.setDoOutput(true);
String data = ""
+ "entityId=8a8294174e735d0c014e78cf26461790"
+ "&amount=92.00"
+ "¤cy=EUR"
+ "&paymentBrand=VISA"
+ "&paymentType=PA"
+ "&card.number=4200000000000000"
+ "&card.holder=Jane Jones"
+ "&card.expiryMonth=05"
+ "&card.expiryYear=2034"
+ "&card.cvv=123";
DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
wr.writeBytes(data);
wr.flush();
wr.close();
int responseCode = conn.getResponseCode();
InputStream is = (responseCode >= 400) ? conn.getErrorStream() : conn.getInputStream();
return IOUtils.toString(is);
}const https = require('https');
const querystring = require('querystring');
const request = async () => {
const path = '/v1/payments';
const data = querystring.stringify({
'entityId': '8a8294174e735d0c014e78cf26461790',
'amount': '92.00',
'currency': 'EUR',
'paymentBrand': 'VISA',
'paymentType': 'PA',
'card.number': '4200000000000000',
'card.holder': 'Jane Jones',
'card.expiryMonth': '05',
'card.expiryYear': '2034',
'card.cvv': '123'
});
const options = {
port: 443,
host: 'sandbox-card.peachpayments.com',
path: path,
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': data.length,
'Authorization': 'Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ='
}
};
return new Promise((resolve, reject) => {
const postRequest = https.request(options, function (res) {
const buf = [];
res.on('data', chunk => {
buf.push(Buffer.from(chunk));
});
res.on('end', () => {
const jsonString = Buffer.concat(buf).toString('utf8');
try {
resolve(JSON.parse(jsonString));
} catch (error) {
reject(error);
}
});
});
postRequest.on('error', reject);
postRequest.write(data);
postRequest.end();
});
};
request().then(console.log).catch(console.error);function request() {
$url = "https://sandbox-card.peachpayments.com/v1/payments";
$data = "entityId=8a8294174e735d0c014e78cf26461790" .
"&amount=92.00" .
"¤cy=EUR" .
"&paymentBrand=VISA" .
"&paymentType=PA" .
"&card.number=4200000000000000" .
"&card.holder=Jane Jones" .
"&card.expiryMonth=05" .
"&card.expiryYear=2034" .
"&card.cvv=123";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ='
));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // this should be set to true in production
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$responseData = curl_exec($ch);
if (curl_errno($ch)) {
return curl_error($ch);
}
curl_close($ch);
return $responseData;
}
$responseData = request();try:
from urllib.parse import urlencode
from urllib.request import build_opener, Request, HTTPHandler
from urllib.error import HTTPError, URLError
except ImportError:
from urllib import urlencode
from urllib2 import build_opener, Request, HTTPHandler, HTTPError, URLError
import json
def request():
url = "https://sandbox-card.peachpayments.com/v1/payments"
data = {
'entityId': '8a8294174e735d0c014e78cf26461790',
'amount': '92.00',
'currency': 'EUR',
'paymentBrand': 'VISA',
'paymentType': 'PA',
'card.number': '4200000000000000',
'card.holder': 'Jane Jones',
'card.expiryMonth': '05',
'card.expiryYear': '2034',
'card.cvv': '123'
}
try:
opener = build_opener(HTTPHandler)
request = Request(url, data=urlencode(data).encode('utf-8'))
request.add_header('Authorization', 'Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=')
request.get_method = lambda: 'POST'
response = opener.open(request)
return json.loads(response.read())
except HTTPError as e:
return json.loads(e.read())
except URLError as e:
return e.reason
responseData = request()
print(responseData)require 'net/https'
require 'uri'
require 'json'
def request()
uri = URI('https://sandbox-card.peachpayments.com/v1/payments')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Post.new(uri.path)
req.set_form_data({
'entityId' => '8a8294174e735d0c014e78cf26461790',
'amount' => '92.00',
'currency' => 'EUR',
'paymentBrand' => 'VISA',
'paymentType' => 'PA',
'card.number' => '4200000000000000',
'card.holder' => 'Jane Jones',
'card.expiryMonth' => '05',
'card.expiryYear' => '2034',
'card.cvv' => '123'
})
res = http.request(req)
return JSON.parse(res.body)
end
puts request()def initialPayment: String = {
val url = "https://sandbox-card.peachpayments.com/v1/payments"
val data = ("" +
"entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"¤cy=EUR" +
"&paymentBrand=VISA" +
"&paymentType=PA" +
"&card.number=4200000000000000" +
"&card.holder=Jane Jones" +
"&card.expiryMonth=05" +
"&card.expiryYear=2034" +
"&card.cvv=123"
)
val conn = new URL(url).openConnection()
conn match {
case secureConn: HttpsURLConnection => secureConn.setRequestMethod("POST")
case _ => throw new ClassCastException
}
conn.setDoInput(true)
conn.setDoOutput(true)
IOUtils.write(data, conn.getOutputStream())
conn.setRequestProperty("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
conn.connect()
if (conn.getResponseCode() >= 400) {
IOUtils.toString(conn.getErrorStream())
} else {
IOUtils.toString(conn.getInputStream())
}
}Public Function Request() As Dictionary(Of String, Object)
Dim url As String = "https://sandbox-card.peachpayments.com/v1/payments"
Dim data As String = "" +
"entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"¤cy=EUR" +
"&paymentBrand=VISA" +
"&paymentType=DB" +
"&card.number=4200000000000000" +
"&card.holder=Jane Jones" +
"&card.expiryMonth=05" +
"&card.expiryYear=2034" +
"&card.cvv=123"
Dim req As WebRequest = WebRequest.Create(url)
req.Method = "POST"
req.Headers.Add("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
req.ContentType = "application/x-www-form-urlencoded"
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(data)
req.ContentLength = byteArray.Length
Dim dataStream As Stream = req.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length)
dataStream.Close()
Dim res As WebResponse = req.GetResponse()
Dim resStream = res.GetResponseStream()
Dim reader As New StreamReader(resStream)
Dim response As String = reader.ReadToEnd()
reader.Close()
resStream.Close()
res.Close()
Dim jss As New System.Web.Script.Serialization.JavaScriptSerializer()
Dim dict As Dictionary(Of String, Object) = jss.Deserialize(Of Dictionary(Of String, Object))(response)
Return dict
End Function
responseData = Request()("result")("description"){
"id":"8ac7a4a29d29b86a019d29ec6a6856d3",
"paymentType":"PA",
"paymentBrand":"VISA",
"amount":"92.00",
"currency":"EUR",
"descriptor":"2279.4613.7636 MAC_Channel ",
"result":{
"code":"000.100.110",
"description":"Request successfully processed in 'Merchant in Integrator Test Mode'"
},
"resultDetails":{
"Payment Status":"CLO",
"ConnectorTxID1":"payment_55cd30eb3b5a499b3a3a2f5b6cf3f11a",
"Cvv Check":"unchecked",
"Transaction Status":"SUCCESS",
"ConnectorTxID3":"123456",
"Amount":"0.0",
"Operation Id":"64403c94-0978-4d5f-abd7-28a4e5d99556",
"Payment Method Category":"card",
"CardholderInitiatedTransactionID":"123456",
"ExtendedDescription":"Transaction succeeded",
"Customer Token":"cus_4d184daa989cac82224b856bac739b60",
"Paid Amount":"0.0",
"Payment Account Reference":"V001NPX3IQC6OFS2TAWCVD2WTXRWY",
"Sender Details":"{\"address\":\"null\",\"firstName\":\"null\",\"lastName\":\"null\",\"postcode\":\"null\",\"city\":\"AE\",\"state\":\"null\",\"country\":\"null\",\"companyName\":\"null\"}",
"AcquirerResponse":"SUCCESS",
"Beneficiary Details":"{\"firstName\":\"null\",\"lastName\":\"null\",\"address\":\"null\",\"dob\":\"null\",\"gender\":\"null\",\"email\":\"null\",\"state\":\"null\",\"cardNumber\":\"null\",\"cardExpirationMonth\":\"null\",\"cardExpirationYear\":\"null\",\"nationality\":\"null\",\"city\":\"NY\",\"postcode\":\"null\",\"identificationType\":\"null\",\"identificationValue\":\"null\"\"category\":\"null\"}",
"Statement Descriptor":"044153838562 Rapyd Nat"
},
"card":{
"bin":"420000",
"last4Digits":"0000",
"holder":"Jane Jones",
"expiryMonth":"05",
"expiryYear":"2034"
},
"customParameters":{
"PAYMENT_INHOUSE_FACADE":"true"
},
"risk":{
"score":"100"
},
"buildNumber":"9092e7a6af8301accda2f9a3a38f743f907dadd5@2026-03-23 16:50:06 +0000",
"timestamp":"2026-03-26 11:34:12+0000",
"ndc":"8a8294174e735d0c014e78cf26461790_ad9a0cf69878444498a051361beab571"
}2. Reverse the payment
Send a server-to-server POST request over the pre-authorised payment. Cancel the payment when the system authorises it but capture is not required, such as when an item is out of stock. The reserved funds return to the customer's account.
Sample request:
https://sandbox-card.peachpayments.com/v1/payments/8ac7a4a29d29b86a019d29ec6a6856d3
curl https://sandbox-card.peachpayments.com/v1/payments/{id} \
-d "entityId=8a8294174e735d0c014e78cf26461790" \
-d "amount=92.00" \
-d "paymentType=RV" \
-d "currency=EUR" \
-H "Authorization: Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ="public Dictionary<string, dynamic> Request() {
Dictionary<string, dynamic> responseData;
string data = "entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"&paymentType=RV" +
"¤cy=EUR";
string url = "https://sandbox-card.peachpayments.com/v1/payments/{id}";
byte[] buffer = Encoding.ASCII.GetBytes(data);
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
request.Method = "POST";
request.Headers["Authorization"] = "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=";
request.ContentType = "application/x-www-form-urlencoded";
Stream PostData = request.GetRequestStream();
PostData.Write(buffer, 0, buffer.Length);
PostData.Close();
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) {
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
var s = new JavaScriptSerializer();
responseData = s.Deserialize<Dictionary<string, dynamic>>(reader.ReadToEnd());
reader.Close();
dataStream.Close();
}
return responseData;
}
responseData = Request()["result"]["description"];import groovy.json.JsonSlurper
public static String request() {
def data = "entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"&paymentType=RV" +
"¤cy=EUR"
def url = "https://sandbox-card.peachpayments.com/v1/payments/{id}".toURL()
def connection = url.openConnection()
connection.setRequestMethod("POST")
connection.setRequestProperty("Authorization","Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
connection.doOutput = true
connection.outputStream << data
def json = new JsonSlurper().parseText(connection.inputStream.text)
json
}
println request()private String request() throws IOException {
URL url = new URL("https://sandbox-card.peachpayments.com/v1/payments/{id}");
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=");
conn.setDoInput(true);
conn.setDoOutput(true);
String data = ""
+ "entityId=8a8294174e735d0c014e78cf26461790"
+ "&amount=92.00"
+ "&paymentType=RV"
+ "¤cy=EUR";
DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
wr.writeBytes(data);
wr.flush();
wr.close();
int responseCode = conn.getResponseCode();
InputStream is;
if (responseCode >= 400) is = conn.getErrorStream();
else is = conn.getInputStream();
return IOUtils.toString(is);
}const https = require('https');
const querystring = require('querystring');
const request = async () => {
const path = '/v1/payments/{id}';
const data = querystring.stringify({
'entityId': '8a8294174e735d0c014e78cf26461790',
'amount': '92.00',
'paymentType': 'RV',
'currency': 'EUR'
});
const options = {
port: 443,
host: 'sandbox-card.peachpayments.com',
path: path,
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': data.length,
'Authorization': 'Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ='
}
};
return new Promise((resolve, reject) => {
const postRequest = https.request(options, function (res) {
const buf = [];
res.on('data', chunk => {
buf.push(Buffer.from(chunk));
});
res.on('end', () => {
const jsonString = Buffer.concat(buf).toString('utf8');
try {
resolve(JSON.parse(jsonString));
} catch (error) {
reject(error);
}
});
});
postRequest.on('error', reject);
postRequest.write(data);
postRequest.end();
});
};
request().then(console.log).catch(console.error);function request() {
$url = "https://sandbox-card.peachpayments.com/v1/payments/{id}";
$data = "entityId=8a8294174e735d0c014e78cf26461790" .
"&amount=92.00" .
"&paymentType=RV" .
"¤cy=EUR";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization:Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ='));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // this should be set to true in production
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$responseData = curl_exec($ch);
if (curl_errno($ch)) {
return curl_error($ch);
}
curl_close($ch);
return $responseData;
}
$responseData = request();try:
from urllib.parse import urlencode
from urllib.request import build_opener, Request, HTTPHandler
from urllib.error import HTTPError, URLError
except ImportError:
from urllib import urlencode
from urllib2 import build_opener, Request, HTTPHandler, HTTPError, URLError
import json
def request():
url = "https://sandbox-card.peachpayments.com/v1/payments/{id}"
data = {
'entityId': '8a8294174e735d0c014e78cf26461790',
'amount': '92.00',
'paymentType': 'RV',
'currency': 'EUR'
}
try:
opener = build_opener(HTTPHandler)
request = Request(url, data=urlencode(data).encode('utf-8'))
request.add_header('Authorization', 'Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=')
request.get_method = lambda: 'POST'
response = opener.open(request)
return json.loads(response.read())
except HTTPError as e:
return json.loads(e.read())
except URLError as e:
return e.reason
responseData = request()
print(responseData)require 'net/https'
require 'uri'
require 'json'
def request()
uri = URI('https://sandbox-card.peachpayments.com/v1/payments/{id}')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Post.new(uri.path)
req.set_form_data({
'entityId' => '8a8294174e735d0c014e78cf26461790',
'amount' => '92.00',
'paymentType' => 'RV',
'currency' => 'EUR'
})
res = http.request(req)
return JSON.parse(res.body)
end
puts request()def initialPayment: String = {
val url = "https://sandbox-card.peachpayments.com/v1/payments/{id}"
val data = ("" +
"entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"&paymentType=RV" +
"¤cy=EUR"
)
val conn = new URL(url).openConnection()
conn match {
case secureConn: HttpsURLConnection => secureConn.setRequestMethod("POST")
case _ => throw new ClassCastException
}
conn.setDoInput(true)
conn.setDoOutput(true)
IOUtils.write(data, conn.getOutputStream())
conn.setRequestProperty("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
conn.connect()
if (conn.getResponseCode() >= 400) {
return IOUtils.toString(conn.getErrorStream())
} else {
return IOUtils.toString(conn.getInputStream())
}
}Public Function Request() As Dictionary(Of String, Object)
Dim url As String = "https://sandbox-card.peachpayments.com/v1/payments/{id}"
Dim data As String = "" +
"entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"&paymentType=RV" +
"¤cy=EUR"
Dim req As WebRequest = WebRequest.Create(url)
req.Method = "POST"
req.Headers.Add("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
req.ContentType = "application/x-www-form-urlencoded"
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(data)
req.ContentLength = byteArray.Length
Dim dataStream As Stream = req.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length)
dataStream.Close()
Dim res As WebResponse = req.GetResponse()
Dim resStream = res.GetResponseStream()
Dim reader As New StreamReader(resStream)
Dim response As String = reader.ReadToEnd()
reader.Close()
resStream.Close()
res.Close()
Dim jss As New System.Web.Script.Serialization.JavaScriptSerializer()
Dim dict As Dictionary(Of String, Object) = jss.Deserialize(Of Dictionary(Of String, Object))(response)
Return dict
End Function
responseData = Request()("result")("description"){
"id": "8ac7a4a29d2fe001019d388643403d45",
"referencedId": "8ac7a4a19d2fd573019d38857d5e51cb",
"paymentType": "RV",
"amount": "92.00",
"currency": "EUR",
"descriptor": "2279.4613.7636 MAC_Channel ",
"result": {
"code": "000.100.110",
"description": "Request successfully processed in 'Merchant in Integrator Test Mode'"
},
"resultDetails": {
"ExtendedDescription": "Transaction Successful",
"PIM.Response.Code:": "E0000",
"Acquirer.Response.Code:": "00",
"ConnectorTxID1": "236270216932|||||||||",
"ConnectorTxID3": "160080",
"PIM.Response.Details:": "Success",
"ConnectorTxID2": "|000|||||",
"ActionCode": "000",
"StatusDetails": "Success",
"AcquirerResponse": "E0000",
"AcquirerInstitutionIdentCode": "00000000001"
},
"customParameters": {
"PAYMENT_INHOUSE_FACADE": "true"
},
"risk": {
"score": "0"
},
"buildNumber": "2a7cf1d3d14ccb52500fbcb1ceb7ff4a15b6843b@2026-03-27 00:42:41 +0000",
"timestamp": "2026-03-29 07:36:56+0000",
"ndc": "8ac7a4c990c8eb2c0190ceb279f60277_b4cd30ba6622484896587c2a87069192"
}Capture
The merchant captures the full or partial amount of an authorised payment for settlement.
Reasons for capturing a transaction after preauthorisation
- Product availability: The product or service that the customer ordered is available and ready for delivery.
- Order fulfilment: The order is ready for shipment or provision to the customer.
- Customer confirmation: The customer confirms their order details and agrees to the terms of the sale.
- Fraud checks: The team completes all necessary fraud checks, and the system deems the transaction legitimate.
1. Pre-authorise payment
Send a server-to-server POST request with the required payment data. The system verifies the payment details with the issuer and moves the funds. A successful request returns an ID that you should save and use to capture the full or partial amount.
curl https://sandbox-card.peachpayments.com/v1/payments \
-d "entityId=8a8294174e735d0c014e78cf26461790" \
-d "amount=92.00" \
-d "currency=EUR" \
-d "paymentBrand=VISA" \
-d "paymentType=PA" \
-d "card.number=4200000000000000" \
-d "card.holder=Jane Jones" \
-d "card.expiryMonth=05" \
-d "card.expiryYear=2034" \
-d "card.cvv=123" \
-H "Authorization: Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ="public Dictionary<string, dynamic> Request() {
Dictionary<string, dynamic> responseData;
string data = "entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"¤cy=EUR" +
"&paymentBrand=VISA" +
"&paymentType=PA" +
"&card.number=4200000000000000" +
"&card.holder=Jane Jones" +
"&card.expiryMonth=05" +
"&card.expiryYear=2034" +
"&card.cvv=123";
string url = "https://sandbox-card.peachpayments.com/v1/payments";
byte[] buffer = Encoding.ASCII.GetBytes(data);
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
request.Method = "POST";
request.Headers["Authorization"] = "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=";
request.ContentType = "application/x-www-form-urlencoded";
Stream postData = request.GetRequestStream();
postData.Write(buffer, 0, buffer.Length);
postData.Close();
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) {
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
var s = new JavaScriptSerializer();
responseData = s.Deserialize<Dictionary<string, dynamic>>(reader.ReadToEnd());
reader.Close();
dataStream.Close();
}
return responseData;
}
responseData = Request()["result"]["description"];import groovy.json.JsonSlurper
public static String request() {
def data = "entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"¤cy=EUR" +
"&paymentBrand=VISA" +
"&paymentType=PA" +
"&card.number=4200000000000000" +
"&card.holder=Jane Jones" +
"&card.expiryMonth=05" +
"&card.expiryYear=2034" +
"&card.cvv=123"
def url = "https://sandbox-card.peachpayments.com/v1/payments".toURL()
def connection = url.openConnection()
connection.setRequestMethod("POST")
connection.setRequestProperty("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
connection.doOutput = true
connection.outputStream << data
def json = new JsonSlurper().parseText(connection.inputStream.text)
json
}
println request()private String request() throws IOException {
URL url = new URL("https://sandbox-card.peachpayments.com/v1/payments");
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=");
conn.setDoInput(true);
conn.setDoOutput(true);
String data = ""
+ "entityId=8a8294174e735d0c014e78cf26461790"
+ "&amount=92.00"
+ "¤cy=EUR"
+ "&paymentBrand=VISA"
+ "&paymentType=PA"
+ "&card.number=4200000000000000"
+ "&card.holder=Jane Jones"
+ "&card.expiryMonth=05"
+ "&card.expiryYear=2034"
+ "&card.cvv=123";
DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
wr.writeBytes(data);
wr.flush();
wr.close();
int responseCode = conn.getResponseCode();
InputStream is;
if (responseCode >= 400) is = conn.getErrorStream();
else is = conn.getInputStream();
return IOUtils.toString(is);
}const https = require('https');
const querystring = require('querystring');
const request = async () => {
const path = '/v1/payments';
const data = querystring.stringify({
'entityId': '8a8294174e735d0c014e78cf26461790',
'amount': '92.00',
'currency': 'EUR',
'paymentBrand': 'VISA',
'paymentType': 'PA',
'card.number': '4200000000000000',
'card.holder': 'Jane Jones',
'card.expiryMonth': '05',
'card.expiryYear': '2034',
'card.cvv': '123'
});
const options = {
port: 443,
host: 'sandbox-card.peachpayments.com',
path: path,
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': data.length,
'Authorization': 'Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ='
}
};
return new Promise((resolve, reject) => {
const postRequest = https.request(options, function (res) {
const buf = [];
res.on('data', chunk => {
buf.push(Buffer.from(chunk));
});
res.on('end', () => {
const jsonString = Buffer.concat(buf).toString('utf8');
try {
resolve(JSON.parse(jsonString));
} catch (error) {
reject(error);
}
});
});
postRequest.on('error', reject);
postRequest.write(data);
postRequest.end();
});
};
request().then(console.log).catch(console.error);function request() {
$url = "https://sandbox-card.peachpayments.com/v1/payments";
$data = "entityId=8a8294174e735d0c014e78cf26461790" .
"&amount=92.00" .
"¤cy=EUR" .
"&paymentBrand=VISA" .
"&paymentType=PA" .
"&card.number=4200000000000000" .
"&card.holder=Jane Jones" .
"&card.expiryMonth=05" .
"&card.expiryYear=2034" .
"&card.cvv=123";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ='
));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // this should be set to true in production
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$responseData = curl_exec($ch);
if (curl_errno($ch)) {
return curl_error($ch);
}
curl_close($ch);
return $responseData;
}
$responseData = request();try:
from urllib.parse import urlencode
from urllib.request import build_opener, Request, HTTPHandler
from urllib.error import HTTPError, URLError
except ImportError:
from urllib import urlencode
from urllib2 import build_opener, Request, HTTPHandler, HTTPError, URLError
import json
def request():
url = "https://sandbox-card.peachpayments.com/v1/payments"
data = {
'entityId': '8a8294174e735d0c014e78cf26461790',
'amount': '92.00',
'currency': 'EUR',
'paymentBrand': 'VISA',
'paymentType': 'PA',
'card.number': '4200000000000000',
'card.holder': 'Jane Jones',
'card.expiryMonth': '05',
'card.expiryYear': '2034',
'card.cvv': '123'
}
try:
opener = build_opener(HTTPHandler)
request = Request(url, data=urlencode(data).encode('utf-8'))
request.add_header('Authorization', 'Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=')
request.get_method = lambda: 'POST'
response = opener.open(request)
return json.loads(response.read())
except HTTPError as e:
return json.loads(e.read())
except URLError as e:
return e.reason
responseData = request()
print(responseData)require 'net/https'
require 'uri'
require 'json'
def request()
uri = URI('https://sandbox-card.peachpayments.com/v1/payments')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Post.new(uri.path)
req.set_form_data({
'entityId' => '8a8294174e735d0c014e78cf26461790',
'amount' => '92.00',
'currency' => 'EUR',
'paymentBrand' => 'VISA',
'paymentType' => 'PA',
'card.number' => '4200000000000000',
'card.holder' => 'Jane Jones',
'card.expiryMonth' => '05',
'card.expiryYear' => '2034',
'card.cvv' => '123'
})
res = http.request(req)
return JSON.parse(res.body)
end
puts request()def initialPayment: String = {
val url = "https://sandbox-card.peachpayments.com/v1/payments"
val data = (""
+ "entityId=8a8294174e735d0c014e78cf26461790"
+ "&amount=92.00"
+ "¤cy=EUR"
+ "&paymentBrand=VISA"
+ "&paymentType=PA"
+ "&card.number=4200000000000000"
+ "&card.holder=Jane Jones"
+ "&card.expiryMonth=05"
+ "&card.expiryYear=2034"
+ "&card.cvv=123"
)
val conn = new URL(url).openConnection()
conn match {
case secureConn: HttpsURLConnection => secureConn.setRequestMethod("POST")
case _ => throw new ClassCastException
}
conn.setDoInput(true)
conn.setDoOutput(true)
IOUtils.write(data, conn.getOutputStream())
conn.setRequestProperty("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
conn.connect()
if (conn.getResponseCode() >= 400) {
return IOUtils.toString(conn.getErrorStream())
} else {
return IOUtils.toString(conn.getInputStream())
}
}Public Function Request() As Dictionary(Of String, Object)
Dim url As String = "https://sandbox-card.peachpayments.com/v1/payments"
Dim data As String = "" +
"entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"¤cy=EUR" +
"&paymentBrand=VISA" +
"&paymentType=PA" +
"&card.number=4200000000000000" +
"&card.holder=Jane Jones" +
"&card.expiryMonth=05" +
"&card.expiryYear=2034" +
"&card.cvv=123"
Dim req As WebRequest = WebRequest.Create(url)
req.Method = "POST"
req.Headers.Add("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
req.ContentType = "application/x-www-form-urlencoded"
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(data)
req.ContentLength = byteArray.Length
Dim dataStream As Stream = req.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length)
dataStream.Close()
Dim res As WebResponse = req.GetResponse()
Dim resStream = res.GetResponseStream()
Dim reader As New StreamReader(resStream)
Dim response As String = reader.ReadToEnd()
reader.Close()
resStream.Close()
res.Close()
Dim jss As New System.Web.Script.Serialization.JavaScriptSerializer()
Dim dict As Dictionary(Of String, Object) = jss.Deserialize(Of Dictionary(Of String, Object))(response)
Return dict
End Function
responseData = Request()("result")("description"){
"id":"8ac7a4a29d29b86a019d29ef7de06552",
"paymentType":"PA",
"paymentBrand":"VISA",
"amount":"92.00",
"currency":"EUR",
"descriptor":"9650.7080.0932 MAC_Channel ",
"result":{
"code":"000.100.110",
"description":"Request successfully processed in 'Merchant in Integrator Test Mode'"
},
"resultDetails":{
"Payment Status":"CLO",
"ConnectorTxID1":"payment_55cd30eb3b5a499b3a3a2f5b6cf3f11a",
"Cvv Check":"unchecked",
"Transaction Status":"SUCCESS",
"ConnectorTxID3":"123456",
"Amount":"0.0",
"Operation Id":"64403c94-0978-4d5f-abd7-28a4e5d99556",
"Payment Method Category":"card",
"CardholderInitiatedTransactionID":"123456",
"ExtendedDescription":"Transaction succeeded",
"Customer Token":"cus_4d184daa989cac82224b856bac739b60",
"Paid Amount":"0.0",
"Payment Account Reference":"V001NPX3IQC6OFS2TAWCVD2WTXRWY",
"Sender Details":"{\"address\":\"null\",\"firstName\":\"null\",\"lastName\":\"null\",\"postcode\":\"null\",\"city\":\"AE\",\"state\":\"null\",\"country\":\"null\",\"companyName\":\"null\"}",
"AcquirerResponse":"SUCCESS",
"Beneficiary Details":"{\"firstName\":\"null\",\"lastName\":\"null\",\"address\":\"null\",\"dob\":\"null\",\"gender\":\"null\",\"email\":\"null\",\"state\":\"null\",\"cardNumber\":\"null\",\"cardExpirationMonth\":\"null\",\"cardExpirationYear\":\"null\",\"nationality\":\"null\",\"city\":\"NY\",\"postcode\":\"null\",\"identificationType\":\"null\",\"identificationValue\":\"null\"\"category\":\"null\"}",
"Statement Descriptor":"044153838562 Rapyd Nat"
},
"card":{
"bin":"420000",
"last4Digits":"0000",
"holder":"Jane Jones",
"expiryMonth":"05",
"expiryYear":"2034"
},
"customParameters":{
"PAYMENT_INHOUSE_FACADE":"true"
},
"risk":{
"score":"100"
},
"buildNumber":"9092e7a6af8301accda2f9a3a38f743f907dadd5@2026-03-23 16:50:06 +0000",
"timestamp":"2026-03-26 11:37:34+0000",
"ndc":"8a8294174e735d0c014e78cf26461790_bc2632e44b9f4c44b9230fdaaffadca6"
}2. Capture the payment
Send a server-to-server POST request over the authorised payment, which is the original transaction that needs capture. The system finalises the authorised amount and transfers money from the customer to the merchant. The capture process typically occurs straight away after the authorisation but can vary depending on the payment method.
Sample request:
curl https://sandbox-card.peachpayments.com/v1/payments/{id} \
-d "entityId=8a8294174e735d0c014e78cf26461790" \
-d "amount=92.00" \
-d "paymentType=CP" \
-d "currency=EUR" \
-H "Authorization: Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ="public Dictionary<string, dynamic> Request() {
Dictionary<string, dynamic> responseData;
string data = "entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"&paymentType=CP" +
"¤cy=EUR";
string url = "https://sandbox-card.peachpayments.com/v1/payments/{id}";
byte[] buffer = Encoding.ASCII.GetBytes(data);
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
request.Method = "POST";
request.Headers["Authorization"] = "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=";
request.ContentType = "application/x-www-form-urlencoded";
Stream PostData = request.GetRequestStream();
PostData.Write(buffer, 0, buffer.Length);
PostData.Close();
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) {
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
var s = new JavaScriptSerializer();
responseData = s.Deserialize<Dictionary<string, dynamic>>(reader.ReadToEnd());
reader.Close();
dataStream.Close();
}
return responseData;
}
responseData = Request()["result"]["description"];import groovy.json.JsonSlurper
public static String request() {
def data = "entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"&paymentType=CP" +
"¤cy=EUR"
def url = "https://sandbox-card.peachpayments.com/v1/payments/{id}".toURL()
def connection = url.openConnection()
connection.setRequestMethod("POST")
connection.setRequestProperty("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
connection.doOutput = true
connection.outputStream << data
def json = new JsonSlurper().parseText(connection.inputStream.text)
json
}
println request()private String request() throws IOException {
URL url = new URL("https://sandbox-card.peachpayments.com/v1/payments/{id}");
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=");
conn.setDoInput(true);
conn.setDoOutput(true);
String data = ""
+ "entityId=8a8294174e735d0c014e78cf26461790"
+ "&amount=92.00"
+ "&paymentType=CP"
+ "¤cy=EUR";
DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
wr.writeBytes(data);
wr.flush();
wr.close();
int responseCode = conn.getResponseCode();
InputStream is;
if (responseCode >= 400) {
is = conn.getErrorStream();
} else {
is = conn.getInputStream();
}
return IOUtils.toString(is);
}const https = require('https');
const querystring = require('querystring');
const request = async () => {
const path = '/v1/payments/{id}';
const data = querystring.stringify({
'entityId': '8a8294174e735d0c014e78cf26461790',
'amount': '92.00',
'paymentType': 'CP',
'currency': 'EUR'
});
const options = {
port: 443,
host: 'sandbox-card.peachpayments.com',
path: path,
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': data.length,
'Authorization': 'Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ='
}
};
return new Promise((resolve, reject) => {
const postRequest = https.request(options, function(res) {
const buf = [];
res.on('data', chunk => {
buf.push(Buffer.from(chunk));
});
res.on('end', () => {
const jsonString = Buffer.concat(buf).toString('utf8');
try {
resolve(JSON.parse(jsonString));
} catch (error) {
reject(error);
}
});
});
postRequest.on('error', reject);
postRequest.write(data);
postRequest.end();
});
};
request().then(console.log).catch(console.error);function request() {
$url = "https://sandbox-card.peachpayments.com/v1/payments/{id}";
$data = "entityId=8a8294174e735d0c014e78cf26461790" .
"&amount=92.00" .
"&paymentType=CP" .
"¤cy=EUR";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ='
));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // this should be set to true in production
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$responseData = curl_exec($ch);
if (curl_errno($ch)) {
return curl_error($ch);
}
curl_close($ch);
return $responseData;
}
$responseData = request();try:
from urllib.parse import urlencode
from urllib.request import build_opener, Request, HTTPHandler
from urllib.error import HTTPError, URLError
except ImportError:
from urllib import urlencode
from urllib2 import build_opener, Request, HTTPHandler, HTTPError, URLError
import json
def request():
url = "https://sandbox-card.peachpayments.com/v1/payments/{id}"
data = {
'entityId': '8a8294174e735d0c014e78cf26461790',
'amount': '92.00',
'paymentType': 'CP',
'currency': 'EUR'
}
try:
opener = build_opener(HTTPHandler)
request = Request(url, data=urlencode(data).encode('utf-8'))
request.add_header('Authorization', 'Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=')
request.get_method = lambda: 'POST'
response = opener.open(request)
return json.loads(response.read())
except HTTPError as e:
return json.loads(e.read())
except URLError as e:
return e.reason
responseData = request()
print(responseData)require 'net/https'
require 'uri'
require 'json'
def request()
uri = URI('https://sandbox-card.peachpayments.com/v1/payments/{id}')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Post.new(uri.path)
req.set_form_data({
'entityId' => '8a8294174e735d0c014e78cf26461790',
'amount' => '92.00',
'paymentType' => 'CP',
'currency' => 'EUR'
})
res = http.request(req)
return JSON.parse(res.body)
end
puts request()def initialPayment: String = {
val url = "https://sandbox-card.peachpayments.com/v1/payments/{id}"
val data = (
""
+ "entityId=8a8294174e735d0c014e78cf26461790"
+ "&amount=92.00"
+ "&paymentType=CP"
+ "¤cy=EUR"
)
val conn = new URL(url).openConnection()
conn match {
case secureConn: HttpsURLConnection => secureConn.setRequestMethod("POST")
case _ => throw new ClassCastException
}
conn.setDoInput(true)
conn.setDoOutput(true)
IOUtils.write(data, conn.getOutputStream())
conn.setRequestProperty("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
conn.connect()
if (conn.getResponseCode() >= 400) {
return IOUtils.toString(conn.getErrorStream())
} else {
return IOUtils.toString(conn.getInputStream())
}
}Public Function Request() As Dictionary(Of String, Object)
Dim url As String = "https://sandbox-card.peachpayments.com/v1/payments/{id}"
Dim data As String = "" +
"entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"&paymentType=CP" +
"¤cy=EUR"
Dim req As WebRequest = WebRequest.Create(url)
req.Method = "POST"
req.Headers.Add("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
req.ContentType = "application/x-www-form-urlencoded"
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(data)
req.ContentLength = byteArray.Length
Using dataStream As Stream = req.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length)
End Using
Dim res As WebResponse = req.GetResponse()
Using resStream As Stream = res.GetResponseStream()
Using reader As New StreamReader(resStream)
Dim response As String = reader.ReadToEnd()
Dim jss As New System.Web.Script.Serialization.JavaScriptSerializer()
Dim dict As Dictionary(Of String, Object) = jss.Deserialize(Of Dictionary(Of String, Object))(response)
Return dict
End Using
End Using
End Function
Dim responseData = Request()("result")("description"){
"id":"8ac7a4a09d29b6e0019d29f026b36510",
"referencedId":"8ac7a4a29d29b86a019d29ef7de06552",
"paymentType":"CP",
"amount":"92.00",
"currency":"EUR",
"descriptor":"7848.1429.5076 MAC_Channel",
"result":{
"code":"000.100.110",
"description":"Request successfully processed in 'Merchant in Integrator Test Mode'"
},
"resultDetails":{
"Payment Status":"CLO",
"ConnectorTxID1":"payment_55cd30eb3b5a499b3a3a2f5b6cf3f11a",
"Cvv Check":"unchecked",
"Transaction Status":"SUCCESS",
"ConnectorTxID3":"123456",
"Amount":"0.0",
"Operation Id":"64403c94-0978-4d5f-abd7-28a4e5d99556",
"Payment Method Category":"card",
"CardholderInitiatedTransactionID":"123456",
"ExtendedDescription":"Transaction succeeded",
"Customer Token":"cus_4d184daa989cac82224b856bac739b60",
"Paid Amount":"0.0",
"Payment Account Reference":"V001NPX3IQC6OFS2TAWCVD2WTXRWY",
"Sender Details":"{\"address\":\"null\",\"firstName\":\"null\",\"lastName\":\"null\",\"postcode\":\"null\",\"city\":\"AE\",\"state\":\"null\",\"country\":\"null\",\"companyName\":\"null\"}",
"AcquirerResponse":"SUCCESS",
"Beneficiary Details":"{\"firstName\":\"null\",\"lastName\":\"null\",\"address\":\"null\",\"dob\":\"null\",\"gender\":\"null\",\"email\":\"null\",\"state\":\"null\",\"cardNumber\":\"null\",\"cardExpirationMonth\":\"null\",\"cardExpirationYear\":\"null\",\"nationality\":\"null\",\"city\":\"NY\",\"postcode\":\"null\",\"identificationType\":\"null\",\"identificationValue\":\"null\"\"category\":\"null\"}",
"Statement Descriptor":"044153838562 Rapyd Nat"
},
"customParameters":{
"PAYMENT_INHOUSE_FACADE":"true"
},
"risk":{
"score":"0"
},
"buildNumber":"9092e7a6af8301accda2f9a3a38f743f907dadd5@2026-03-23 16:50:06 +0000",
"timestamp":"2026-03-26 11:38:17+0000",
"ndc":"8a8294174e735d0c014e78cf26461790_88ab0c37d1d64ad78ec136dbb06efa31"
}Refund
The merchant refunds the full captured amount or a part of the captured amount.
Reasons for refunding a transaction after settlement
- Unmet expectations: The product or service did not meet the customer's expectations.
- Damaged or defective products: The product that the customer received arrived damaged or defective.
- Incorrect product: The product did not match the customer's expectations due to poor descriptions or misleading selling.
- Incorrect amount charged: The system charged the wrong amount.
- Duplicate transaction: The transaction was a duplicate.
- Product unavailability: The item sold out.
- Change of mind: The customer changed their mind after ordering.
1. Perform debit payment
Send a server-to-server POST request with the required payment data. The system verifies the payment details with the issuer and moves the funds. A successful request returns an ID that you should save and use to refund the full or partial captured amount.
curl https://sandbox-card.peachpayments.com/v1/payments \
-d "entityId=8a8294174e735d0c014e78cf26461790" \
-d "amount=92.00" \
-d "currency=EUR" \
-d "paymentBrand=VISA" \
-d "paymentType=DB" \
-d "card.number=4200000000000000" \
-d "card.holder=Jane Jones" \
-d "card.expiryMonth=05" \
-d "card.expiryYear=2034" \
-d "card.cvv=123" \
-H "Authorization: Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ="public Dictionary<string, dynamic> Request() {
Dictionary<string, dynamic> responseData;
string data = "entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"¤cy=EUR" +
"&paymentBrand=VISA" +
"&paymentType=DB" +
"&card.number=4200000000000000" +
"&card.holder=Jane Jones" +
"&card.expiryMonth=05" +
"&card.expiryYear=2034" +
"&card.cvv=123";
string url = "https://sandbox-card.peachpayments.com/v1/payments";
byte[] buffer = Encoding.ASCII.GetBytes(data);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "POST";
request.Headers["Authorization"] = "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=";
request.ContentType = "application/x-www-form-urlencoded";
Stream postData = request.GetRequestStream();
postData.Write(buffer, 0, buffer.Length);
postData.Close();
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) {
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
var s = new JavaScriptSerializer();
responseData = s.Deserialize<Dictionary<string, dynamic>>(reader.ReadToEnd());
reader.Close();
dataStream.Close();
}
return responseData;
}
responseData = Request()["result"]["description"];import groovy.json.JsonSlurper
public static String request() {
def data = "entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"¤cy=EUR" +
"&paymentBrand=VISA" +
"&paymentType=DB" +
"&card.number=4200000000000000" +
"&card.holder=Jane Jones" +
"&card.expiryMonth=05" +s
"&card.expiryYear=2034" +
"&card.cvv=123"
def url = "https://sandbox-card.peachpayments.com/v1/payments".toURL()
def connection = url.openConnection()
connection.setRequestMethod("POST")
connection.setRequestProperty("Authorization","Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
connection.doOutput = true
connection.outputStream << data
def json = new JsonSlurper().parseText(connection.inputStream.text)
json
}
println request()private String request() throws IOException {
URL url = new URL("https://sandbox-card.peachpayments.com/v1/payments");
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=");
conn.setDoInput(true);
conn.setDoOutput(true);
String data = ""
+ "entityId=8a8294174e735d0c014e78cf26461790"
+ "&amount=92.00"
+ "¤cy=EUR"
+ "&paymentBrand=VISA"
+ "&paymentType=DB"
+ "&card.number=4200000000000000"
+ "&card.holder=Jane Jones"
+ "&card.expiryMonth=05"
+ "&card.expiryYear=2034"
+ "&card.cvv=123";
DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
wr.writeBytes(data);
wr.flush();
wr.close();
int responseCode = conn.getResponseCode();
InputStream is = responseCode >= 400 ? conn.getErrorStream() : conn.getInputStream();
return IOUtils.toString(is);
}const https = require('https');
const querystring = require('querystring');
const request = async () => {
const path = '/v1/payments';
const data = querystring.stringify({
'entityId': '8a8294174e735d0c014e78cf26461790',
'amount': '92.00',
'currency': 'EUR',
'paymentBrand': 'VISA',
'paymentType': 'DB',
'card.number': '4200000000000000',
'card.holder': 'Jane Jones',
'card.expiryMonth': '05',
'card.expiryYear': '2034',
'card.cvv': '123'
});
const options = {
port: 443,
host: 'sandbox-card.peachpayments.com',
path: path,
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': data.length,
'Authorization': 'Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ='
}
};
return new Promise((resolve, reject) => {
const postRequest = https.request(options, function (res) {
const buf = [];
res.on('data', chunk => {
buf.push(Buffer.from(chunk));
});
res.on('end', () => {
const jsonString = Buffer.concat(buf).toString('utf8');
try {
resolve(JSON.parse(jsonString));
} catch (error) {
reject(error);
}
});
});
postRequest.on('error', reject);
postRequest.write(data);
postRequest.end();
});
};
request().then(console.log).catch(console.error);function request() {
$url = "https://sandbox-card.peachpayments.com/v1/payments";
$data = "entityId=8a8294174e735d0c014e78cf26461790" .
"&amount=92.00" .
"¤cy=EUR" .
"&paymentBrand=VISA" .
"&paymentType=DB" .
"&card.number=4200000000000000" .
"&card.holder=Jane Jones" .
"&card.expiryMonth=05" .
"&card.expiryYear=2034" .
"&card.cvv=123";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization:Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ='));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);// this should be set to true in production
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$responseData = curl_exec($ch);
if(curl_errno($ch)) {
return curl_error($ch);
}
curl_close($ch);
return $responseData;
}
$responseData = request();try:
from urllib.parse import urlencode
from urllib.request import build_opener, Request, HTTPHandler
from urllib.error import HTTPError, URLError
except ImportError:
from urllib import urlencode
from urllib2 import build_opener, Request, HTTPHandler, HTTPError, URLError
import json
def request():
url = "https://sandbox-card.peachpayments.com/v1/payments"
data = {
'entityId' : '8a8294174e735d0c014e78cf26461790',
'amount' : '92.00',
'currency' : 'EUR',
'paymentBrand' : 'VISA',
'paymentType' : 'DB',
'card.number' : '4200000000000000',
'card.holder' : 'Jane Jones',
'card.expiryMonth' : '05',
'card.expiryYear' : '2034',
'card.cvv' : '123'
}
try:
opener = build_opener(HTTPHandler)
request = Request(url, data=urlencode(data).encode('utf-8'))
request.add_header('Authorization', 'Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=')
request.get_method = lambda: 'POST'
response = opener.open(request)
return json.loads(response.read())
except HTTPError as e:
return json.loads(e.read())
except URLError as e:
return e.reason
responseData = request()
print(responseData)require 'net/https'
require 'uri'
require 'json'
def request()
uri = URI('https://sandbox-card.peachpayments.com/v1/payments')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Post.new(uri.path)
req.set_form_data({
'entityId' => '8a8294174e735d0c014e78cf26461790',
'amount' => '92.00',
'currency' => 'EUR',
'paymentBrand' => 'VISA',
'paymentType' => 'DB',
'card.number' => '4200000000000000',
'card.holder' => 'Jane Jones',
'card.expiryMonth' => '05',
'card.expiryYear' => '2034',
'card.cvv' => '123'
})
res = http.request(req)
return JSON.parse(res.body)
end
puts request()def initialPayment : String = {
val url = "https://sandbox-card.peachpayments.com/v1/payments"
val data = (""
+ "entityId=8a8294174e735d0c014e78cf26461790"
+ "&amount=92.00"
+ "¤cy=EUR"
+ "&paymentBrand=VISA"
+ "&paymentType=DB"
+ "&card.number=4200000000000000"
+ "&card.holder=Jane Jones"
+ "&card.expiryMonth=05"
+ "&card.expiryYear=2034"
+ "&card.cvv=123"
)
val conn = new URL(url).openConnection()
conn match {
case secureConn: HttpsURLConnection => secureConn.setRequestMethod("POST")
case _ => throw new ClassCastException
}
conn.setDoInput(true)
conn.setDoOutput(true)
IOUtils.write(data, conn.getOutputStream())
conn.setRequestProperty("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
conn.connect()
if (conn.getResponseCode() >= 400) {
return IOUtils.toString(conn.getErrorStream())
}
else {
return IOUtils.toString(conn.getInputStream())
}
}Public Function Request() As Dictionary(Of String, Object)
Dim url As String = "https://sandbox-card.peachpayments.com/v1/payments"
Dim data As String = "" +
"entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"¤cy=EUR" +
"&paymentBrand=VISA" +
"&paymentType=DB" +
"&card.number=4200000000000000" +
"&card.holder=Jane Jones" +
"&card.expiryMonth=05" +
"&card.expiryYear=2034" +
"&card.cvv=123"
Dim req As WebRequest = WebRequest.Create(url)
req.Method = "POST"
req.Headers.Add("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
req.ContentType = "application/x-www-form-urlencoded"
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(data)
req.ContentLength = byteArray.Length
Dim dataStream As Stream = req.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length)
dataStream.Close()
Dim res As WebResponse = req.GetResponse()
Dim resStream = res.GetResponseStream()
Dim reader As New StreamReader(resStream)
Dim response As String = reader.ReadToEnd()
reader.Close()
resStream.Close()
res.Close()
Dim jss As New System.Web.Script.Serialization.JavaScriptSerializer()
Dim dict As Dictionary(Of String, Object) = jss.Deserialize(Of Dictionary(Of String, Object))(response)
Return dict
End Function
responseData = Request()("result")("description"){
"id":"8ac7a4a19d29ed1f019d29f0a71a027f",
"paymentType":"DB",
"paymentBrand":"VISA",
"amount":"92.00",
"currency":"EUR",
"descriptor":"8960.8341.3028 MAC_Channel ",
"result":{
"code":"000.100.110",
"description":"Request successfully processed in 'Merchant in Integrator Test Mode'"
},
"resultDetails":{
"Payment Status":"CLO",
"ConnectorTxID1":"payment_55cd30eb3b5a499b3a3a2f5b6cf3f11a",
"Cvv Check":"unchecked",
"Transaction Status":"SUCCESS",
"ConnectorTxID3":"123456",
"Amount":"0.0",
"Operation Id":"64403c94-0978-4d5f-abd7-28a4e5d99556",
"Payment Method Category":"card",
"CardholderInitiatedTransactionID":"123456",
"ExtendedDescription":"Transaction succeeded",
"Customer Token":"cus_4d184daa989cac82224b856bac739b60",
"Paid Amount":"0.0",
"Payment Account Reference":"V001NPX3IQC6OFS2TAWCVD2WTXRWY",
"Sender Details":"{\"address\":\"null\",\"firstName\":\"null\",\"lastName\":\"null\",\"postcode\":\"null\",\"city\":\"AE\",\"state\":\"null\",\"country\":\"null\",\"companyName\":\"null\"}",
"AcquirerResponse":"SUCCESS",
"Beneficiary Details":"{\"firstName\":\"null\",\"lastName\":\"null\",\"address\":\"null\",\"dob\":\"null\",\"gender\":\"null\",\"email\":\"null\",\"state\":\"null\",\"cardNumber\":\"null\",\"cardExpirationMonth\":\"null\",\"cardExpirationYear\":\"null\",\"nationality\":\"null\",\"city\":\"NY\",\"postcode\":\"null\",\"identificationType\":\"null\",\"identificationValue\":\"null\"\"category\":\"null\"}",
"Statement Descriptor":"044153838562 Rapyd Nat"
},
"card":{
"bin":"420000",
"last4Digits":"0000",
"holder":"Jane Jones",
"expiryMonth":"05",
"expiryYear":"2034"
},
"customParameters":{
"PAYMENT_INHOUSE_FACADE":"true"
},
"risk":{
"score":"100"
},
"buildNumber":"9092e7a6af8301accda2f9a3a38f743f907dadd5@2026-03-23 16:50:06 +0000",
"timestamp":"2026-03-26 11:38:50+0000",
"ndc":"8a8294174e735d0c014e78cf26461790_04c19e4ffdec4cd3b9fafe13e6027fcf"
}2. Refund the payment
Send a server-to-server POST request over the debit payment, which serves as the original transaction requiring a refund. The system reverses the original charge and sends the money back to the customer. The refund issuance period depends on the payment method, ranging from some days to up to a year after the original transaction.
When issuing a refund, always communicate with the customer about the process and expected timeline for the refund to reflect in their account. Clear communication helps keep good customer relations and trust.
Sample request:
https://sandbox-card.peachpayments.com/v1/payments/8ac7a4a19d29ed1f019d29f0a71a027f
curl https://sandbox-card.peachpayments.com/v1/payments/{id} \
-d "entityId=8a8294174e735d0c014e78cf26461790" \
-d "amount=92.00" \
-d "paymentType=RF" \
-d "currency=EUR" \
-H "Authorization: Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ="public Dictionary<string, dynamic> Request() {
Dictionary<string, dynamic> responseData;
string data="entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"&paymentType=RF" +
"¤cy=EUR";
string url = "https://sandbox-card.peachpayments.com/v1/payments/{id}";
byte[] buffer = Encoding.ASCII.GetBytes(data);
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
request.Method = "POST";
request.Headers["Authorization"] = "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=";
request.ContentType = "application/x-www-form-urlencoded";
Stream PostData = request.GetRequestStream();
PostData.Write(buffer, 0, buffer.Length);
PostData.Close();
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
var s = new JavaScriptSerializer();
responseData = s.Deserialize<Dictionary<string, dynamic>>(reader.ReadToEnd());
reader.Close();
dataStream.Close();
}
return responseData;
}
responseData = Request()["result"]["description"];import groovy.json.JsonSlurper
public static String request() {
def data = "entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"&paymentType=RF" +
"¤cy=EUR"
def url = "https://sandbox-card.peachpayments.com/v1/payments/{id}".toURL()
def connection = url.openConnection()
connection.setRequestMethod("POST")
connection.setRequestProperty("Authorization","Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
connection.doOutput = true
connection.outputStream << data
def json = new JsonSlurper().parseText(connection.inputStream.text)
json
}
println request()private String request() throws IOException {
URL url = new URL("https://sandbox-card.peachpayments.com/v1/payments/{id}");
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=");
conn.setDoInput(true);
conn.setDoOutput(true);
String data = ""
+ "entityId=8a8294174e735d0c014e78cf26461790"
+ "&amount=92.00"
+ "&paymentType=RF"
+ "¤cy=EUR";
DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
wr.writeBytes(data);
wr.flush();
wr.close();
int responseCode = conn.getResponseCode();
InputStream is;
if (responseCode >= 400) is = conn.getErrorStream();
else is = conn.getInputStream();
return IOUtils.toString(is);
}const https = require('https');
const querystring = require('querystring');
const request = async () => {
const path='/v1/payments/{id}';
const data = querystring.stringify({
'entityId':'8a8294174e735d0c014e78cf26461790',
'amount':'92.00',
'paymentType':'RF',
'currency':'EUR'
});
const options = {
port: 443,
host: 'sandbox-card.peachpayments.com',
path: path,
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': data.length,
'Authorization':'Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ='
}
};
return new Promise((resolve, reject) => {
const postRequest = https.request(options, function(res) {
const buf = [];
res.on('data', chunk => {
buf.push(Buffer.from(chunk));
});
res.on('end', () => {
const jsonString = Buffer.concat(buf).toString('utf8');
try {
resolve(JSON.parse(jsonString));
} catch (error) {
reject(error);
}
});
});
postRequest.on('error', reject);
postRequest.write(data);
postRequest.end();
});
};
request().then(console.log).catch(console.error);function request() {
$url = "https://sandbox-card.peachpayments.com/v1/payments/{id}";
$data = "entityId=8a8294174e735d0c014e78cf26461790" .
"&amount=92.00" .
"&paymentType=RF" .
"¤cy=EUR";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization:Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ='));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);// this should be set to true in production
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$responseData = curl_exec($ch);
if(curl_errno($ch)) {
return curl_error($ch);
}
curl_close($ch);
return $responseData;
}
$responseData = request();try:
from urllib.parse import urlencode
from urllib.request import build_opener, Request, HTTPHandler
from urllib.error import HTTPError, URLError
except ImportError:
from urllib import urlencode
from urllib2 import build_opener, Request, HTTPHandler, HTTPError, URLError
import json
def request():
url = "https://sandbox-card.peachpayments.com/v1/payments/{id}"
data = {
'entityId' : '8a8294174e735d0c014e78cf26461790',
'amount' : '92.00',
'paymentType' : 'RF',
'currency' : 'EUR'
}
try:
opener = build_opener(HTTPHandler)
request = Request(url, data=urlencode(data).encode('utf-8'))
request.add_header('Authorization', 'Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=')
request.get_method = lambda: 'POST'
response = opener.open(request)
return json.loads(response.read())
except HTTPError as e:
return json.loads(e.read())
except URLError as e:
return e.reason
responseData = request()
print(responseData)require 'net/https'
require 'uri'
require 'json'
def request()
uri = URI('https://sandbox-card.peachpayments.com/v1/payments/{id}')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Post.new(uri.path)
req.set_form_data({
'entityId' => '8a8294174e735d0c014e78cf26461790',
'amount' => '92.00',
'paymentType' => 'RF',
'currency' => 'EUR'
})
res = http.request(req)
return JSON.parse(res.body)
end
puts request()def initialPayment : String = {
val url = "https://sandbox-card.peachpayments.com/v1/payments/{id}"
val data = (""
+ "entityId=8a8294174e735d0c014e78cf26461790"
+ "&amount=92.00"
+ "&paymentType=RF"
+ "¤cy=EUR"
)
val conn = new URL(url).openConnection()
conn match {
case secureConn: HttpsURLConnection => secureConn.setRequestMethod("POST")
case _ => throw new ClassCastException
}
conn.setDoInput(true)
conn.setDoOutput(true)
IOUtils.write(data, conn.getOutputStream())
conn.setRequestProperty("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
conn.connect()
if (conn.getResponseCode() >= 400) {
return IOUtils.toString(conn.getErrorStream())
}
else {
return IOUtils.toString(conn.getInputStream())
}
}Public Function Request() As Dictionary(Of String, Object)
Dim url As String = "https://sandbox-card.peachpayments.com/v1/payments/{id}"
Dim data As String = "" +
"entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"&paymentType=RF" +
"¤cy=EUR"
Dim req As WebRequest = WebRequest.Create(url)
req.Method = "POST"
req.Headers.Add("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
req.ContentType = "application/x-www-form-urlencoded"
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(data)
req.ContentLength = byteArray.Length
Dim dataStream As Stream = req.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length)
dataStream.Close()
Dim res As WebResponse = req.GetResponse()
Dim resStream = res.GetResponseStream()
Dim reader As New StreamReader(resStream)
Dim response As String = reader.ReadToEnd()
reader.Close()
resStream.Close()
res.Close()
Dim jss As New System.Web.Script.Serialization.JavaScriptSerializer()
Dim dict As Dictionary(Of String, Object) = jss.Deserialize(Of Dictionary(Of String, Object))(response)
Return dict
End Function
responseData = Request()("result")("description"){
"id":"8ac7a49f9d29ed6d019d29f171f50358",
"referencedId":"8ac7a4a19d29ed1f019d29f0a71a027f",
"paymentType":"RF",
"amount":"92.00",
"currency":"EUR",
"descriptor":"4624.2383.6708 MAC_Channel",
"result":{
"code":"000.100.110",
"description":"Request successfully processed in 'Merchant in Integrator Test Mode'"
},
"resultDetails":{
"Payment Status":"CLO",
"ConnectorTxID1":"payment_55cd30eb3b5a499b3a3a2f5b6cf3f11a",
"Cvv Check":"unchecked",
"Transaction Status":"SUCCESS",
"ConnectorTxID3":"123456",
"Amount":"0.0",
"Operation Id":"64403c94-0978-4d5f-abd7-28a4e5d99556",
"Payment Method Category":"card",
"CardholderInitiatedTransactionID":"123456",
"ExtendedDescription":"Transaction succeeded",
"Customer Token":"cus_4d184daa989cac82224b856bac739b60",
"Paid Amount":"0.0",
"Payment Account Reference":"V001NPX3IQC6OFS2TAWCVD2WTXRWY",
"Sender Details":"{\"address\":\"null\",\"firstName\":\"null\",\"lastName\":\"null\",\"postcode\":\"null\",\"city\":\"AE\",\"state\":\"null\",\"country\":\"null\",\"companyName\":\"null\"}",
"AcquirerResponse":"SUCCESS",
"Beneficiary Details":"{\"firstName\":\"null\",\"lastName\":\"null\",\"address\":\"null\",\"dob\":\"null\",\"gender\":\"null\",\"email\":\"null\",\"state\":\"null\",\"cardNumber\":\"null\",\"cardExpirationMonth\":\"null\",\"cardExpirationYear\":\"null\",\"nationality\":\"null\",\"city\":\"NY\",\"postcode\":\"null\",\"identificationType\":\"null\",\"identificationValue\":\"null\"\"category\":\"null\"}",
"Statement Descriptor":"044153838562 Rapyd Nat"
},
"customParameters":{
"PAYMENT_INHOUSE_FACADE":"true"
},
"buildNumber":"9092e7a6af8301accda2f9a3a38f743f907dadd5@2026-03-23 16:50:06 +0000",
"timestamp":"2026-03-26 11:39:42+0000",
"ndc":"8a8294174e735d0c014e78cf26461790_ecd5e9abe1e9448da4199acb153e86af"
}Chargeback
The merchant records the chargeback and its reason as received from the bank to show a reversal of funds from the merchant's account into the customer's account. This occurs when a customer disputes a debit or credit card charge with their bank, leading to a reimbursement instead of resolving the issue directly with the business.
Originally, chargebacks served as consumer protection against credit card fraud. However, shoppers can also request chargebacks due to billing errors, unresolved customer complaints, or unrecognised charges.
As a business, minimising chargebacks is essential. Understanding how to prevent them and working with your payment processing company to dispute them ensures better financial control.
1. Perform debit payment
Send a Server-to-Server POST request with the required payment data. The system verifies the payment details with the issuer and captures the funds. The response includes an id, which the merchant uses in a chargeback to reflect the reversal of funds.
Sample request:
curl https://sandbox-card.peachpayments.com/v1/payments \
-d "entityId=8a8294174e735d0c014e78cf26461790" \
-d "amount=92.00" \
-d "currency=EUR" \
-d "paymentBrand=VISA" \
-d "paymentType=DB" \
-d "card.number=4200000000000000" \
-d "card.holder=Jane Jones" \
-d "card.expiryMonth=05" \
-d "card.expiryYear=2034" \
-d "card.cvv=123" \
-H "Authorization: Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ="public Dictionary<string, dynamic> Request() {
Dictionary<string, dynamic> responseData;
string data="entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"¤cy=EUR" +
"&paymentBrand=VISA" +
"&paymentType=DB" +
"&card.number=4200000000000000" +
"&card.holder=Jane Jones" +
"&card.expiryMonth=05" +
"&card.expiryYear=2034" +
"&card.cvv=123";
string url = "https://sandbox-card.peachpayments.com/v1/payments";
byte[] buffer = Encoding.ASCII.GetBytes(data);
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
request.Method = "POST";
request.Headers["Authorization"] = "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=";
request.ContentType = "application/x-www-form-urlencoded";
Stream PostData = request.GetRequestStream();
PostData.Write(buffer, 0, buffer.Length);
PostData.Close();
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
var s = new JavaScriptSerializer();
responseData = s.Deserialize<Dictionary<string, dynamic>>(reader.ReadToEnd());
reader.Close();
dataStream.Close();
}
return responseData;
}
responseData = Request()["result"]["description"];import groovy.json.JsonSlurper
public static String request() {
def data = "entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"¤cy=EUR" +
"&paymentBrand=VISA" +
"&paymentType=DB" +
"&card.number=4200000000000000" +
"&card.holder=Jane Jones" +
"&card.expiryMonth=05" +
"&card.expiryYear=2034" +
"&card.cvv=123"
def url = "https://sandbox-card.peachpayments.com/v1/payments".toURL()
def connection = url.openConnection()
connection.setRequestMethod("POST")
connection.setRequestProperty("Authorization","Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
connection.doOutput = true
connection.outputStream << data
def json = new JsonSlurper().parseText(connection.inputStream.text)
json
}
println request()private String request() throws IOException {
URL url = new URL("https://sandbox-card.peachpayments.com/v1/payments");
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=");
conn.setDoInput(true);
conn.setDoOutput(true);
String data = ""
+ "entityId=8a8294174e735d0c014e78cf26461790"
+ "&amount=92.00"
+ "¤cy=EUR"
+ "&paymentBrand=VISA"
+ "&paymentType=DB"
+ "&card.number=4200000000000000"
+ "&card.holder=Jane Jones"
+ "&card.expiryMonth=05"
+ "&card.expiryYear=2034"
+ "&card.cvv=123";
DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
wr.writeBytes(data);
wr.flush();
wr.close();
int responseCode = conn.getResponseCode();
InputStream is;
if (responseCode >= 400) is = conn.getErrorStream();
else is = conn.getInputStream();
return IOUtils.toString(is);
}const https = require('https');
const querystring = require('querystring');
const request = async () => {
const path='/v1/payments';
const data = querystring.stringify({
'entityId':'8a8294174e735d0c014e78cf26461790',
'amount':'92.00',
'currency':'EUR',
'paymentBrand':'VISA',
'paymentType':'DB',
'card.number':'4200000000000000',
'card.holder':'Jane Jones',
'card.expiryMonth':'05',
'card.expiryYear':'2034',
'card.cvv':'123'
});
const options = {
port: 443,
host: 'sandbox-card.peachpayments.com',
path: path,
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': data.length,
'Authorization':'Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ='
}
};
return new Promise((resolve, reject) => {
const postRequest = https.request(options, function(res) {
const buf = [];
res.on('data', chunk => {
buf.push(Buffer.from(chunk));
});
res.on('end', () => {
const jsonString = Buffer.concat(buf).toString('utf8');
try {
resolve(JSON.parse(jsonString));
} catch (error) {
reject(error);
}
});
});
postRequest.on('error', reject);
postRequest.write(data);
postRequest.end();
});
};
request().then(console.log).catch(console.error);function request() {
$url = "https://sandbox-card.peachpayments.com/v1/payments";
$data = "entityId=8a8294174e735d0c014e78cf26461790" .
"&amount=92.00" .
"¤cy=EUR" .
"&paymentBrand=VISA" .
"&paymentType=DB" .
"&card.number=4200000000000000" .
"&card.holder=Jane Jones" .
"&card.expiryMonth=05" .
"&card.expiryYear=2034" .
"&card.cvv=123";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization:Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ='));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);// this should be set to true in production
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$responseData = curl_exec($ch);
if(curl_errno($ch)) {
return curl_error($ch);
}
curl_close($ch);
return $responseData;
}
$responseData = request();try:
from urllib.parse import urlencode
from urllib.request import build_opener, Request, HTTPHandler
from urllib.error import HTTPError, URLError
except ImportError:
from urllib import urlencode
from urllib2 import build_opener, Request, HTTPHandler, HTTPError, URLError
import json
def request():
url = "https://sandbox-card.peachpayments.com/v1/payments"
data = {
'entityId' : '8a8294174e735d0c014e78cf26461790',
'amount' : '92.00',
'currency' : 'EUR',
'paymentBrand' : 'VISA',
'paymentType' : 'DB',
'card.number' : '4200000000000000',
'card.holder' : 'Jane Jones',
'card.expiryMonth' : '05',
'card.expiryYear' : '2034',
'card.cvv' : '123'
}
try:
opener = build_opener(HTTPHandler)
request = Request(url, data=urlencode(data).encode('utf-8'))
request.add_header('Authorization', 'Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=')
request.get_method = lambda: 'POST'
response = opener.open(request)
return json.loads(response.read())
except HTTPError as e:
return json.loads(e.read())
except URLError as e:
return e.reason
responseData = request()
print(responseData)require 'net/https'
require 'uri'
require 'json'
def request()
uri = URI('https://sandbox-card.peachpayments.com/v1/payments')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Post.new(uri.path)
req.set_form_data({
'entityId' => '8a8294174e735d0c014e78cf26461790',
'amount' => '92.00',
'currency' => 'EUR',
'paymentBrand' => 'VISA',
'paymentType' => 'DB',
'card.number' => '4200000000000000',
'card.holder' => 'Jane Jones',
'card.expiryMonth' => '05',
'card.expiryYear' => '2034',
'card.cvv' => '123'
})
res = http.request(req)
return JSON.parse(res.body)
end
puts request()def initialPayment : String = {
val url = "https://sandbox-card.peachpayments.com/v1/payments"
val data = (""
+ "entityId=8a8294174e735d0c014e78cf26461790"
+ "&amount=92.00"
+ "¤cy=EUR"
+ "&paymentBrand=VISA"
+ "&paymentType=DB"
+ "&card.number=4200000000000000"
+ "&card.holder=Jane Jones"
+ "&card.expiryMonth=05"
+ "&card.expiryYear=2034"
+ "&card.cvv=123"
)
val conn = new URL(url).openConnection()
conn match {
case secureConn: HttpsURLConnection => secureConn.setRequestMethod("POST")
case _ => throw new ClassCastException
}
conn.setDoInput(true)
conn.setDoOutput(true)
IOUtils.write(data, conn.getOutputStream())
conn.setRequestProperty("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
conn.connect()
if (conn.getResponseCode() >= 400) {
return IOUtils.toString(conn.getErrorStream())
}
else {
return IOUtils.toString(conn.getInputStream())
}
}Public Function Request() As Dictionary(Of String, Object)
Dim url As String = "https://sandbox-card.peachpayments.com/v1/payments"
Dim data As String = "" +
"entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"¤cy=EUR" +
"&paymentBrand=VISA" +
"&paymentType=DB" +
"&card.number=4200000000000000" +
"&card.holder=Jane Jones" +
"&card.expiryMonth=05" +
"&card.expiryYear=2034" +
"&card.cvv=123"
Dim req As WebRequest = WebRequest.Create(url)
req.Method = "POST"
req.Headers.Add("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
req.ContentType = "application/x-www-form-urlencoded"
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(data)
req.ContentLength = byteArray.Length
Dim dataStream As Stream = req.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length)
dataStream.Close()
Dim res As WebResponse = req.GetResponse()
Dim resStream = res.GetResponseStream()
Dim reader As New StreamReader(resStream)
Dim response As String = reader.ReadToEnd()
reader.Close()
resStream.Close()
res.Close()
Dim jss As New System.Web.Script.Serialization.JavaScriptSerializer()
Dim dict As Dictionary(Of String, Object) = jss.Deserialize(Of Dictionary(Of String, Object))(response)
Return dict
End Function
responseData = Request()("result")("description"){
"id":"8ac7a4a19d29ed1f019d2a3395660dc0",
"paymentType":"DB",
"paymentBrand":"VISA",
"amount":"92.00",
"currency":"EUR",
"descriptor":"0505.1070.6724 MAC_Channel ",
"result":{
"code":"000.100.110",
"description":"Request successfully processed in 'Merchant in Integrator Test Mode'"
},
"resultDetails":{
"Payment Status":"CLO",
"ConnectorTxID1":"payment_55cd30eb3b5a499b3a3a2f5b6cf3f11a",
"Cvv Check":"unchecked",
"Transaction Status":"SUCCESS",
"ConnectorTxID3":"123456",
"Amount":"0.0",
"Operation Id":"64403c94-0978-4d5f-abd7-28a4e5d99556",
"Payment Method Category":"card",
"CardholderInitiatedTransactionID":"123456",
"ExtendedDescription":"Transaction succeeded",
"Customer Token":"cus_4d184daa989cac82224b856bac739b60",
"Paid Amount":"0.0",
"Payment Account Reference":"V001NPX3IQC6OFS2TAWCVD2WTXRWY",
"Sender Details":"{\"address\":\"null\",\"firstName\":\"null\",\"lastName\":\"null\",\"postcode\":\"null\",\"city\":\"AE\",\"state\":\"null\",\"country\":\"null\",\"companyName\":\"null\"}",
"AcquirerResponse":"SUCCESS",
"Beneficiary Details":"{\"firstName\":\"null\",\"lastName\":\"null\",\"address\":\"null\",\"dob\":\"null\",\"gender\":\"null\",\"email\":\"null\",\"state\":\"null\",\"cardNumber\":\"null\",\"cardExpirationMonth\":\"null\",\"cardExpirationYear\":\"null\",\"nationality\":\"null\",\"city\":\"NY\",\"postcode\":\"null\",\"identificationType\":\"null\",\"identificationValue\":\"null\"\"category\":\"null\"}",
"Statement Descriptor":"044153838562 Rapyd Nat"
},
"card":{
"bin":"420000",
"last4Digits":"0000",
"holder":"Jane Jones",
"expiryMonth":"05",
"expiryYear":"2034"
},
"customParameters":{
"PAYMENT_INHOUSE_FACADE":"true"
},
"risk":{
"score":"100"
},
"buildNumber":"9092e7a6af8301accda2f9a3a38f743f907dadd5@2026-03-23 16:50:06 +0000",
"timestamp":"2026-03-26 12:51:56+0000",
"ndc":"8a8294174e735d0c014e78cf26461790_19fd77d1074448f3ae14ceba8632031a"
}2. Perform the chargeback
Send a Server-to-Server POST request using the post-payment authorisation ID. A chargeback reverses funds to the customer's account after a dispute. When a customer initiates a chargeback, the merchant can contest the legitimacy of the original transaction by presenting evidence such as receipts and delivery confirmations. This process disputes the chargeback and challenges the customer's claim.
Sample request:
You can use any of these chargeback result codes.
https://sandbox-card.peachpayments.com/v1/payments/8ac7a4a19d29ed1f019d2a3395660dc0
curl https://sandbox-card.peachpayments.com/v1/payments/{id} \
-d "entityId=8a8294174e735d0c014e78cf26461790" \
-d "amount=92.00" \
-d "paymentType=CB" \
-d "currency=EUR" \
-d "chargebackResultCode=000.100.200" \
-H "Authorization: Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ="public Dictionary<string, dynamic> Request() {
Dictionary<string, dynamic> responseData;
string data="entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"&paymentType=CB" +
"¤cy=EUR" +
"&chargebackResultCode=000.100.200";
string url = "https://sandbox-card.peachpayments.com/v1/payments/{id}";
byte[] buffer = Encoding.ASCII.GetBytes(data);
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
request.Method = "POST";
request.Headers["Authorization"] = "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=";
request.ContentType = "application/x-www-form-urlencoded";
Stream PostData = request.GetRequestStream();
PostData.Write(buffer, 0, buffer.Length);
PostData.Close();
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
var s = new JavaScriptSerializer();
responseData = s.Deserialize<Dictionary<string, dynamic>>(reader.ReadToEnd());
reader.Close();
dataStream.Close();
}
return responseData;
}
responseData = Request()["result"]["description"];import groovy.json.JsonSlurper
public static String request() {
def data = "entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"&paymentType=CB" +
"¤cy=EUR" +
"&chargebackResultCode=000.100.200"
def url = "https://sandbox-card.peachpayments.com/v1/payments/{id}".toURL()
def connection = url.openConnection()
connection.setRequestMethod("POST")
connection.setRequestProperty("Authorization","Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
connection.doOutput = true
connection.outputStream << data
def json = new JsonSlurper().parseText(connection.inputStream.text)
json
}
println request()private String request() throws IOException {
URL url = new URL("https://sandbox-card.peachpayments.com/v1/payments/{id}");
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=");
conn.setDoInput(true);
conn.setDoOutput(true);
String data = ""
+ "entityId=8a8294174e735d0c014e78cf26461790"
+ "&amount=92.00"
+ "&paymentType=CB"
+ "¤cy=EUR"
+ "&chargebackResultCode=000.100.200";
DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
wr.writeBytes(data);
wr.flush();
wr.close();
int responseCode = conn.getResponseCode();
InputStream is;
if (responseCode >= 400) is = conn.getErrorStream();
else is = conn.getInputStream();
return IOUtils.toString(is);
}const https = require('https');
const querystring = require('querystring');
const request = async () => {
const path='/v1/payments/{id}';
const data = querystring.stringify({
'entityId':'8a8294174e735d0c014e78cf26461790',
'amount':'92.00',
'paymentType':'CB',
'currency':'EUR',
'chargebackResultCode':'000.100.200'
});
const options = {
port: 443,
host: 'sandbox-card.peachpayments.com',
path: path,
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': data.length,
'Authorization':'Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ='
}
};
return new Promise((resolve, reject) => {
const postRequest = https.request(options, function(res) {
const buf = [];
res.on('data', chunk => {
buf.push(Buffer.from(chunk));
});
res.on('end', () => {
const jsonString = Buffer.concat(buf).toString('utf8');
try {
resolve(JSON.parse(jsonString));
} catch (error) {
reject(error);
}
});
});
postRequest.on('error', reject);
postRequest.write(data);
postRequest.end();
});
};
request().then(console.log).catch(console.error);function request() {
$url = "https://sandbox-card.peachpayments.com/v1/payments/{id}";
$data = "entityId=8a8294174e735d0c014e78cf26461790" .
"&amount=92.00" .
"&paymentType=CB" .
"¤cy=EUR" .
"&chargebackResultCode=000.100.200";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization:Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ='));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);// this should be set to true in production
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$responseData = curl_exec($ch);
if(curl_errno($ch)) {
return curl_error($ch);
}
curl_close($ch);
return $responseData;
}
$responseData = request();try:
from urllib.parse import urlencode
from urllib.request import build_opener, Request, HTTPHandler
from urllib.error import HTTPError, URLError
except ImportError:
from urllib import urlencode
from urllib2 import build_opener, Request, HTTPHandler, HTTPError, URLError
import json
def request():
url = "https://sandbox-card.peachpayments.com/v1/payments/{id}"
data = {
'entityId' : '8a8294174e735d0c014e78cf26461790',
'amount' : '92.00',
'paymentType' : 'CB',
'currency' : 'EUR',
'chargebackResultCode' : '000.100.200'
}
try:
opener = build_opener(HTTPHandler)
request = Request(url, data=urlencode(data).encode('utf-8'))
request.add_header('Authorization', 'Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=')
request.get_method = lambda: 'POST'
response = opener.open(request)
return json.loads(response.read())
except HTTPError as e:
return json.loads(e.read())
except URLError as e:
return e.reason
responseData = request()
print(responseData)require 'net/https'
require 'uri'
require 'json'
def request()
uri = URI('https://sandbox-card.peachpayments.com/v1/payments/{id}')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Post.new(uri.path)
req.set_form_data({
'entityId' => '8a8294174e735d0c014e78cf26461790',
'amount' => '92.00',
'paymentType' => 'CB',
'currency' => 'EUR',
'chargebackResultCode' => '000.100.200'
})
res = http.request(req)
return JSON.parse(res.body)
end
puts request()def initialPayment : String = {
val url = "https://sandbox-card.peachpayments.com/v1/payments/{id}"
val data = (""
+ "entityId=8a8294174e735d0c014e78cf26461790"
+ "&amount=92.00"
+ "&paymentType=CB"
+ "¤cy=EUR"
+ "&chargebackResultCode=000.100.200"
)
val conn = new URL(url).openConnection()
conn match {
case secureConn: HttpsURLConnection => secureConn.setRequestMethod("POST")
case _ => throw new ClassCastException
}
conn.setDoInput(true)
conn.setDoOutput(true)
IOUtils.write(data, conn.getOutputStream())
conn.setRequestProperty("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
conn.connect()
if (conn.getResponseCode() >= 400) {
return IOUtils.toString(conn.getErrorStream())
}
else {
return IOUtils.toString(conn.getInputStream())
}
}Public Function Request() As Dictionary(Of String, Object)
Dim url As String = "https://sandbox-card.peachpayments.com/v1/payments/{id}"
Dim data As String = "" +
"entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"&paymentType=CB" +
"¤cy=EUR" +
"&chargebackResultCode=000.100.200"
Dim req As WebRequest = WebRequest.Create(url)
req.Method = "POST"
req.Headers.Add("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
req.ContentType = "application/x-www-form-urlencoded"
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(data)
req.ContentLength = byteArray.Length
Dim dataStream As Stream = req.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length)
dataStream.Close()
Dim res As WebResponse = req.GetResponse()
Dim resStream = res.GetResponseStream()
Dim reader As New StreamReader(resStream)
Dim response As String = reader.ReadToEnd()
reader.Close()
resStream.Close()
res.Close()
Dim jss As New System.Web.Script.Serialization.JavaScriptSerializer()
Dim dict As Dictionary(Of String, Object) = jss.Deserialize(Of Dictionary(Of String, Object))(response)
Return dict
End Function
responseData = Request()("result")("description"){
"id":"8ac7a4a19d29ed1f019d2a366fb716ae",
"referencedId":"8ac7a4a19d29ed1f019d2a3395660dc0",
"paymentType":"CB",
"amount":"92.00",
"currency":"EUR",
"descriptor":"9503.0635.5236 MAC_Channel",
"result":{
"code":"000.100.200",
"description":"Reason not Specified"
},
"customParameters":{
"PAYMENT_INHOUSE_FACADE":"true"
},
"buildNumber":"9092e7a6af8301accda2f9a3a38f743f907dadd5@2026-03-23 16:50:06 +0000",
"timestamp":"2026-03-26 12:55:03+0000",
"ndc":"8a8294174e735d0c014e78cf26461790_defc374f543c4f338fa6799b7049d7eb"
}3. Perform the chargeback reversal
Send a Server-to-Server POST request using the chargeback payment ID to reverse the chargeback. This occurs after the representment process. If the issuing bank rules in favour of the merchant after reviewing the evidence, the chargeback reverses. The funds initially debited from the merchant and credited to the customer return to the merchant.
Even after a chargeback reversal, the merchant still incurs the chargeback fee, and the transaction continues to affect the merchant's chargeback ratio.
In summary, representment challenges a chargeback, and a chargeback reversal is one possible outcome.
Sample request:
https://sandbox-card.peachpayments.com/v1/payments/8ac7a4a29d29b86a019d2a36e755023b
curl https://sandbox-card.peachpayments.com/v1/payments/{id} \
-d "entityId=8a8294174e735d0c014e78cf26461790" \
-d "amount=92.00" \
-d "paymentType=CR" \
-d "currency=EUR" \
-H "Authorization: Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ="public Dictionary<string, dynamic> Request() {
Dictionary<string, dynamic> responseData;
string data="entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"&paymentType=CR" +
"¤cy=EUR";
string url = "https://sandbox-card.peachpayments.com/v1/payments/{id}";
byte[] buffer = Encoding.ASCII.GetBytes(data);
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
request.Method = "POST";
request.Headers["Authorization"] = "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=";
request.ContentType = "application/x-www-form-urlencoded";
Stream PostData = request.GetRequestStream();
PostData.Write(buffer, 0, buffer.Length);
PostData.Close();
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
var s = new JavaScriptSerializer();
responseData = s.Deserialize<Dictionary<string, dynamic>>(reader.ReadToEnd());
reader.Close();
dataStream.Close();
}
return responseData;
}
responseData = Request()["result"]["description"];import groovy.json.JsonSlurper
public static String request() {
def data = "entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"&paymentType=CR" +
"¤cy=EUR"
def url = "https://sandbox-card.peachpayments.com/v1/payments/{id}".toURL()
def connection = url.openConnection()
connection.setRequestMethod("POST")
connection.setRequestProperty("Authorization","Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
connection.doOutput = true
connection.outputStream << data
def json = new JsonSlurper().parseText(connection.inputStream.text)
json
}
println request()private String request() throws IOException {
URL url = new URL("https://sandbox-card.peachpayments.com/v1/payments/{id}");
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=");
conn.setDoInput(true);
conn.setDoOutput(true);
String data = ""
+ "entityId=8a8294174e735d0c014e78cf26461790"
+ "&amount=92.00"
+ "&paymentType=CR"
+ "¤cy=EUR";
DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
wr.writeBytes(data);
wr.flush();
wr.close();
int responseCode = conn.getResponseCode();
InputStream is;
if (responseCode >= 400) is = conn.getErrorStream();
else is = conn.getInputStream();
return IOUtils.toString(is);
}const https = require('https');
const querystring = require('querystring');
const request = async () => {
const path='/v1/payments/{id}';
const data = querystring.stringify({
'entityId':'8a8294174e735d0c014e78cf26461790',
'amount':'92.00',
'paymentType':'CR',
'currency':'EUR'
});
const options = {
port: 443,
host: 'sandbox-card.peachpayments.com',
path: path,
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': data.length,
'Authorization':'Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ='
}
};
return new Promise((resolve, reject) => {
const postRequest = https.request(options, function(res) {
const buf = [];
res.on('data', chunk => {
buf.push(Buffer.from(chunk));
});
res.on('end', () => {
const jsonString = Buffer.concat(buf).toString('utf8');
try {
resolve(JSON.parse(jsonString));
} catch (error) {
reject(error);
}
});
});
postRequest.on('error', reject);
postRequest.write(data);
postRequest.end();
});
};
request().then(console.log).catch(console.error);function request() {
$url = "https://sandbox-card.peachpayments.com/v1/payments/{id}";
$data = "entityId=8a8294174e735d0c014e78cf26461790" .
"&amount=92.00" .
"&paymentType=CR" .
"¤cy=EUR";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization:Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ='));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);// this should be set to true in production
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$responseData = curl_exec($ch);
if(curl_errno($ch)) {
return curl_error($ch);
}
curl_close($ch);
return $responseData;
}
$responseData = request();try:
from urllib.parse import urlencode
from urllib.request import build_opener, Request, HTTPHandler
from urllib.error import HTTPError, URLError
except ImportError:
from urllib import urlencode
from urllib2 import build_opener, Request, HTTPHandler, HTTPError, URLError
import json
def request():
url = "https://sandbox-card.peachpayments.com/v1/payments/{id}"
data = {
'entityId' : '8a8294174e735d0c014e78cf26461790',
'amount' : '92.00',
'paymentType' : 'CR',
'currency' : 'EUR'
}
try:
opener = build_opener(HTTPHandler)
request = Request(url, data=urlencode(data).encode('utf-8'))
request.add_header('Authorization', 'Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=')
request.get_method = lambda: 'POST'
response = opener.open(request)
return json.loads(response.read())
except HTTPError as e:
return json.loads(e.read())
except URLError as e:
return e.reason
responseData = request()
print(responseData)require 'net/https'
require 'uri'
require 'json'
def request()
uri = URI('https://sandbox-card.peachpayments.com/v1/payments/{id}')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Post.new(uri.path)
req.set_form_data({
'entityId' => '8a8294174e735d0c014e78cf26461790',
'amount' => '92.00',
'paymentType' => 'CR',
'currency' => 'EUR'
})
res = http.request(req)
return JSON.parse(res.body)
end
puts request()def initialPayment : String = {
val url = "https://sandbox-card.peachpayments.com/v1/payments/{id}"
val data = (""
+ "entityId=8a8294174e735d0c014e78cf26461790"
+ "&amount=92.00"
+ "&paymentType=CR"
+ "¤cy=EUR"
)
val conn = new URL(url).openConnection()
conn match {
case secureConn: HttpsURLConnection => secureConn.setRequestMethod("POST")
case _ => throw new ClassCastException
}
conn.setDoInput(true)
conn.setDoOutput(true)
IOUtils.write(data, conn.getOutputStream())
conn.setRequestProperty("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
conn.connect()
if (conn.getResponseCode() >= 400) {
return IOUtils.toString(conn.getErrorStream())
}
else {
return IOUtils.toString(conn.getInputStream())
}
}Public Function Request() As Dictionary(Of String, Object)
Dim url As String = "https://sandbox-card.peachpayments.com/v1/payments/{id}"
Dim data As String = "" +
"entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"&paymentType=CR" +
"¤cy=EUR"
Dim req As WebRequest = WebRequest.Create(url)
req.Method = "POST"
req.Headers.Add("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
req.ContentType = "application/x-www-form-urlencoded"
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(data)
req.ContentLength = byteArray.Length
Dim dataStream As Stream = req.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length)
dataStream.Close()
Dim res As WebResponse = req.GetResponse()
Dim resStream = res.GetResponseStream()
Dim reader As New StreamReader(resStream)
Dim response As String = reader.ReadToEnd()
reader.Close()
resStream.Close()
res.Close()
Dim jss As New System.Web.Script.Serialization.JavaScriptSerializer()
Dim dict As Dictionary(Of String, Object) = jss.Deserialize(Of Dictionary(Of String, Object))(response)
Return dict
End Function
responseData = Request()("result")("description"){
"id":"8ac7a4a29d29b86a019d2a477aa31b3f",
"referencedId":"8ac7a4a29d29b86a019d2a36e755023b",
"paymentType":"CR",
"amount":"92.00",
"currency":"EUR",
"descriptor":"8485.7444.5604 MAC_Channel",
"result":{
"code":"000.100.110",
"description":"Request successfully processed in 'Merchant in Integrator Test Mode'"
},
"customParameters":{
"PAYMENT_INHOUSE_FACADE":"true"
},
"buildNumber":"9092e7a6af8301accda2f9a3a38f743f907dadd5@2026-03-23 16:50:06 +0000",
"timestamp":"2026-03-26 13:13:40+0000",
"ndc":"8a8294174e735d0c014e78cf26461790_0f76bf574f67450680fbc308e0af38c2"
}Payout
The merchant processes standalone credit transactions, also known as standalone refunds, to transfer funds from their account to the customer's account without a corresponding debit transaction. This applies sometimes:
- Expired refund window: The refund period, 60 days, has passed, but the merchant still needs to return funds. For example, if a customer returns a product after 70 days, the merchant processes a standalone credit transaction.
- Billing error correction: A billing error occurred, requiring correction. For example, if you bill a customer twice for a single item, the merchant issues a standalone credit for the duplicate charge.
- Customer service gesture: The merchant provides a credit as a goodwill gesture. For example, if a customer had a poor experience, the merchant issues a credit as an apology to keep a positive relationship.
Unlike regular refunds, a standalone credit has no connection to any previous capture of funds. To issue a refund through a standalone credit, the merchant collects the cardholder's card and billing information. This ensures fairness and maintains customer satisfaction.
To know which acquirers or payment methods do support payment credit, contact support.
Payout shopper
Send a Server-to-Server POST request with the collected card, payment, and billing data. The payment details go through verification with the issuer, and the funds reach the customer's account. The response to a successful request includes an id, which the merchant keeps for potential refunds of the credited amount.
Sample request:
curl https://sandbox-card.peachpayments.com/v1/payments \
-d "entityId=8a8294174e735d0c014e78cf26461790" \
-d "amount=92.00" \
-d "currency=EUR" \
-d "paymentBrand=VISA" \
-d "paymentType=CD" \
-d "card.number=4200000000000000" \
-d "card.holder=Jane Jones" \
-d "card.expiryMonth=05" \
-d "card.expiryYear=2034" \
-d "card.cvv=123" \
-H "Authorization: Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ="public Dictionary<string, dynamic> Request() {
Dictionary<string, dynamic> responseData;
string data="entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"¤cy=EUR" +
"&paymentBrand=VISA" +
"&paymentType=DB" +
"&card.number=4200000000000000" +
"&card.holder=Jane Jones" +
"&card.expiryMonth=05" +
"&card.expiryYear=2034" +
"&card.cvv=123";
string url = "https://sandbox-card.peachpayments.com/v1/payments";
byte[] buffer = Encoding.ASCII.GetBytes(data);
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
request.Method = "POST";
request.Headers["Authorization"] = "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=";
request.ContentType = "application/x-www-form-urlencoded";
Stream PostData = request.GetRequestStream();
PostData.Write(buffer, 0, buffer.Length);
PostData.Close();
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
var s = new JavaScriptSerializer();
responseData = s.Deserialize<Dictionary<string, dynamic>>(reader.ReadToEnd());
reader.Close();
dataStream.Close();
}
return responseData;
}
responseData = Request()["result"]["description"];import groovy.json.JsonSlurper
public static String request() {
def data = "entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"¤cy=EUR" +
"&paymentBrand=VISA" +
"&paymentType=DB" +
"&card.number=4200000000000000" +
"&card.holder=Jane Jones" +
"&card.expiryMonth=05" +
"&card.expiryYear=2034" +
"&card.cvv=123"
def url = "https://sandbox-card.peachpayments.com/v1/payments".toURL()
def connection = url.openConnection()
connection.setRequestMethod("POST")
connection.setRequestProperty("Authorization","Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
connection.doOutput = true
connection.outputStream << data
def json = new JsonSlurper().parseText(connection.inputStream.text)
json
}
println request()private String request() throws IOException {
URL url = new URL("https://sandbox-card.peachpayments.com/v1/payments");
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=");
conn.setDoInput(true);
conn.setDoOutput(true);
String data = ""
+ "entityId=8a8294174e735d0c014e78cf26461790"
+ "&amount=92.00"
+ "¤cy=EUR"
+ "&paymentBrand=VISA"
+ "&paymentType=DB"
+ "&card.number=4200000000000000"
+ "&card.holder=Jane Jones"
+ "&card.expiryMonth=05"
+ "&card.expiryYear=2034"
+ "&card.cvv=123";
DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
wr.writeBytes(data);
wr.flush();
wr.close();
int responseCode = conn.getResponseCode();
InputStream is;
if (responseCode >= 400) is = conn.getErrorStream();
else is = conn.getInputStream();
return IOUtils.toString(is);
}const https = require('https');
const querystring = require('querystring');
const request = async () => {
const path='/v1/payments';
const data = querystring.stringify({
'entityId':'8a8294174e735d0c014e78cf26461790',
'amount':'92.00',
'currency':'EUR',
'paymentBrand':'VISA',
'paymentType':'DB',
'card.number':'4200000000000000',
'card.holder':'Jane Jones',
'card.expiryMonth':'05',
'card.expiryYear':'2034',
'card.cvv':'123'
});
const options = {
port: 443,
host: 'sandbox-card.peachpayments.com',
path: path,
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': data.length,
'Authorization':'Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ='
}
};
return new Promise((resolve, reject) => {
const postRequest = https.request(options, function(res) {
const buf = [];
res.on('data', chunk => {
buf.push(Buffer.from(chunk));
});
res.on('end', () => {
const jsonString = Buffer.concat(buf).toString('utf8');
try {
resolve(JSON.parse(jsonString));
} catch (error) {
reject(error);
}
});
});
postRequest.on('error', reject);
postRequest.write(data);
postRequest.end();
});
};
request().then(console.log).catch(console.error);function request() {
$url = "https://sandbox-card.peachpayments.com/v1/payments";
$data = "entityId=8a8294174e735d0c014e78cf26461790" .
"&amount=92.00" .
"¤cy=EUR" .
"&paymentBrand=VISA" .
"&paymentType=DB" .
"&card.number=4200000000000000" .
"&card.holder=Jane Jones" .
"&card.expiryMonth=05" .
"&card.expiryYear=2034" .
"&card.cvv=123";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization:Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ='));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);// this should be set to true in production
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$responseData = curl_exec($ch);
if(curl_errno($ch)) {
return curl_error($ch);
}
curl_close($ch);
return $responseData;
}
$responseData = request();try:
from urllib.parse import urlencode
from urllib.request import build_opener, Request, HTTPHandler
from urllib.error import HTTPError, URLError
except ImportError:
from urllib import urlencode
from urllib2 import build_opener, Request, HTTPHandler, HTTPError, URLError
import json
def request():
url = "https://sandbox-card.peachpayments.com/v1/payments"
data = {
'entityId' : '8a8294174e735d0c014e78cf26461790',
'amount' : '92.00',
'currency' : 'EUR',
'paymentBrand' : 'VISA',
'paymentType' : 'DB',
'card.number' : '4200000000000000',
'card.holder' : 'Jane Jones',
'card.expiryMonth' : '05',
'card.expiryYear' : '2034',
'card.cvv' : '123'
}
try:
opener = build_opener(HTTPHandler)
request = Request(url, data=urlencode(data).encode('utf-8'))
request.add_header('Authorization', 'Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=')
request.get_method = lambda: 'POST'
response = opener.open(request)
return json.loads(response.read())
except HTTPError as e:
return json.loads(e.read())
except URLError as e:
return e.reason
responseData = request()
print(responseData)require 'net/https'
require 'uri'
require 'json'
def request()
uri = URI('https://sandbox-card.peachpayments.com/v1/payments')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Post.new(uri.path)
req.set_form_data({
'entityId' => '8a8294174e735d0c014e78cf26461790',
'amount' => '92.00',
'currency' => 'EUR',
'paymentBrand' => 'VISA',
'paymentType' => 'DB',
'card.number' => '4200000000000000',
'card.holder' => 'Jane Jones',
'card.expiryMonth' => '05',
'card.expiryYear' => '2034',
'card.cvv' => '123'
})
res = http.request(req)
return JSON.parse(res.body)
end
puts request()def initialPayment : String = {
val url = "https://sandbox-card.peachpayments.com/v1/payments"
val data = (""
+ "entityId=8a8294174e735d0c014e78cf26461790"
+ "&amount=92.00"
+ "¤cy=EUR"
+ "&paymentBrand=VISA"
+ "&paymentType=DB"
+ "&card.number=4200000000000000"
+ "&card.holder=Jane Jones"
+ "&card.expiryMonth=05"
+ "&card.expiryYear=2034"
+ "&card.cvv=123"
)
val conn = new URL(url).openConnection()
conn match {
case secureConn: HttpsURLConnection => secureConn.setRequestMethod("POST")
case _ => throw new ClassCastException
}
conn.setDoInput(true)
conn.setDoOutput(true)
IOUtils.write(data, conn.getOutputStream())
conn.setRequestProperty("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
conn.connect()
if (conn.getResponseCode() >= 400) {
return IOUtils.toString(conn.getErrorStream())
}
else {
return IOUtils.toString(conn.getInputStream())
}
}Public Function Request() As Dictionary(Of String, Object)
Dim url As String = "https://sandbox-card.peachpayments.com/v1/payments"
Dim data As String = "" +
"entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"¤cy=EUR" +
"&paymentBrand=VISA" +
"&paymentType=DB" +
"&card.number=4200000000000000" +
"&card.holder=Jane Jones" +
"&card.expiryMonth=05" +
"&card.expiryYear=2034" +
"&card.cvv=123"
Dim req As WebRequest = WebRequest.Create(url)
req.Method = "POST"
req.Headers.Add("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
req.ContentType = "application/x-www-form-urlencoded"
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(data)
req.ContentLength = byteArray.Length
Dim dataStream As Stream = req.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length)
dataStream.Close()
Dim res As WebResponse = req.GetResponse()
Dim resStream = res.GetResponseStream()
Dim reader As New StreamReader(resStream)
Dim response As String = reader.ReadToEnd()
reader.Close()
resStream.Close()
res.Close()
Dim jss As New System.Web.Script.Serialization.JavaScriptSerializer()
Dim dict As Dictionary(Of String, Object) = jss.Deserialize(Of Dictionary(Of String, Object))(response)
Return dict
End Function
responseData = Request()("result")("description")Rebill
Payment rebill means charging a customer the right amount for something they bought. This applies in three cases:
- Estimated and incremental authorisations: The final sale price differs from the estimated price at the time of purchase. For example, services like taxi rides or hotel stays may have variable costs that become clear after completion.
- Incorrect refund: A customer receives a refund greater than what they paid. For instance, a product sold for $10 gets mistakenly refunded for $20.
- Incorrect chargeback: A customer files a chargeback but is not entitled to it. For example, they claim they never received a product, but you have proof of delivery.
Rebill payments prevent customer confusion and financial loss.
A rebill differs from a chargeback reversal. A chargeback reversal occurs when a merchant disputes a chargeback, and the issuing bank rules in their favour, restoring the funds. A rebill, however, charges a customer again, often due to the reasons mentioned above.
To know which acquirers or payment methods do support payment rebill, contact support.
1. Perform debit payment
Send a Server-to-Server POST request with the required payment data. The payment details undergo verification with the issuer, and the funds move to the merchant. The response includes an id, which the system should keep for future backoffice operations.
Sample request:
curl https://sandbox-card.peachpayments.com/v1/payments \
-d "entityId=8a8294174e735d0c014e78cf26461790" \
-d "amount=92.00" \
-d "currency=EUR" \
-d "paymentBrand=VISA" \
-d "paymentType=DB" \
-d "card.number=4200000000000000" \
-d "card.holder=Jane Jones" \
-d "card.expiryMonth=05" \
-d "card.expiryYear=2034" \
-d "card.cvv=123" \
-H "Authorization: Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ="public Dictionary<string, dynamic> Request() {
Dictionary<string, dynamic> responseData;
string data="entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"¤cy=EUR" +
"&paymentBrand=VISA" +
"&paymentType=DB" +
"&card.number=4200000000000000" +
"&card.holder=Jane Jones" +
"&card.expiryMonth=05" +
"&card.expiryYear=2034" +
"&card.cvv=123";
string url = "https://sandbox-card.peachpayments.com/v1/payments";
byte[] buffer = Encoding.ASCII.GetBytes(data);
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
request.Method = "POST";
request.Headers["Authorization"] = "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=";
request.ContentType = "application/x-www-form-urlencoded";
Stream PostData = request.GetRequestStream();
PostData.Write(buffer, 0, buffer.Length);
PostData.Close();
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
var s = new JavaScriptSerializer();
responseData = s.Deserialize<Dictionary<string, dynamic>>(reader.ReadToEnd());
reader.Close();
dataStream.Close();
}
return responseData;
}
responseData = Request()["result"]["description"];import groovy.json.JsonSlurper
public static String request() {
def data = "entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"¤cy=EUR" +
"&paymentBrand=VISA" +
"&paymentType=DB" +
"&card.number=4200000000000000" +
"&card.holder=Jane Jones" +
"&card.expiryMonth=05" +
"&card.expiryYear=2034" +
"&card.cvv=123"
def url = "https://sandbox-card.peachpayments.com/v1/payments".toURL()
def connection = url.openConnection()
connection.setRequestMethod("POST")
connection.setRequestProperty("Authorization","Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
connection.doOutput = true
connection.outputStream << data
def json = new JsonSlurper().parseText(connection.inputStream.text)
json
}
println request()private String request() throws IOException {
URL url = new URL("https://sandbox-card.peachpayments.com/v1/payments");
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=");
conn.setDoInput(true);
conn.setDoOutput(true);
String data = ""
+ "entityId=8a8294174e735d0c014e78cf26461790"
+ "&amount=92.00"
+ "¤cy=EUR"
+ "&paymentBrand=VISA"
+ "&paymentType=DB"
+ "&card.number=4200000000000000"
+ "&card.holder=Jane Jones"
+ "&card.expiryMonth=05"
+ "&card.expiryYear=2034"
+ "&card.cvv=123";
DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
wr.writeBytes(data);
wr.flush();
wr.close();
int responseCode = conn.getResponseCode();
InputStream is;
if (responseCode >= 400) is = conn.getErrorStream();
else is = conn.getInputStream();
return IOUtils.toString(is);
}const https = require('https');
const querystring = require('querystring');
const request = async () => {
const path='/v1/payments';
const data = querystring.stringify({
'entityId':'8a8294174e735d0c014e78cf26461790',
'amount':'92.00',
'currency':'EUR',
'paymentBrand':'VISA',
'paymentType':'DB',
'card.number':'4200000000000000',
'card.holder':'Jane Jones',
'card.expiryMonth':'05',
'card.expiryYear':'2034',
'card.cvv':'123'
});
const options = {
port: 443,
host: 'sandbox-card.peachpayments.com',
path: path,
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': data.length,
'Authorization':'Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ='
}
};
return new Promise((resolve, reject) => {
const postRequest = https.request(options, function(res) {
const buf = [];
res.on('data', chunk => {
buf.push(Buffer.from(chunk));
});
res.on('end', () => {
const jsonString = Buffer.concat(buf).toString('utf8');
try {
resolve(JSON.parse(jsonString));
} catch (error) {
reject(error);
}
});
});
postRequest.on('error', reject);
postRequest.write(data);
postRequest.end();
});
};
request().then(console.log).catch(console.error);function request() {
$url = "https://sandbox-card.peachpayments.com/v1/payments";
$data = "entityId=8a8294174e735d0c014e78cf26461790" .
"&amount=92.00" .
"¤cy=EUR" .
"&paymentBrand=VISA" .
"&paymentType=DB" .
"&card.number=4200000000000000" .
"&card.holder=Jane Jones" .
"&card.expiryMonth=05" .
"&card.expiryYear=2034" .
"&card.cvv=123";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization:Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ='));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);// this should be set to true in production
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$responseData = curl_exec($ch);
if(curl_errno($ch)) {
return curl_error($ch);
}
curl_close($ch);
return $responseData;
}
$responseData = request();try:
from urllib.parse import urlencode
from urllib.request import build_opener, Request, HTTPHandler
from urllib.error import HTTPError, URLError
except ImportError:
from urllib import urlencode
from urllib2 import build_opener, Request, HTTPHandler, HTTPError, URLError
import json
def request():
url = "https://sandbox-card.peachpayments.com/v1/payments"
data = {
'entityId' : '8a8294174e735d0c014e78cf26461790',
'amount' : '92.00',
'currency' : 'EUR',
'paymentBrand' : 'VISA',
'paymentType' : 'DB',
'card.number' : '4200000000000000',
'card.holder' : 'Jane Jones',
'card.expiryMonth' : '05',
'card.expiryYear' : '2034',
'card.cvv' : '123'
}
try:
opener = build_opener(HTTPHandler)
request = Request(url, data=urlencode(data).encode('utf-8'))
request.add_header('Authorization', 'Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=')
request.get_method = lambda: 'POST'
response = opener.open(request)
return json.loads(response.read())
except HTTPError as e:
return json.loads(e.read())
except URLError as e:
return e.reason
responseData = request()
print(responseData)require 'net/https'
require 'uri'
require 'json'
def request()
uri = URI('https://sandbox-card.peachpayments.com/v1/payments')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Post.new(uri.path)
req.set_form_data({
'entityId' => '8a8294174e735d0c014e78cf26461790',
'amount' => '92.00',
'currency' => 'EUR',
'paymentBrand' => 'VISA',
'paymentType' => 'DB',
'card.number' => '4200000000000000',
'card.holder' => 'Jane Jones',
'card.expiryMonth' => '05',
'card.expiryYear' => '2034',
'card.cvv' => '123'
})
res = http.request(req)
return JSON.parse(res.body)
end
puts request()def initialPayment : String = {
val url = "https://sandbox-card.peachpayments.com/v1/payments"
val data = (""
+ "entityId=8a8294174e735d0c014e78cf26461790"
+ "&amount=92.00"
+ "¤cy=EUR"
+ "&paymentBrand=VISA"
+ "&paymentType=DB"
+ "&card.number=4200000000000000"
+ "&card.holder=Jane Jones"
+ "&card.expiryMonth=05"
+ "&card.expiryYear=2034"
+ "&card.cvv=123"
)
val conn = new URL(url).openConnection()
conn match {
case secureConn: HttpsURLConnection => secureConn.setRequestMethod("POST")
case _ => throw new ClassCastException
}
conn.setDoInput(true)
conn.setDoOutput(true)
IOUtils.write(data, conn.getOutputStream())
conn.setRequestProperty("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
conn.connect()
if (conn.getResponseCode() >= 400) {
return IOUtils.toString(conn.getErrorStream())
}
else {
return IOUtils.toString(conn.getInputStream())
}
}Public Function Request() As Dictionary(Of String, Object)
Dim url As String = "https://sandbox-card.peachpayments.com/v1/payments"
Dim data As String = "" +
"entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=92.00" +
"¤cy=EUR" +
"&paymentBrand=VISA" +
"&paymentType=DB" +
"&card.number=4200000000000000" +
"&card.holder=Jane Jones" +
"&card.expiryMonth=05" +
"&card.expiryYear=2034" +
"&card.cvv=123"
Dim req As WebRequest = WebRequest.Create(url)
req.Method = "POST"
req.Headers.Add("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
req.ContentType = "application/x-www-form-urlencoded"
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(data)
req.ContentLength = byteArray.Length
Dim dataStream As Stream = req.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length)
dataStream.Close()
Dim res As WebResponse = req.GetResponse()
Dim resStream = res.GetResponseStream()
Dim reader As New StreamReader(resStream)
Dim response As String = reader.ReadToEnd()
reader.Close()
resStream.Close()
res.Close()
Dim jss As New System.Web.Script.Serialization.JavaScriptSerializer()
Dim dict As Dictionary(Of String, Object) = jss.Deserialize(Of Dictionary(Of String, Object))(response)
Return dict
End Function
responseData = Request()("result")("description"){
"id":"8ac7a49f9d2a4aa7019d2a4e7e5006cc",
"paymentType":"DB",
"paymentBrand":"VISA",
"amount":"92.00",
"currency":"EUR",
"descriptor":"6964.9849.3476 MAC_Channel ",
"result":{
"code":"000.100.110",
"description":"Request successfully processed in 'Merchant in Integrator Test Mode'"
},
"resultDetails":{
"Payment Status":"CLO",
"ConnectorTxID1":"payment_55cd30eb3b5a499b3a3a2f5b6cf3f11a",
"Cvv Check":"unchecked",
"Transaction Status":"SUCCESS",
"ConnectorTxID3":"123456",
"Amount":"0.0",
"Operation Id":"64403c94-0978-4d5f-abd7-28a4e5d99556",
"Payment Method Category":"card",
"CardholderInitiatedTransactionID":"123456",
"ExtendedDescription":"Transaction succeeded",
"Customer Token":"cus_4d184daa989cac82224b856bac739b60",
"Paid Amount":"0.0",
"Payment Account Reference":"V001NPX3IQC6OFS2TAWCVD2WTXRWY",
"Sender Details":"{\"address\":\"null\",\"firstName\":\"null\",\"lastName\":\"null\",\"postcode\":\"null\",\"city\":\"AE\",\"state\":\"null\",\"country\":\"null\",\"companyName\":\"null\"}",
"AcquirerResponse":"SUCCESS",
"Beneficiary Details":"{\"firstName\":\"null\",\"lastName\":\"null\",\"address\":\"null\",\"dob\":\"null\",\"gender\":\"null\",\"email\":\"null\",\"state\":\"null\",\"cardNumber\":\"null\",\"cardExpirationMonth\":\"null\",\"cardExpirationYear\":\"null\",\"nationality\":\"null\",\"city\":\"NY\",\"postcode\":\"null\",\"identificationType\":\"null\",\"identificationValue\":\"null\"\"category\":\"null\"}",
"Statement Descriptor":"044153838562 Rapyd Nat"
},
"card":{
"bin":"420000",
"last4Digits":"0000",
"holder":"Jane Jones",
"expiryMonth":"05",
"expiryYear":"2034"
},
"customParameters":{
"PAYMENT_INHOUSE_FACADE":"true"
},
"risk":{
"score":"100"
},
"buildNumber":"9092e7a6af8301accda2f9a3a38f743f907dadd5@2026-03-23 16:50:06 +0000",
"timestamp":"2026-03-26 13:21:20+0000",
"ndc":"8a8294174e735d0c014e78cf26461790_de4f0e2fa72f451c976f068e45c48ab7"
}2. Rebill the authorised payment
Send a Server-to-Server POST request using the id of an authorised payment. The merchant may add charges not included in the original authorisation, such as extra services or products.
A rebill transaction increases the total charged amount beyond the initially authorised and captured sum. For example, if the original transaction was £100 and an extra charge of £20 applies, the total charge becomes £120. This process allows the merchant to collect the extra £20 without requesting a new authorisation from the customer.
Sample request:
https://sandbox-card.peachpayments.com/v1/payments/8ac7a49f9d2a4aa7019d2a4e7e5006cc
curl https://sandbox-card.peachpayments.com/v1/payments/{id} \
-d "entityId=8a8294174e735d0c014e78cf26461790" \
-d "amount=10.00" \
-d "paymentType=RB" \
-d "currency=EUR" \
-H "Authorization: Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ="public Dictionary<string, dynamic> Request() {
Dictionary<string, dynamic> responseData;
string data="entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=10.00" +
"&paymentType=RB" +
"¤cy=EUR";
string url = "https://sandbox-card.peachpayments.com/v1/payments/{id}";
byte[] buffer = Encoding.ASCII.GetBytes(data);
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
request.Method = "POST";
request.Headers["Authorization"] = "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=";
request.ContentType = "application/x-www-form-urlencoded";
Stream PostData = request.GetRequestStream();
PostData.Write(buffer, 0, buffer.Length);
PostData.Close();
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
var s = new JavaScriptSerializer();
responseData = s.Deserialize<Dictionary<string, dynamic>>(reader.ReadToEnd());
reader.Close();
dataStream.Close();
}
return responseData;
}
responseData = Request()["result"]["description"];import groovy.json.JsonSlurper
public static String request() {
def data = "entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=10.00" +
"&paymentType=RB" +
"¤cy=EUR"
def url = "https://sandbox-card.peachpayments.com/v1/payments/{id}".toURL()
def connection = url.openConnection()
connection.setRequestMethod("POST")
connection.setRequestProperty("Authorization","Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
connection.doOutput = true
connection.outputStream << data
def json = new JsonSlurper().parseText(connection.inputStream.text)
json
}
println request()private String request() throws IOException {
URL url = new URL("https://sandbox-card.peachpayments.com/v1/payments/{id}");
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=");
conn.setDoInput(true);
conn.setDoOutput(true);
String data = ""
+ "entityId=8a8294174e735d0c014e78cf26461790"
+ "&amount=10.00"
+ "&paymentType=RB"
+ "¤cy=EUR";
DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
wr.writeBytes(data);
wr.flush();
wr.close();
int responseCode = conn.getResponseCode();
InputStream is;
if (responseCode >= 400) is = conn.getErrorStream();
else is = conn.getInputStream();
return IOUtils.toString(is);
}const https = require('https');
const querystring = require('querystring');
const request = async () => {
const path='/v1/payments/{id}';
const data = querystring.stringify({
'entityId':'8a8294174e735d0c014e78cf26461790',
'amount':'10.00',
'paymentType':'RB',
'currency':'EUR'
});
const options = {
port: 443,
host: 'sandbox-card.peachpayments.com',
path: path,
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': data.length,
'Authorization':'Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ='
}
};
return new Promise((resolve, reject) => {
const postRequest = https.request(options, function(res) {
const buf = [];
res.on('data', chunk => {
buf.push(Buffer.from(chunk));
});
res.on('end', () => {
const jsonString = Buffer.concat(buf).toString('utf8');
try {
resolve(JSON.parse(jsonString));
} catch (error) {
reject(error);
}
});
});
postRequest.on('error', reject);
postRequest.write(data);
postRequest.end();
});
};
request().then(console.log).catch(console.error);function request() {
$url = "https://sandbox-card.peachpayments.com/v1/payments/{id}";
$data = "entityId=8a8294174e735d0c014e78cf26461790" .
"&amount=10.00" .
"&paymentType=RB" .
"¤cy=EUR";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization:Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ='));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);// this should be set to true in production
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$responseData = curl_exec($ch);
if(curl_errno($ch)) {
return curl_error($ch);
}
curl_close($ch);
return $responseData;
}
$responseData = request();try:
from urllib.parse import urlencode
from urllib.request import build_opener, Request, HTTPHandler
from urllib.error import HTTPError, URLError
except ImportError:
from urllib import urlencode
from urllib2 import build_opener, Request, HTTPHandler, HTTPError, URLError
import json
def request():
url = "https://sandbox-card.peachpayments.com/v1/payments/{id}"
data = {
'entityId' : '8a8294174e735d0c014e78cf26461790',
'amount' : '10.00',
'paymentType' : 'RB',
'currency' : 'EUR'
}
try:
opener = build_opener(HTTPHandler)
request = Request(url, data=urlencode(data).encode('utf-8'))
request.add_header('Authorization', 'Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=')
request.get_method = lambda: 'POST'
response = opener.open(request)
return json.loads(response.read())
except HTTPError as e:
return json.loads(e.read())
except URLError as e:
return e.reason
responseData = request()
print(responseData)require 'net/https'
require 'uri'
require 'json'
def request()
uri = URI('https://sandbox-card.peachpayments.com/v1/payments/{id}')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Post.new(uri.path)
req.set_form_data({
'entityId' => '8a8294174e735d0c014e78cf26461790',
'amount' => '10.00',
'paymentType' => 'RB',
'currency' => 'EUR'
})
res = http.request(req)
return JSON.parse(res.body)
end
puts request()def initialPayment : String = {
val url = "https://sandbox-card.peachpayments.com/v1/payments/{id}"
val data = (""
+ "entityId=8a8294174e735d0c014e78cf26461790"
+ "&amount=10.00"
+ "&paymentType=RB"
+ "¤cy=EUR"
)
val conn = new URL(url).openConnection()
conn match {
case secureConn: HttpsURLConnection => secureConn.setRequestMethod("POST")
case _ => throw new ClassCastException
}
conn.setDoInput(true)
conn.setDoOutput(true)
IOUtils.write(data, conn.getOutputStream())
conn.setRequestProperty("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
conn.connect()
if (conn.getResponseCode() >= 400) {
return IOUtils.toString(conn.getErrorStream())
}
else {
return IOUtils.toString(conn.getInputStream())
}
}Public Function Request() As Dictionary(Of String, Object)
Dim url As String = "https://sandbox-card.peachpayments.com/v1/payments/{id}"
Dim data As String = "" +
"entityId=8a8294174e735d0c014e78cf26461790" +
"&amount=10.00" +
"&paymentType=RB" +
"¤cy=EUR"
Dim req As WebRequest = WebRequest.Create(url)
req.Method = "POST"
req.Headers.Add("Authorization", "Bearer OGE4Mjk0MTc0ZTczNWQwYzAxNGU3OGNmMjY2YjE3OTR8SFV3I3JGQTQ9bWpxaWYrPz9OWVQ=")
req.ContentType = "application/x-www-form-urlencoded"
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(data)
req.ContentLength = byteArray.Length
Dim dataStream As Stream = req.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length)
dataStream.Close()
Dim res As WebResponse = req.GetResponse()
Dim resStream = res.GetResponseStream()
Dim reader As New StreamReader(resStream)
Dim response As String = reader.ReadToEnd()
reader.Close()
resStream.Close()
res.Close()
Dim jss As New System.Web.Script.Serialization.JavaScriptSerializer()
Dim dict As Dictionary(Of String, Object) = jss.Deserialize(Of Dictionary(Of String, Object))(response)
Return dict
End Function
responseData = Request()("result")("description")Updated about 7 hours ago