Skip to main content
POST
/
payments

Endpoint

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

HeaderValueRequired
x-api-keyYour API key from onboardingYes
AuthorizationBearer {appToken}Yes
appIdYour application IDYes
Content-Typeapplication/jsonYes

Request Body

data.type
string
required
Must be "payments"
data.attributes
object
required
Container for payment attributes
data.attributes.paymentType
string
required
Must be "secondSplit"
data.attributes.parentPaymentId
string
required
The payment ID of the original transaction to split from
data.attributes.split
object
required
Split configuration
data.attributes.miscData
string
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"
        }
      }
    }
  }'

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

  1. Verify Parent Payment: Ensure the parent payment has settled before creating a second split
  2. Track All Splits: Maintain records of all split transactions for reconciliation
  3. Validate Amount: Check that sufficient funds remain for the second split
  4. Clear Documentation: Document the reason for each split in the miscData field

Next Steps

Get Payment Details

View complete payment details including all splits