Authentication
All requests to the DanDanPay Reseller API are protected and require passing your workspace API key in the standard HTTP Authorization header:
Authorization: Bearer <YOUR_API_KEY>Accept: application/jsonContent-Type: application/jsonObtaining an API Key
Section titled “Obtaining an API Key”- Navigate to the management dashboard at dash.dandanpay.net.
- Open Workspace Settings → API Keys.
- Create a new key and store it in a secure location.
Authentication Error Format (HTTP 401)
Section titled “Authentication Error Format (HTTP 401)”If the Authorization header is missing, invalid, or expired, the API returns a standard ErrorResponseDto with HTTP status 401 Unauthorized:
1. Key Missing
Section titled “1. Key Missing”{ "code": "API_KEY_MISSING", "message": "API key missing"}2. Key Not Found / Invalid
Section titled “2. Key Not Found / Invalid”{ "code": "API_KEY_INVALID", "message": "Invalid API key"}3. Key Expired
Section titled “3. Key Expired”{ "code": "API_KEY_EXPIRED", "message": "API key expired"}Request Examples
Section titled “Request Examples”curl -X GET "https://api.dandanpay.net/v1/accounts" \ -H "Authorization: Bearer sk_live_your_api_key_here" \ -H "Accept: application/json"import axios from 'axios';
const api = axios.create({ baseURL: 'https://api.dandanpay.net/v1', headers: { 'Authorization': `Bearer ${process.env.DANDANPAY_API_KEY}`, 'Accept': 'application/json', 'Content-Type': 'application/json', }, timeout: 10000,});
async function checkBalance() { try { const { data } = await api.get('/accounts'); console.log('Workspace accounts:', data.results); } catch (err: any) { if (err.response?.status === 401) { console.error('Authentication error:', err.response.data); } }}import osimport requests
API_KEY = os.environ.get("DANDANPAY_API_KEY")
headers = { "Authorization": f"Bearer {API_KEY}", "Accept": "application/json", "Content-Type": "application/json",}
response = requests.get("https://api.dandanpay.net/v1/accounts", headers=headers, timeout=10)
if response.status_code == 200: print("Accounts:", response.json()["results"])else: print(f"Error {response.status_code}:", response.json())package main
import ( "encoding/json" "fmt" "io" "net/http" "os")
func main() { apiKey := os.Getenv("DANDANPAY_API_KEY")
req, _ := http.NewRequest("GET", "https://api.dandanpay.net/v1/accounts", nil) req.Header.Set("Authorization", "Bearer "+apiKey) req.Header.Set("Accept", "application/json")
client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body) fmt.Printf("Status: %d\nBody: %s\n", resp.StatusCode, string(body))}