Version 1.9.0

Documentation API YoTopupin

Selamat datang di dokumentasi integrasi API YoTopupin. Panduan ini akan membantu Anda memahami cara mengintegrasikan layanan kami dengan mudah dan efisien.


Getting Started

Untuk memulai integrasi, tersedia satu metode yaitu melalui API menggunakan metode POST. Anda akan membutuhkan API TOKEN serta IP Whitelist untuk dapat mengakses layanan ini.

BASE URL

- https://sakuin.id


API

Endpoint
/api/v1/balance
Headers
Content-Type: application/json
Authorization: Bearer {API_TOKEN}
Request Body
No Request Body
cURL
curl -X POST "{BASE_URL}/api/v1/balance" \
-H "Authorization: Bearer {API_TOKEN}" \
-H "Content-Type: application/json"
Example Code
const axios = require('axios');
const BASE_URL = 'YOUR_BASE_URL';
const API_TOKEN = 'YOUR_API_TOKEN';
 
async function getBalance() {
  try {
    const response = await axios.post(
      `${BASE_URL}/api/v1/balance`,
      null, // No request body
      {
        headers: {
          'Authorization': `Bearer ${API_TOKEN}`,
          'Content-Type': 'application/json'
        }
    });
    console.log('Response:', response.data);
  } catch (error) {
    console.error('Error:', error.response?.data || error.message);
  }
}
getBalance();
Response
{
  "error": false,
  "code": 200,
  "message": "Success",
  "data": {
    "name": "Admin Sakuin",
    "telp": "6282337532747",
    "membership": "Member",
    "balance": 0
  }
}
Endpoint
/api/v1/product
Headers
Content-Type: application/json
Authorization: Bearer {API_TOKEN}
Request Body
No Request Body
cURL
curl -X POST "{BASE_URL}/api/v1/product" \
-H "Authorization: Bearer {API_TOKEN}" \
-H "Content-Type: application/json"
Example Code
const axios = require('axios');
const BASE_URL = 'YOUR_BASE_URL';
const API_TOKEN = 'YOUR_API_TOKEN';
 
async function getProducts() {
  try {
    const response = await axios.post(
      `${BASE_URL}/api/v1/product`,
      null, // No request body
      {
        headers: {
          'Authorization': `Bearer ${API_TOKEN}`,
          'Content-Type': 'application/json'
        }
    });
    console.log('Response:', response.data);
  } catch (error) {
    console.error('Error:', error.response?.data || error.message);
  }
}
getProducts();
Response
{
  "error": false,
  "code": 200,
  "message": "Success",
  "data": [
    {
      "code": "free-fire",
      "name": "FREE FIRE",
      "is_active": true
    },
    {
      "code": "mobile-legends",
      "name": "MOBILE LEGENDS",
      "is_active": true
    }
  ]
}
Endpoint
/api/v1/variant
Headers
Content-Type: application/json
Authorization: Bearer {API_TOKEN}
Request Body
product_code - string
Code from Product API
required
cURL
curl -X POST "{BASE_URL}/api/v1/variant" \
-H "Authorization: Bearer {API_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"product_code": "mobile-legends"}'
Example Code
const axios = require('axios');
const BASE_URL = 'YOUR_BASE_URL';
const API_TOKEN = 'YOUR_API_TOKEN';
 
async function getVariants() {
  try {
    const response = await axios.post(
      `${BASE_URL}/api/v1/variant`, {
        product_code: 'mobile-legends'
      }, {
        headers: {
          'Authorization': `Bearer ${API_TOKEN}`,
          'Content-Type': 'application/json'
        }
    });
    console.log('Response:', response.data);
  } catch (error) {
    console.error('Error:', error.response?.data || error.message);
  }
}
getVariants();
Response
{
  "error": false,
  "code": 200,
  "message": "Success",
  "data": [
    {
      "id": 4090,
      "code": "MLBB_ID_5",
      "name": "5 (5+0) Diamonds",
      "is_active": "active",
      "price": 1389,
      "processDuration": "0"
    }
  ]
}
Endpoint
/api/v1/order
Headers
Content-Type: application/json
Authorization: Bearer {API_TOKEN}
Request Body
code - string
Variant code from List Variant API
required
referenceNumber - string
Your unique transaction ID
required
data - string
User game ID or phone number
required
cURL
curl -X POST "{BASE_URL}/api/v1/order" \
-H "Authorization: Bearer {API_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
  "code": "MLBB_ID_5",
  "referenceNumber": "YOUR_UNIQUE_REF_123",
  "data": "12345678(9012)"
}'
Example Code
const axios = require('axios');
const BASE_URL = 'YOUR_BASE_URL';
const API_TOKEN = 'YOUR_API_TOKEN';
 
async function createOrder() {
  try {
    const response = await axios.post(
      `${BASE_URL}/api/v1/order`, {
        code: 'MLBB_ID_5',
        referenceNumber: 'YOUR_UNIQUE_REF_123',
        data: '12345678(9012)'
      }, {
        headers: {
          'Authorization': `Bearer ${API_TOKEN}`,
          'Content-Type': 'application/json'
        }
    });
    console.log('Response:', response.data);
  } catch (error) {
    console.error('Error:', error.response?.data || error.message);
  }
}
createOrder();
Response
{
  "error": false,
  "code": 200,
  "message": "Success",
  "data": {
    "invoiceNumber": "TRX-XXXXXXXXX"
  }
}
Endpoint
/api/v1/status-order/{invoice}
Headers
Content-Type: application/json
Authorization: Bearer {API_TOKEN}
Path Parameters
invoice - string
Invoice number from Order API
required
cURL
curl -X POST "{BASE_URL}/api/v1/status-order/RZ-RAPIXXXXXXXXX" \
-H "Authorization: Bearer {API_TOKEN}" \
-H "Content-Type: application/json"
Example Code
const axios = require('axios');
const BASE_URL = 'YOUR_BASE_URL';
const API_TOKEN = 'YOUR_API_TOKEN';
 
async function checkOrderStatus(invoiceNumber) {
  try {
    const response = await axios.post(
      `${BASE_URL}/api/v1/status-order/${invoiceNumber}`,
      null, // No request body
      {
        headers: {
          'Authorization': `Bearer ${API_TOKEN}`,
          'Content-Type': 'application/json'
        }
    });
    console.log('Response:', response.data);
  } catch (error) {
    console.error('Error:', error.response?.data || error.message);
  }
}
checkOrderStatus('TRX-IXXXXXXXXX');
Response
{
  "error": false,
  "code": 200,
  "message": "Success",
  "data": {
    "invoiceNumber": "TRX-XXXXXXXXX",
    "productName": "5 (5+0) Diamonds",
    "userData": "12345678(9012)",
    "statusCode": "Success"
  }
}