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

@kuwaitdev/myfatoorah-devkit

v0.1.0

Published

Unofficial MyFatoorah checkout examples and developer utilities for Kuwait payment integrations.

Downloads

125

Readme

@kuwaitdev/myfatoorah-devkit

Unofficial MyFatoorah checkout examples and developer utilities for Kuwait ecommerce, mobile app, and Node.js payment gateway integrations.

Built by KuwaitDev, a Kuwait web and mobile app development team. If you are planning a Kuwait website, ecommerce store, or app, you can also use the Kuwait app and website cost calculator.

This package is not affiliated with, endorsed by, or maintained by MyFatoorah. Use the official MyFatoorah documentation and dashboard for production credentials, payment method IDs, and compliance requirements.

Why this package exists

MyFatoorah integrations usually need the same development pieces:

  • A server-side checkout endpoint
  • A callback page for the customer experience
  • A webhook endpoint for payment updates
  • Server-side status verification before fulfillment
  • Clear separation between mock, sandbox, and production modes

This repo gives developers a safe starting point without placing live payment credentials in frontend or mobile code.

Install

npm install @kuwaitdev/myfatoorah-devkit

Examples

| Example | Path | Use case | | --- | --- | --- | | Express | examples/express | Server checkout, callback, webhook, and order status endpoints | | Next.js | examples/next | App Router checkout with route handlers | | React Native Expo | examples/react-native-expo | Mobile app checkout UI with backend-token warning |

Run the root build first so local file:../.. example dependencies can import the package:

npm install
npm run build

Then run an example:

cd examples/express
npm install
cp .env.example .env
npm run dev

Basic mock checkout

import {
  calculateCheckoutTotal,
  createMockPaymentSession,
  createMockWebhookEvent
} from "@kuwaitdev/myfatoorah-devkit";

const items = [
  { id: "storefront", name: "Kuwait ecommerce storefront", quantity: 1, unitPriceKwd: 250 },
  { id: "payment", name: "MyFatoorah setup", quantity: 1, unitPriceKwd: 75 }
];

const session = createMockPaymentSession({
  orderId: "order_1001",
  items,
  customer: {
    name: "Kuwait Demo Customer",
    email: "[email protected]"
  },
  callbackUrl: "https://example.com/payment/success",
  errorUrl: "https://example.com/payment/failure",
  webhookUrl: "https://example.com/api/webhook",
  currencyIso: "KWD"
});

console.log(calculateCheckoutTotal(items));
console.log(session.paymentUrl);
console.log(createMockWebhookEvent(session, "paid"));

Sandbox template

Server-side only:

import {
  MyFatoorahSandboxClient,
  assertSandboxReady,
  readMyFatoorahEnv
} from "@kuwaitdev/myfatoorah-devkit";

const config = readMyFatoorahEnv();
assertSandboxReady(config);

const client = new MyFatoorahSandboxClient({
  apiToken: config.apiToken,
  mode: config.mode,
  apiBaseUrl: config.apiBaseUrl
});

const session = await client.executePayment(checkoutRequest, {
  paymentMethodId: config.paymentMethodId
});

Required environment variables:

MYFATOORAH_MODE=sandbox
MYFATOORAH_API_TOKEN=your_sandbox_token
MYFATOORAH_PAYMENT_METHOD_ID=your_payment_method_id

Webhook handling

import {
  WebhookDeduper,
  createWebhookIdempotencyKey,
  parseMyFatoorahWebhookEvent
} from "@kuwaitdev/myfatoorah-devkit";

const deduper = new WebhookDeduper();
const event = parseMyFatoorahWebhookEvent(requestBody);
const key = createWebhookIdempotencyKey(event);

if (!deduper.hasProcessed(key)) {
  deduper.markProcessed(key);
  // Update the order status in your database.
}

Production note: use your real database for idempotency and order state. The in-memory helpers are for demos and tests only.

Security notes

  • Never expose MYFATOORAH_API_TOKEN in React Native, browser JavaScript, or public build output.
  • Treat customer callbacks as UX hints, not final proof of payment.
  • Confirm final status server-side with MyFatoorah status APIs or trusted webhook processing.
  • Store order ID, invoice ID, payment ID, amount, currency, status, and timestamps in a database.
  • Make webhook handling idempotent because providers can retry events.
  • Validate all amounts on the server instead of trusting client-submitted totals.

More details are in docs/security.md.

npm metadata

The package includes npm fields for homepage, repository, bugs, and relevant Kuwait/MyFatoorah payment keywords. The homepage points to KuwaitDev because this is a KuwaitDev developer resource.

Useful links

License

MIT