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

amcoin-sdk

v1.0.0

Published

Official AmCoin Merchant API SDK

Readme

amcoin-sdk

Официальный JavaScript SDK для AmCoin Merchant API.

Установка

npm install amcoin-sdk

Быстрый старт

const AmCoin = require('amcoin-sdk');
const amcoin = new AmCoin('AC_ваш_ключ');

Баланс

const data = await amcoin.getBalance();
console.log(data.balance); // 15000

Инвойсы

// Создать
const inv = await amcoin.invoice.create({
  amount: 500,
  description: 'Подписка Pro',
  externalId: 'order_123',
  expiresInMinutes: 60,
});
console.log(inv.invoiceId);  // INV1A2B3C
console.log(inv.payLink);    // t.me/AmCoinMerchantBot?start=pay_...

// Получить
const inv = await amcoin.invoice.get('INV1A2B3C');
console.log(inv.status); // pending | paid | expired | cancelled

// Список
const list = await amcoin.invoice.list({ status: 'pending', limit: 10 });

// Отменить
await amcoin.invoice.cancel('INV1A2B3C');

// Ждать оплаты (polling)
const paid = await amcoin.invoice.waitForPayment('INV1A2B3C', {
  timeout: 10 * 60 * 1000, // 10 минут
  interval: 3000,           // проверять каждые 3 сек
});
console.log('Оплачено!', paid.paidBy);

Чеки

// Создать чек на 100 AC × 10 активаций
const check = await amcoin.check.create({ amount: 100, activations: 10 });
console.log(check.checkLink); // t.me/AmCoinAppbot?start=check_...

// Получить статус
const ch = await amcoin.check.get('A1B2C3D4');
console.log(ch.remainingActivations);

Переводы

await amcoin.transfer({
  userId: 123456789,
  amount: 100,
  comment: 'Бонус за регистрацию',
});

Пользователь

const user = await amcoin.getUser(123456789);
console.log(user.username, user.balance, user.isBanned);

Транзакции

const txns = await amcoin.getTransactions({ type: 'deposit', limit: 20 });

Вебхуки

Установить URL

await amcoin.setWebhook('https://мой-сайт.com/webhook');
await amcoin.removeWebhook(); // удалить

Слушать вебхуки локально

amcoin.listenWebhook({ port: 3000, path: '/webhook' });

amcoin.on('invoice_paid', (data) => {
  console.log('Оплачен:', data.invoiceId, 'на', data.amount, 'AC');
});

amcoin.on('payment', (data) => {
  console.log('Свободная оплата:', data.amount, 'AC от', data.userId);
});

Обработка ошибок

const { AmCoinError } = require('amcoin-sdk');

try {
  await amcoin.transfer({ userId: 123, amount: 99999 });
} catch(e) {
  if (e instanceof AmCoinError) {
    console.log(e.message); // Недостаточно средств
    console.log(e.code);    // 400
  }
}

Опции

const amcoin = new AmCoin('AC_ключ', {
  timeout: 15000, // таймаут запроса в мс (по умолч. 10000)
});

Лицензия

MIT