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

@tingee/sdk-node

v0.1.0

Published

Tingee Open API SDK for Node.js

Readme

@tingee/sdk-node

SDK chính thức tích hợp Tingee Open API cho Node.js / TypeScript

npm Node.js TypeScript License: ISC


Cài đặt

npm install @tingee/sdk-node
# hoặc
yarn add @tingee/sdk-node
# hoặc
pnpm add @tingee/sdk-node

Bắt đầu nhanh

import { TingeeClient, isSuccessResponse } from '@tingee/sdk-node'

const client = new TingeeClient({
  secretKey:   process.env.TINGEE_SECRET_KEY!,
  clientId:    process.env.TINGEE_CLIENT_ID!,
  environment: 'production', // 'uat' | 'production', mặc định 'production'
  timeout: 90000,            // mặc định 90s
  baseUrl: 'https://uat-open-api.tingee.vn', // tùy chọn, ghi đè environment
})

const result = await client.merchant.getPaging({ maxResultCount: 10, skipCount: 0 })
if (isSuccessResponse(result)) {
  console.log(result.data)
} else {
  console.error(`Lỗi ${result.code}: ${result.message}`)
}

Cấu hình

| Tùy chọn | Kiểu | Mặc định | Mô tả | |---|---|---|---| | secretKey | string | — | Bắt buộc. Secret key từ Tingee Dashboard | | clientId | string | — | Bắt buộc. Client ID từ Tingee Dashboard | | environment | 'uat' \| 'production' | 'production' | Môi trường API | | baseUrl | string | — | Ghi đè URL (bỏ qua environment) | | timeout | number | 90000 | Timeout (ms) |


Gọi API

Tất cả phương thức nằm trong client.*:

// Merchant — lấy danh sách
const result = await client.merchant.getPaging({ maxResultCount: 10, skipCount: 0 })
if (isSuccessResponse(result)) {
  result.data.items.forEach(m => console.log(m.name))
}

// Shop — lấy danh sách
const shops = await client.shop.getPaging({ maxResultCount: 10, skipCount: 0 })

// Direct Debit
const sub = await client.directDebit.getSubscriptionStatus({
  requestId:      'uuid-here',
  subscriptionId: 'uuid-here',
  tokenRef:       'token-ref',
})

Lưu ý: SDK trả về TingeeApiResponse với codemessage. Kiểm tra code === '00' hoặc isSuccessResponse(result) để xác định thành công — SDK không tự throw khi code !== '00'.


Xác thực Webhook

Khi Tingee gọi vào endpoint webhook của bạn, dùng client.verifyWebhookSignature():

// Express.js
app.post('/webhook/tingee', express.json(), (req, res) => {
  const result = client.verifyWebhookSignature({
    signature: req.headers['x-signature']         as string,
    timestamp: req.headers['x-request-timestamp'] as string,
    body:      req.body,
  })

  if (isErrorResponse(result)) {
    return res.status(401).json({ error: result.message })
  }

  const { transactionCode, amount, bank } = req.body
  // Xử lý giao dịch...
  res.json({ received: true })
})
// NestJS
@Post('webhook/tingee')
handleWebhook(@Req() req: Request, @Body() body: Record<string, any>) {
  const result = this.tingeeClient.verifyWebhookSignature({
    signature: req.headers['x-signature'] as string,
    timestamp: req.headers['x-request-timestamp'] as string,
    body,
  })
  if (isErrorResponse(result)) throw new UnauthorizedException(result.message)
  // ...
}

Bank Constants

import { BankNameEnum, getBankCode, getBankShortName, getBankBin } from '@tingee/sdk-node'

getBankCode(BankNameEnum.VIETCOMBANK)       // 'VCB'
getBankShortName(BankNameEnum.VIETCOMBANK)  // 'Vietcombank'
getBankBin(BankNameEnum.VIETCOMBANK)        // '970410'

Liên hệ & Hỗ trợ

📧 Email: [email protected] 💬 Telegram: @tingeesupport 🌐 Website: tingee.vn


Xem thêm