Api References
Create Payment Order
Creates a new payment order with QR code generation.
Endpoint
POST https://merchant.dv.vai247.pro/api/v1/payment-gateway/order/create
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
store_id | string | Yes | Your store identifier |
amount | number | Yes | Payment amount |
currency | string | Yes | Currency code (USD, KHR) |
Code Examples
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"time"
)
type CreateOrderRequest struct {
StoreID string `json:"store_id"`
Amount float64 `json:"amount"`
Currency string `json:"currency"`
}
type CreateOrderResponse struct {
OrderID string `json:"order_id"`
QRCode string `json:"qr_code"`
Status string `json:"status"`
CreatedAt string `json:"created_at"`
}
func createOrder(storeID string, amount float64, currency string) (*CreateOrderResponse, error) {
url := "https://merchant.dv.vai247.pro/api/v1/payment-gateway/order/create"
payload := CreateOrderRequest{
StoreID: storeID,
Amount: amount,
Currency: currency,
}
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 CreateOrderResponse
if err := json.Unmarshal(body, &result); err != nil {
return nil, err
}
return &result, nil
}
func main() {
order, err := createOrder("store-123", 100.00, "USD")
if err != nil {
fmt.Printf("Error: %v\n", err)
return
}
fmt.Printf("Order ID: %s\n", order.OrderID)
fmt.Printf("QR Code: %s\n", order.QRCode)
}
const axios = require('axios');
async function createOrder(storeId, amount, currency) {
const url = 'https://merchant.dv.vai247.pro/api/v1/payment-gateway/order/create';
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 = {
store_id: storeId,
amount: amount,
currency: currency
};
try {
const response = await axios.post(url, payload, { headers });
return response.data;
} catch (error) {
console.error('Error creating order:', error.response?.data || error.message);
throw error;
}
}
// Usage
(async () => {
try {
const order = await createOrder('store-123', 100.00, 'USD');
console.log('Order ID:', order.order_id);
console.log('QR Code:', order.qr_code);
} catch (error) {
console.error('Failed to create order');
}
})();
Response
{
"order_id": "ord_abc123xyz",
"qr_code": "https://api.dvpay.com/qr/abc123",
"status": "pending",
"created_at": "2025-10-04T10:30:00Z"
}
Supported Currencies
USD- US DollarKHR- Cambodian Riel