ย้อนกลับ

API Documentation

เอกสารการใช้งาน API สำหรับเชื่อมต่อระบบชำระเงิน พร้อมตัวอย่างโค้ด

Base URL
All API requests should be prefixed with this URL.
https://api.inwcloud.shop
Authentication
การใช้งาน API จำเป็นต้องส่ง API Key ผ่าน Header ในทุก Request
Header
Authorization: Bearer YOUR_API_KEY

* คุณสามารถขอรับ API Key ได้จากหน้า Dashboard ของคุณ

Generate QR Code
สร้าง QR Code สำหรับรับเงินตามจำนวนที่กำหนด
POST/v1/promptpay/generate

สร้าง QR Code พร้อมเพย์แบบระบุจำนวนเงิน

import axios from 'axios';

const response = await axios.post(
    'https://api.inwcloud.shop/v1/promptpay/generate',
    {
        amount: 10
    },
    {
        headers: {
            'Authorization': 'Bearer YOUR_API_KEY'
        }
    }
);

console.log(response.data);

Response Example

{
  status: 'success',
  data: {
    transactionId: 'Market-1-.....',        
    qr_url: 'https://api.qrserver.com/v1/create-qr-code/?data=inwcloud&size=300x300&ecc=M&format=png&qzone=1&charset-source=UTF-8&charset-target=UTF-8',
    payload: '000201010.....',
    amount: '10.98',
    expires_at: 1764246956
  },
  rate_limit: { limit: 50, remaining: 49, tier: 'free' },
  customer_type: 'existing'
}
Verify QR Code
ยืนยันการชำระเงินด้วย transactionId
POST/v1/promptpay/check

ยืนยันการชำระเงินด้วย transactionId

import axios from 'axios';

const response = await axios.post(
    'https://api.inwcloud.shop/v1/promptpay/check',
    {
        transactionId: 'Market-1........'
    },
    {
        headers: {
            'Authorization': 'Bearer YOUR_API_KEY'
        }
    }
);

console.log(response.data);

Response Example

{
  status: 'success',
  message: 'ชำระเงินสำเร็จ',
  transactionId: 'Market-1......',
  amount: '10.95',
  customer_type: 'existing',
  cost: 0
}