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

@uveysservetoglu/kobil-payment

v1.0.0

Published

KOBIL Pay (mpay-merchant) client for Node.js: create/pre-auth/post-auth, status, cancel and refund transactions with automatic OAuth token management.

Readme

@uveysservetoglu/kobil-payment

KOBIL Pay (mpay-merchant) client for Node.js / TypeScript, with automatic OAuth token management and typed models.

npm install @uveysservetoglu/kobil-payment

Quick start

OAuth credentials (tokenEndpoint, clientId, clientSecret) are shared across KOBIL modules and read from KOBIL_* env vars if you don't pass them. merchantId defaults to clientId.

import { PaymentClient, paymentGroup } from "@uveysservetoglu/kobil-payment";

const payment = new PaymentClient({
  // credentials (or via KOBIL_TOKEN_ENDPOINT / KOBIL_CLIENT_ID / KOBIL_CLIENT_SECRET):
  tokenEndpoint: process.env.KOBIL_TOKEN_ENDPOINT!,
  clientId: process.env.KOBIL_CLIENT_ID!,
  clientSecret: process.env.KOBIL_CLIENT_SECRET!,
  // payment-specific:
  paymentBaseUrl: "https://pay.cloud.kobil.com/mpay-merchant/create/transaction",
  merchantName: "ISPARK",
  defaultCurrency: "TRY",
  defaultMerchantCallback: "https://yourapi.com/payment-callback",
});

Amounts are in the smallest currency unit (1300 = 13.00 TRY). Timeouts in minutes.

The six operations

// 1. Regular payment (immediate charge)
const res = await payment.createTransaction({
  userId,
  amount: 1300,
  paymentContent: paymentGroup(["Service Amount", "10.0 TL"], ["Tax Amount", "3.0 TL"]),
});
// res.transactionId ; parsePaymentStatus(res) === "new"

// 2. Pre-authorization (hold funds)
const pre = await payment.createPreAuthTransaction({ userId, amount: 1300 });
// pre.nextAction holds the post-auth handle

// 3. Post-authorization (settle final amount)
await payment.postAuth({ transactionId: pre.transactionId!, amount: 40 });

// 4. Status
const status = await payment.getStatus({ transactionId });

// 5. Cancel (void)
await payment.cancel({ transactionId, userId, cancellationMessage: "Iptal" });

// 6. Refund (partial or full)
await payment.refund({ transactionId, userId, amount: 5555, currency: "USD" });

JavaScript usage is identical (const { PaymentClient } = require("@uveysservetoglu/kobil-payment")).

Errors

All operations throw KobilPaymentError (extends KobilError) with statusCode and responseBody when available.

import { KobilPaymentError } from "@uveysservetoglu/kobil-payment";
try {
  await payment.createTransaction({ userId, amount: 1300 });
} catch (e) {
  if (e instanceof KobilPaymentError) console.error(e.statusCode, e.responseBody);
}

License

MIT