@murai-wallet/murai
v1.0.3
Published
Lightweight token wallet library for AI/SaaS apps — with Midtrans, Xendit & Stripe support
Maintainers
Readme
murai
Lightweight token wallet library for AI/SaaS apps — with Midtrans, Xendit & Stripe support.
This is the convenience meta-package that re-exports all Murai modules in a single install.
Install
npm install @murai-wallet/murai drizzle-orm postgresUsage
import {
createWallet,
createCheckoutManager,
createLedger,
createDrizzleStorage,
createMidtransGateway,
} from 'murai';
const storage = createDrizzleStorage(drizzle(sql));
const gateway = createMidtransGateway({ serverKey, clientKey, sandbox: true });
const wallet = createWallet({ storage });
const ledger = createLedger(storage);
const checkout = createCheckoutManager(gateway, ledger, storage);
// Top up via payment gateway
const session = await checkout.createSession({
userId: 'user_123',
amount: 100_000,
successRedirectUrl: 'https://yourapp.com/success',
failureRedirectUrl: 'https://yourapp.com/fail',
});
// Spend tokens
await wallet.spend('user_123', 5_000, 'usage-key');Included Packages
| Package | Description |
| --- | --- |
| @murai-wallet/core | Wallet, ledger, checkout manager, types, errors |
| @murai-wallet/gateway-midtrans | Midtrans Snap adapter |
| @murai-wallet/gateway-xendit | Xendit Checkout adapter |
| @murai-wallet/gateway-stripe | Stripe Checkout adapter |
| @murai-wallet/storage-drizzle | Drizzle ORM storage (PostgreSQL) |
Documentation
Full docs: ebuntario.github.io/murai
