Refund Split Payment
curl --request POST \
--url https://api.example.com/payments \
--header 'Content-Type: application/json' \
--data '
{
"data.type": "<string>",
"data.attributes.paymentType": "<string>",
"data.attributes.parentPaymentId": "<string>",
"data.attributes.transaction": {
"data.attributes.transaction.amount": "<string>",
"data.attributes.transaction.currency": "<string>"
}
}
'import requests
url = "https://api.example.com/payments"
payload = {
"data.type": "<string>",
"data.attributes.paymentType": "<string>",
"data.attributes.parentPaymentId": "<string>",
"data.attributes.transaction": {
"data.attributes.transaction.amount": "<string>",
"data.attributes.transaction.currency": "<string>"
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
'data.type': '<string>',
'data.attributes.paymentType': '<string>',
'data.attributes.parentPaymentId': '<string>',
'data.attributes.transaction': {
'data.attributes.transaction.amount': '<string>',
'data.attributes.transaction.currency': '<string>'
}
})
};
fetch('https://api.example.com/payments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/payments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data.type' => '<string>',
'data.attributes.paymentType' => '<string>',
'data.attributes.parentPaymentId' => '<string>',
'data.attributes.transaction' => [
'data.attributes.transaction.amount' => '<string>',
'data.attributes.transaction.currency' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/payments"
payload := strings.NewReader("{\n \"data.type\": \"<string>\",\n \"data.attributes.paymentType\": \"<string>\",\n \"data.attributes.parentPaymentId\": \"<string>\",\n \"data.attributes.transaction\": {\n \"data.attributes.transaction.amount\": \"<string>\",\n \"data.attributes.transaction.currency\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/payments")
.header("Content-Type", "application/json")
.body("{\n \"data.type\": \"<string>\",\n \"data.attributes.paymentType\": \"<string>\",\n \"data.attributes.parentPaymentId\": \"<string>\",\n \"data.attributes.transaction\": {\n \"data.attributes.transaction.amount\": \"<string>\",\n \"data.attributes.transaction.currency\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/payments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"data.type\": \"<string>\",\n \"data.attributes.paymentType\": \"<string>\",\n \"data.attributes.parentPaymentId\": \"<string>\",\n \"data.attributes.transaction\": {\n \"data.attributes.transaction.amount\": \"<string>\",\n \"data.attributes.transaction.currency\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_bodyPayments
Refund Split Payment
Refund the split portion of a payment
POST
/
payments
Refund Split Payment
curl --request POST \
--url https://api.example.com/payments \
--header 'Content-Type: application/json' \
--data '
{
"data.type": "<string>",
"data.attributes.paymentType": "<string>",
"data.attributes.parentPaymentId": "<string>",
"data.attributes.transaction": {
"data.attributes.transaction.amount": "<string>",
"data.attributes.transaction.currency": "<string>"
}
}
'import requests
url = "https://api.example.com/payments"
payload = {
"data.type": "<string>",
"data.attributes.paymentType": "<string>",
"data.attributes.parentPaymentId": "<string>",
"data.attributes.transaction": {
"data.attributes.transaction.amount": "<string>",
"data.attributes.transaction.currency": "<string>"
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
'data.type': '<string>',
'data.attributes.paymentType': '<string>',
'data.attributes.parentPaymentId': '<string>',
'data.attributes.transaction': {
'data.attributes.transaction.amount': '<string>',
'data.attributes.transaction.currency': '<string>'
}
})
};
fetch('https://api.example.com/payments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/payments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data.type' => '<string>',
'data.attributes.paymentType' => '<string>',
'data.attributes.parentPaymentId' => '<string>',
'data.attributes.transaction' => [
'data.attributes.transaction.amount' => '<string>',
'data.attributes.transaction.currency' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/payments"
payload := strings.NewReader("{\n \"data.type\": \"<string>\",\n \"data.attributes.paymentType\": \"<string>\",\n \"data.attributes.parentPaymentId\": \"<string>\",\n \"data.attributes.transaction\": {\n \"data.attributes.transaction.amount\": \"<string>\",\n \"data.attributes.transaction.currency\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/payments")
.header("Content-Type", "application/json")
.body("{\n \"data.type\": \"<string>\",\n \"data.attributes.paymentType\": \"<string>\",\n \"data.attributes.parentPaymentId\": \"<string>\",\n \"data.attributes.transaction\": {\n \"data.attributes.transaction.amount\": \"<string>\",\n \"data.attributes.transaction.currency\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/payments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"data.type\": \"<string>\",\n \"data.attributes.paymentType\": \"<string>\",\n \"data.attributes.parentPaymentId\": \"<string>\",\n \"data.attributes.transaction\": {\n \"data.attributes.transaction.amount\": \"<string>\",\n \"data.attributes.transaction.currency\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_bodyEndpoint
POST https://api.digitzs.com/payments
Overview
Use this endpoint to refund the split portion of a payment. This reverses the split amount that was distributed to a secondary merchant account.This endpoint only refunds the split amount, not the entire transaction. To refund the full payment, use both this endpoint and the regular refund endpoint.
Authentication
| Header | Value | Required |
|---|---|---|
x-api-key | Your API key | Yes |
Authorization | Bearer {appToken} | Yes |
appId | Your application ID | Yes |
Content-Type | application/json | Yes |
Request Body
Must be
"payments"Must be
"refundSplit"The payment ID of the original split transaction
Example Request
{
"data": {
"type": "payments",
"attributes": {
"paymentType": "refundSplit",
"parentPaymentId": "pay_split_abc123",
"transaction": {
"amount": "100",
"currency": "USD"
}
}
}
}
Response
{
"links": {
"self": "https://api.digitzs.com/payments"
},
"data": {
"type": "payments",
"id": "pay_refund_split_xyz",
"attributes": {
"paymentType": "refundSplit",
"transaction": {
"code": "0",
"message": "Success",
"amount": "100",
"currency": "USD"
}
}
}
}
Code Examples
curl -X POST https://api.digitzs.com/payments \
-H "x-api-key: your-api-key" \
-H "Authorization: Bearer your-app-token" \
-H "appId: your-app-id" \
-H "Content-Type: application/json" \
-d '{
"data": {
"type": "payments",
"attributes": {
"paymentType": "refundSplit",
"parentPaymentId": "pay_split_abc123",
"transaction": {
"amount": "100",
"currency": "USD"
}
}
}
}'
const axios = require('axios');
async function refundSplit(paymentId, amount) {
const response = await axios.post(
'https://api.digitzs.com/payments',
{
data: {
type: 'payments',
attributes: {
paymentType: 'refundSplit',
parentPaymentId: paymentId,
transaction: {
amount: amount,
currency: 'USD'
}
}
}
},
{
headers: {
'x-api-key': 'your-api-key',
'Authorization': 'Bearer your-app-token',
'appId': 'your-app-id'
}
}
);
return response.data;
}
import requests
def refund_split(payment_id, amount):
url = "https://api.digitzs.com/payments"
payload = {
"data": {
"type": "payments",
"attributes": {
"paymentType": "refundSplit",
"parentPaymentId": payment_id,
"transaction": {
"amount": amount,
"currency": "USD"
}
}
}
}
headers = {
"x-api-key": "your-api-key",
"Authorization": "Bearer your-app-token",
"appId": "your-app-id"
}
response = requests.post(url, headers=headers, json=payload)
return response.json()
<?php
function refundSplit($paymentId, $amount) {
$payload = json_encode([
"data" => [
"type" => "payments",
"attributes" => [
"paymentType" => "refundSplit",
"parentPaymentId" => $paymentId,
"transaction" => [
"amount" => $amount,
"currency" => "USD"
]
]
]
]);
$ch = curl_init("https://api.digitzs.com/payments");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"x-api-key: your-api-key",
"Authorization: Bearer your-app-token",
"appId: your-app-id"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
return json_decode(curl_exec($ch), true);
}
?>
require 'net/http'
require 'json'
def refund_split(payment_id, amount)
uri = URI('https://api.digitzs.com/payments')
request = Net::HTTP::Post.new(uri)
request['x-api-key'] = 'your-api-key'
request['Authorization'] = 'Bearer your-app-token'
request['appId'] = 'your-app-id'
request.body = {
data: {
type: 'payments',
attributes: {
paymentType: 'refundSplit',
parentPaymentId: payment_id,
transaction: {
amount: amount,
currency: 'USD'
}
}
}
}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
JSON.parse(response.body)
end
Important Notes
Split Only: This endpoint refunds only the split amount. To refund the entire transaction, you must also refund the primary payment separately.
Full Refund Process: For complete refunds of split payments: 1) Refund the split using this endpoint, 2) Refund the primary payment using the regular refund endpoint.
Next Steps
Refund Primary Payment
Refund the primary portion of a split payment
⌘I

