@mneepay/sdk
v0.0.5
Published
Lightweight TypeScript client for the MNEE API. This SDK targets Node 18+.
Readme
MNEE SDK (Node)
Lightweight TypeScript client for the MNEE API. This SDK targets Node 18+.
Install (local)
cd sdk
bun installUsage
import { MneePayClient } from '@mneepay/sdk'
const client = new MneePayClient({
baseUrl: 'https://mneepay.xyz',
apiKey: process.env.MNEE_API_KEY,
})
const products = await client.listProducts()
if (products.error) {
throw new Error(products.error.message)
}
console.log(products.data)Optional external IDs:
CustomerCreateInput.externalIdProductCreateInput.externalId
These values are echoed back on the resource and included in webhook payloads as
customerExternalId and productExternalId when available.
Included endpoints
- Products: list/create/get/update/delete
- Customers: list/create/get/update/delete
- Invoices: list/create/get/update/delete
- Invoices: HTML + PDF render
- Branding: get/update
- Payouts: get/update
- Subscriptions: lookup
Webhook events
Webhook deliveries POST JSON payloads with a shared envelope:
import {
parseWebhookEvent,
verifyWebhookSignature,
isInvoicePaidEvent,
isProductPurchaseOneTimeEvent,
isSubscriptionCreatedEvent,
isSubscriptionRenewedEvent,
} from 'mnee-sdk'const signature = req.headers['x-mnee-signature']
if (!verifyWebhookSignature(req.body, signature, process.env.MNEE_WEBHOOK_SECRET)) {
throw new Error('Invalid signature')
}
const event = parseWebhookEvent(req.body)
if (isInvoicePaidEvent(event)) {
// event.data.invoiceId, event.data.amountCents, ...
}Signature header format: x-mnee-signature: t=timestamp,v1=hex.
Excluded: auth endpoints, openapi.yml, and Alchemy webhook.
