@getruba/sdk
v0.48.3
Published
Typed JavaScript client for Ruba payments, billing, customers, and webhooks.
Maintainers
Readme
Ruba JavaScript SDK
Use Ruba from Node.js, TypeScript, or a browser application. The package includes typed request models, response models, pagination helpers, error handling, and webhook verification.
Install
npm install @getruba/sdkThe package supports both ES modules and CommonJS.
Create a client
import { Ruba } from "@getruba/sdk";
const ruba = new Ruba({
accessToken: process.env.RUBA_ACCESS_TOKEN ?? "",
});
const organizations = await ruba.organizations.listOrganizations({});
for await (const page of organizations) {
console.log(page);
}Use https://sandbox-api.getruba.com while testing and https://api.getruba.com in production. Keep access tokens on the server and never expose them in browser code.
Verify webhooks
import { validateEvent } from "@getruba/sdk/webhooks";
const event = validateEvent(rawBody, headers, process.env.RUBA_WEBHOOK_SECRET ?? "");Webhook verification requires the unmodified request body.
Resources
License
MIT
