@konetpay/core
v0.1.1
Published
Framework-agnostic core client for KonetPay: API client and the checkout protocol shared by platform-specific triggers.
Readme
@konetpay/core
Framework-agnostic API client for KonetPay. No DOM/browser assumptions — works in Node backends, browsers, and React Native.
npm install @konetpay/coreQuick start
// backend — secret key, initializes a transaction
import { KonetPayServerClient } from "@konetpay/core";
const konet = new KonetPayServerClient({ secretKey: process.env.KONETPAY_SECRET_KEY! });
const transaction = await konet.initializeTransaction({
amount: 500_000, // ₦5,000.00, in kobo
currency: "NGN",
customer: { email: "[email protected]" },
});
// { reference, accessCode, authorizationUrl }// browser or backend — publishable key, checks status
import { KonetPayClient } from "@konetpay/core";
const konet = new KonetPayClient({ publicKey: "pk_test_..." });
const result = await konet.verifyTransaction(reference);
if (result.paymentStatus === "successful") {
// fulfill the order
}authorizationUrl is a hosted checkout page — this package never renders
payment UI itself. To open it as an iframe overlay in a browser, see
@konetpay/web.
Why the key split?
Only the secret key can initialize a transaction — that's what makes the amount trustworthy, since a browser holding only the publishable key can never create one and so can't tamper with it. The publishable key can verify a transaction's status, a read-only operation safe to call from the browser or your backend.
See USAGE.md
in the repo root for the full integration guide, including the
openCheckout → verifyTransaction flow end to end.
