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

ParameterTypeRequiredDescription
account_idstringYesRecipient account identifier
amountnumberYesPayout amount
currencystringYesCurrency code (USD, KHR)
descriptionstringNoPayout 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)
}

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 processed
  • completed - Payout successfully transferred
  • failed - 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