Create Second Split
curl --request POST \
--url https://api.example.com/payments \
--header 'Content-Type: application/json' \
--data '
{
"data.type": "<string>",
"data.attributes": {},
"data.attributes.paymentType": "<string>",
"data.attributes.parentPaymentId": "<string>",
"data.attributes.split": {
"data.attributes.split.merchantId": "<string>",
"data.attributes.split.amount": "<string>"
},
"data.attributes.miscData": "<string>"
}
'import requests
url = "https://api.example.com/payments"
payload = {
"data.type": "<string>",
"data.attributes": {},
"data.attributes.paymentType": "<string>",
"data.attributes.parentPaymentId": "<string>",
"data.attributes.split": {
"data.attributes.split.merchantId": "<string>",
"data.attributes.split.amount": "<string>"
},
"data.attributes.miscData": "<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': {},
'data.attributes.paymentType': '<string>',
'data.attributes.parentPaymentId': '<string>',
'data.attributes.split': {
'data.attributes.split.merchantId': '<string>',
'data.attributes.split.amount': '<string>'
},
'data.attributes.miscData': '<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' => [
],
'data.attributes.paymentType' => '<string>',
'data.attributes.parentPaymentId' => '<string>',
'data.attributes.split' => [
'data.attributes.split.merchantId' => '<string>',
'data.attributes.split.amount' => '<string>'
],
'data.attributes.miscData' => '<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\": {},\n \"data.attributes.paymentType\": \"<string>\",\n \"data.attributes.parentPaymentId\": \"<string>\",\n \"data.attributes.split\": {\n \"data.attributes.split.merchantId\": \"<string>\",\n \"data.attributes.split.amount\": \"<string>\"\n },\n \"data.attributes.miscData\": \"<string>\"\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\": {},\n \"data.attributes.paymentType\": \"<string>\",\n \"data.attributes.parentPaymentId\": \"<string>\",\n \"data.attributes.split\": {\n \"data.attributes.split.merchantId\": \"<string>\",\n \"data.attributes.split.amount\": \"<string>\"\n },\n \"data.attributes.miscData\": \"<string>\"\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\": {},\n \"data.attributes.paymentType\": \"<string>\",\n \"data.attributes.parentPaymentId\": \"<string>\",\n \"data.attributes.split\": {\n \"data.attributes.split.merchantId\": \"<string>\",\n \"data.attributes.split.amount\": \"<string>\"\n },\n \"data.attributes.miscData\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyPayments
Create Second Split
Add an additional split to an existing transaction
POST
/
payments
Create Second Split
curl --request POST \
--url https://api.example.com/payments \
--header 'Content-Type: application/json' \
--data '
{
"data.type": "<string>",
"data.attributes": {},
"data.attributes.paymentType": "<string>",
"data.attributes.parentPaymentId": "<string>",
"data.attributes.split": {
"data.attributes.split.merchantId": "<string>",
"data.attributes.split.amount": "<string>"
},
"data.attributes.miscData": "<string>"
}
'import requests
url = "https://api.example.com/payments"
payload = {
"data.type": "<string>",
"data.attributes": {},
"data.attributes.paymentType": "<string>",
"data.attributes.parentPaymentId": "<string>",
"data.attributes.split": {
"data.attributes.split.merchantId": "<string>",
"data.attributes.split.amount": "<string>"
},
"data.attributes.miscData": "<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': {},
'data.attributes.paymentType': '<string>',
'data.attributes.parentPaymentId': '<string>',
'data.attributes.split': {
'data.attributes.split.merchantId': '<string>',
'data.attributes.split.amount': '<string>'
},
'data.attributes.miscData': '<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' => [
],
'data.attributes.paymentType' => '<string>',
'data.attributes.parentPaymentId' => '<string>',
'data.attributes.split' => [
'data.attributes.split.merchantId' => '<string>',
'data.attributes.split.amount' => '<string>'
],
'data.attributes.miscData' => '<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\": {},\n \"data.attributes.paymentType\": \"<string>\",\n \"data.attributes.parentPaymentId\": \"<string>\",\n \"data.attributes.split\": {\n \"data.attributes.split.merchantId\": \"<string>\",\n \"data.attributes.split.amount\": \"<string>\"\n },\n \"data.attributes.miscData\": \"<string>\"\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\": {},\n \"data.attributes.paymentType\": \"<string>\",\n \"data.attributes.parentPaymentId\": \"<string>\",\n \"data.attributes.split\": {\n \"data.attributes.split.merchantId\": \"<string>\",\n \"data.attributes.split.amount\": \"<string>\"\n },\n \"data.attributes.miscData\": \"<string>\"\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\": {},\n \"data.attributes.paymentType\": \"<string>\",\n \"data.attributes.parentPaymentId\": \"<string>\",\n \"data.attributes.split\": {\n \"data.attributes.split.merchantId\": \"<string>\",\n \"data.attributes.split.amount\": \"<string>\"\n },\n \"data.attributes.miscData\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyEndpoint
POST https://api.digitzs.com/payments
Overview
Use this endpoint to perform a second split on an existing transaction. This allows you to distribute proceeds to a third merchant account after the original payment has been processed.This feature requires special configuration. Contact Digitzs support to enable second split functionality for your merchant accounts.
Authentication
| Header | Value | Required |
|---|---|---|
x-api-key | Your API key from onboarding | Yes |
Authorization | Bearer {appToken} | Yes |
appId | Your application ID | Yes |
Content-Type | application/json | Yes |
Request Body
Must be
"payments"Container for payment attributes
Must be
"secondSplit"The payment ID of the original transaction to split from
Optional JSON string with additional metadata
Example Request
{
"data": {
"type": "payments",
"attributes": {
"paymentType": "secondSplit",
"parentPaymentId": "pay_abc123xyz",
"split": {
"merchantId": "merchant_third_789",
"amount": "50"
},
"miscData": "{\"reason\":\"referral_fee\"}"
}
}
}
Response
Success Response (201 Created)
{
"links": {
"self": "https://api.digitzs.com/payments"
},
"data": {
"type": "payments",
"id": "pay_split2_xyz789",
"attributes": {
"paymentType": "secondSplit",
"parentPaymentId": "pay_abc123xyz",
"transaction": {
"code": "0",
"message": "Success",
"amount": "50",
"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": "secondSplit",
"parentPaymentId": "pay_abc123xyz",
"split": {
"merchantId": "merchant_third_789",
"amount": "50"
}
}
}
}'
const axios = require('axios');
async function createSecondSplit(parentPaymentId, merchantId, amount) {
const response = await axios.post(
'https://api.digitzs.com/payments',
{
data: {
type: 'payments',
attributes: {
paymentType: 'secondSplit',
parentPaymentId: parentPaymentId,
split: {
merchantId: merchantId,
amount: amount
}
}
}
},
{
headers: {
'x-api-key': 'your-api-key',
'Authorization': 'Bearer your-app-token',
'appId': 'your-app-id',
'Content-Type': 'application/json'
}
}
);
console.log('Second Split ID:', response.data.data.id);
return response.data;
}
createSecondSplit('pay_abc123xyz', 'merchant_third_789', '50');
import requests
def create_second_split(parent_payment_id, merchant_id, amount):
url = "https://api.digitzs.com/payments"
headers = {
"x-api-key": "your-api-key",
"Authorization": "Bearer your-app-token",
"appId": "your-app-id",
"Content-Type": "application/json"
}
payload = {
"data": {
"type": "payments",
"attributes": {
"paymentType": "secondSplit",
"parentPaymentId": parent_payment_id,
"split": {
"merchantId": merchant_id,
"amount": amount
}
}
}
}
response = requests.post(url, headers=headers, json=payload)
response.raise_for_status()
return response.json()
create_second_split("pay_abc123xyz", "merchant_third_789", "50")
<?php
function createSecondSplit($parentPaymentId, $merchantId, $amount) {
$url = "https://api.digitzs.com/payments";
$headers = [
"x-api-key: your-api-key",
"Authorization: Bearer your-app-token",
"appId: your-app-id",
"Content-Type: application/json"
];
$payload = json_encode([
"data" => [
"type" => "payments",
"attributes" => [
"paymentType" => "secondSplit",
"parentPaymentId" => $parentPaymentId,
"split" => [
"merchantId" => $merchantId,
"amount" => $amount
]
]
]
]);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
return json_decode($response, true);
}
createSecondSplit("pay_abc123xyz", "merchant_third_789", "50");
?>
require 'net/http'
require 'json'
require 'uri'
def create_second_split(parent_payment_id, merchant_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['Content-Type'] = 'application/json'
request.body = {
data: {
type: 'payments',
attributes: {
paymentType: 'secondSplit',
parentPaymentId: parent_payment_id,
split: {
merchantId: merchant_id,
amount: amount
}
}
}
}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
JSON.parse(response.body)
end
create_second_split('pay_abc123xyz', 'merchant_third_789', '50')
Important Notes
Configuration Required: Second split functionality must be enabled for your merchant accounts. Contact Digitzs support before using this feature.
Available Balance: The second split amount cannot exceed the available balance after the first split and processing fees.
Use Case: This is useful for complex revenue sharing scenarios like referral fees, affiliate commissions, or multi-party marketplaces.
Best Practices
- Verify Parent Payment: Ensure the parent payment has settled before creating a second split
- Track All Splits: Maintain records of all split transactions for reconciliation
- Validate Amount: Check that sufficient funds remain for the second split
- Clear Documentation: Document the reason for each split in the miscData field
Next Steps
Get Payment Details
View complete payment details including all splits
⌘I

