npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@prakrit_m/slipok-sdk

v1.1.1

Published

ไลบรารีสำหรับตรวจสอบสลิปโอนเงินผ่าน SlipOK API - A TypeScript library for verifying Thai bank transfer slips using SlipOK API

Downloads

110

Readme

🚀 SlipOk SDK

NPM version NPM Downloads NPM Last Update Node Version License: ISC

SDK สำหรับตรวจสอบสลิปการโอนเงินผ่าน SlipOk API อย่างง่ายดาย พร้อมรองรับ TypeScript แบบสมบูรณ์

📋 สารบัญ

✨ คุณสมบัติ

  • 🔄 ตรวจสอบสลิปและโควต้าคงเหลือ
  • 📝 รองรับ TypeScript แบบสมบูรณ์
  • 🖼️ รองรับการตรวจสอบทั้ง QR Code และรูปภาพสลิป
  • 🔒 ระบบจัดการ Error ที่ครอบคลุม
  • 🚀 Retry mechanism อัตโนมัติ
  • ⏱️ Timeout handling
  • 📊 Logging system

📦 การติดตั้ง

# npm
npm install @prakrit_m/slipok-sdk

# yarn
yarn add @prakrit_m/slipok-sdk

# pnpm
pnpm add @prakrit_m/slipok-sdk

🚀 การใช้งาน

การเริ่มต้นใช้งาน

import SlipOk from "@prakrit_m/slipok-sdk";

// สร้าง instance แบบพื้นฐาน
const slipOk = new SlipOk("YOUR_API_KEY", "YOUR_BRANCH_ID");

// หรือกำหนด config เพิ่มเติม
const slipOk = new SlipOk("YOUR_API_KEY", "YOUR_BRANCH_ID", {
  timeout: 5000,
  retries: 2,
  logger: console,
});

ตรวจสอบโควต้า

try {
  const response = await slipOk.checkQuota();
  if (response.success) {
    console.log("ข้อมูลโควต้า:", response.data);
  } else {
    console.error("เกิดข้อผิดพลาด:", response.message);
  }
} catch (error) {
  console.error("เกิดข้อผิดพลาดในการเชื่อมต่อ:", error);
}

ตรวจสอบสลิป

try {
  // ตรวจสอบด้วย QR Code
  const response = await slipOk.checkSlip({
    data: "QR_CODE_DATA",
    log: true,
  });

  // หรือตรวจสอบด้วย URL รูปภาพ
  const response = await slipOk.checkSlip({
    url: "IMAGE_URL",
    amount: 1000, // ระบุจำนวนเงินที่ต้องการตรวจสอบ (optional)
    log: true,
  });

  // หรือตรวจสอบด้วยไฟล์รูปภาพ
  const response = await slipOk.checkSlip({
    files: imageFile,
    log: true,
  });

  if (response.success) {
    console.log("ข้อมูลการโอน:", {
      จำนวนเงิน: response.data.amount,
      วันที่โอน: response.data.date,
      เวลาที่โอน: response.data.time,
      ธนาคารผู้โอน: response.data.bank,
      ชื่อผู้โอน: response.data.sender,
    });
  } else {
    console.error("เกิดข้อผิดพลาด:", response.message);
  }
} catch (error) {
  console.error("เกิดข้อผิดพลาดในการเชื่อมต่อ:", error);
}

📚 API Reference

SlipOk

Constructor Options

interface SdkConfig {
  baseUrl?: string; // URL ของ API (default: https://api.slipok.com/api/line/apikey)
  timeout?: number; // ระยะเวลา timeout (default: 10000ms)
  retries?: number; // จำนวนครั้งที่จะ retry (default: 2)
  logger?: Logger; // ระบบ logging
}

Methods

| Method | Description | Parameters | Return Type | | ----------------- | -------------------- | ------------------------------------------------------------------------------ | ----------------------------------------------------- | | checkQuota() | ตรวจสอบโควต้าคงเหลือ | - | Promise<QuotaResponseSuccess \| QuotaResponseError> | | checkSlip(data) | ตรวจสอบสลิป | { data?: string, url?: string, files?: File, amount?: number, log: boolean } | Promise<SlipResponseSuccess \| SlipResponseError> |

🚨 Error Handling

รหัสข้อผิดพลาด (Error Codes)

| รหัส | คำอธิบาย | | ---- | ------------------------------------------------------------------------------------------------------------------ | | 1000 | กรุณาใส่ข้อมูล QR Code ให้ครบใน field data, files หรือ url | | 1001 | ไม่พบข้อมูลสาขา กรุณาตรวจสอบไอดีสาขา | | 1002 | Authorization Header ไม่ถูกต้อง | | 1003 | Package ของคุณหมดอายุแล้ว | | 1004 | Package ของคุณใช้เกินโควต้ามาแล้ว 400 บาท กรุณาต่อสมาชิกแพ็กเกจ | | 1005 | ไฟล์ไม่ใช่ไฟล์ภาพ กรุณาอัพโหลดไฟล์เฉพาะนามสกุล .jpg .jpeg .png .jfif หรือ .webp | | 1006 | รูปภาพไม่ถูกต้อง | | 1007 | รูปภาพไม่มี QR Code | | 1008 | QR ดังกล่าวไม่ใช่ QR สำหรับการตรวจสอบการชำระเงิน | | 1009 | ขออภัยในความไม่สะดวก ขณะนี้ข้อมูลธนาคารเกิดขัดข้องชั่วคราว โปรดตรวจใหม่อีกครั้งใน 15 นาทีถัดไป (ไม่เสียโควต้าสลิป) | | 1010 | เนื่องจากเป็นสลิปจากธนาคาร {ชื่อธนาคาร} กรุณารอการตรวจสอบสลิปหลังการโอนประมาณ {จำนวนนาที} นาที | | 1011 | QR Code หมดอายุ หรือ ไม่มีรายการอยู่จริง | | 1012 | สลิปซ้ำ สลิปนี้เคยส่งเข้ามาในระบบเมื่อ {timestamp} | | 1013 | ยอดที่ส่งมาไม่ตรงกับยอดสลิป | | 1014 | บัญชีผู้รับไม่ตรงกับบัญชีหลักของร้าน |

SDK Error Codes

| รหัส | คำอธิบาย | การแก้ไข | | -------------- | ---------------------------------------- | ------------------------------- | | INVALID_CLIENT | ข้อมูล API Key หรือ Branch ID ไม่ถูกต้อง | ตรวจสอบข้อมูลที่ใช้ | | NETWORK_ERROR | ปัญหาการเชื่อมต่อเครือข่าย | ตรวจสอบการเชื่อมต่ออินเทอร์เน็ต |

🤝 การมีส่วนร่วมในการพัฒนา

  1. Fork โปรเจกต์
  2. สร้าง branch สำหรับฟีเจอร์ของคุณ (git checkout -b feature/amazing-feature)
  3. Commit การเปลี่ยนแปลง (git commit -m 'เพิ่มฟีเจอร์ใหม่')
  4. Push ไปยัง branch (git push origin feature/amazing-feature)
  5. เปิด Pull Request

สำหรับการรายงานปัญหาหรือข้อเสนอแนะ สามารถเปิด Issue ได้

📄 License

This is a third-party SDK, not an official SlipOk SDK.
SDK นี้พัฒนาโดยบุคคลภายนอก ไม่ใช่ผลิตภัณฑ์อย่างเป็นทางการจาก SlipOk

Licensed under ISC

📚 เอกสารเพิ่มเติม

สำหรับข้อมูลเพิ่มเติมเกี่ยวกับ API สามารถอ่านได้ที่ SlipOk API Documentation