Api References
Payout
Processes a payout to a specified account.
Endpoint
POST https://merchant.dv.vai247.pro/api/v1/payment-gateway/order/payout
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
account_id | string | Yes | Recipient account identifier |
amount | number | Yes | Payout amount |
currency | string | Yes | Currency code (USD, KHR) |
description | string | No | Payout description |
Code Examples
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"time"
)
type PayoutRequest struct {
AccountID string `json:"account_id"`
Amount float64 `json:"amount"`
Currency string `json:"currency"`
Description string `json:"description,omitempty"`
}
type PayoutResponse struct {
PayoutID string `json:"payout_id"`
AccountID string `json:"account_id"`
Amount float64 `json:"amount"`
Currency string `json:"currency"`
Status string `json:"status"`
CreatedAt string `json:"created_at"`
}
func processPayout(accountID string, amount float64, currency string, description string) (*PayoutResponse, error) {
url := "https://merchant.dv.vai247.pro/api/v1/payment-gateway/order/payout"
payload := PayoutRequest{
AccountID: accountID,
Amount: amount,
Currency: currency,
Description: description,
}
jsonData, err := json.Marshal(payload)
if err != nil {
return nil, err
}
req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
if err != nil {
return nil, err
}
// Add authentication headers
req.Header.Set("X-App-Id", "your-app-id")
req.Header.Set("X-Api-Key", "your-api-key")
req.Header.Set("X-Timestamp", fmt.Sprintf("%d", time.Now().Unix()))
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
}
var result PayoutResponse
if err := json.Unmarshal(body, &result); err != nil {
return nil, err
}
return &result, nil
}
func main() {
payout, err := processPayout("acc_123", 200.00, "USD", "Monthly commission")
if err != nil {
fmt.Printf("Error: %v\n", err)
return
}
fmt.Printf("Payout ID: %s\n", payout.PayoutID)
fmt.Printf("Status: %s\n", payout.Status)
fmt.Printf("Amount: %.2f %s\n", payout.Amount, payout.Currency)
}
const axios = require('axios');
async function processPayout(accountId, amount, currency, description = '') {
const url = 'https://merchant.dv.vai247.pro/api/v1/payment-gateway/order/payout';
const headers = {
'X-App-Id': 'your-app-id',
'X-Api-Key': 'your-api-key',
'X-Timestamp': Math.floor(Date.now() / 1000).toString(),
'Content-Type': 'application/json'
};
const payload = {
account_id: accountId,
amount: amount,
currency: currency,
...(description && { description })
};
try {
const response = await axios.post(url, payload, { headers });
return response.data;
} catch (error) {
console.error('Error processing payout:', error.response?.data || error.message);
throw error;
}
}
// Usage
(async () => {
try {
const payout = await processPayout('acc_123', 200.00, 'USD', 'Monthly commission');
console.log('Payout ID:', payout.payout_id);
console.log('Status:', payout.status);
console.log('Amount:', `${payout.amount} ${payout.currency}`);
} catch (error) {
console.error('Failed to process payout');
}
})();
Response
{
"payout_id": "payout_xyz789",
"account_id": "acc_123",
"amount": 200.00,
"currency": "USD",
"status": "processing",
"created_at": "2025-10-04T12:00:00Z"
}
Payout Statuses
processing- Payout initiated and being processedcompleted- Payout successfully transferredfailed- Payout failed (insufficient funds, invalid account, etc.)
Notes
- Verify account balance before initiating payouts
- Payouts typically process within 1-2 business days
- Failed payouts are automatically reversed