JSPM

@gopu.inc/chariow-sdk

3.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 31
  • Score
    100M100P100Q83552F
  • License MIT

Chariow SDK & CLI โ€” Enterprise Commerce Platform (Products, Pay, Hooks, DNS, WebSocket, Func)

Package Exports

  • @gopu.inc/chariow-sdk
  • @gopu.inc/chariow-sdk/cli
  • @gopu.inc/chariow-sdk/dns
  • @gopu.inc/chariow-sdk/hooks
  • @gopu.inc/chariow-sdk/marketplace
  • @gopu.inc/chariow-sdk/pay
  • @gopu.inc/chariow-sdk/products
  • @gopu.inc/chariow-sdk/sales
  • @gopu.inc/chariow-sdk/store

Readme

๐Ÿš€ Chariow SDK

Chariow SDK Version Coverage License Downloads Node

Enterprise Commerce Platform โ€” SDK & CLI

Documentation ยท API Reference ยท Examples


โœจ Features

  • ๐Ÿ›’ Products API โ€” Create, update, publish products
  • ๐Ÿ’ณ Chariow Pay โ€” Payments & checkout (Stripe-compatible)
  • ๐Ÿ”Œ Webhooks โ€” Manage webhooks with events
  • ๐ŸŒ DNS โ€” Custom domains & SSL management
  • ๐Ÿช Marketplace โ€” Browse stores and products
  • ๐Ÿ“Š Sales โ€” Orders and revenue tracking
  • ๐Ÿ”Œ WebSocket โ€” Real-time events & notifications
  • ๐Ÿ–ฅ๏ธ CLI โ€” Interactive terminal dashboard
  • โšก Func Gateway โ€” Stripe-compatible payment gateway
  • ๐Ÿ“ฆ TypeScript โ€” Full type definitions included

๐Ÿ“ฆ Installation

NPM

npm install chariow-sdk

Yarn

yarn add chariow-sdk

Global CLI

npm install -g chariow-sdk

๐Ÿš€ Quick Start

Node.js / TypeScript

import { Chariow } from 'chariow-sdk';

// Initialize the SDK
const client = new Chariow('your-api-key');

// List products
const products = await client.products.list({ per_page: 10 });

// Create a product
const product = await client.products.create({
  name: 'Awesome Product',
  description: 'The best product ever',
  pricing: {
    type: 'one_time',
    current_price: {
      value: 29.99,
      currency: 'USD'
    }
  },
  status: 'published'
});

// Process a payment
const payment = await client.pay.checkout({
  items: [{ product_id: product.id, quantity: 1 }],
  customer_email: 'customer@example.com',
  currency: 'USD'
});

console.log(payment.checkout_url);

CLI

# Configure API key
chariow config --set your-api-key

# Interactive dashboard
chariow dashboard

# Manage products
chariow products --list
chariow products --create
chariow products --publish <id>

# Process payments
chariow pay --checkout
chariow pay --buy https://chariow.com/store/myshop/products/my-product

# Start payment gateway
chariow serve --port 4242

# Real-time WebSocket monitoring
chariow ws

๐Ÿ”ง CLI Commands

Command Description chariow dashboard Interactive TUI dashboard chariow config --set Set API key chariow products --list List products chariow products --create Create product chariow pay --checkout Interactive checkout chariow pay --buy Buy a product chariow explore Browse marketplace chariow hooks --list List webhooks chariow dns --list List domains chariow ws WebSocket monitor chariow serve Start payment gateway chariow func Start local gateway

๐Ÿ“š Modules

Products API

import { ProductsAPI } from 'chariow-sdk/products';

const products = new ProductsAPI(client);

// List with pagination
await products.list({ per_page: 20, status: 'published' });

// Search
await products.search('awesome');

// Get by ID
await products.get('prod_abc123');

// Update
await products.update('prod_abc123', { name: 'New Name' });

// Delete
await products.delete('prod_abc123');

Payment API (Chariow Pay)

import { PayAPI } from 'chariow-sdk/pay';

const pay = new PayAPI(client);

// Create checkout
const payment = await pay.checkout({
  items: [{ product_id: 'prod_abc123', quantity: 2 }],
  customer_email: 'buyer@example.com',
  customer_name: 'John Doe',
  currency: 'USD',
  payment_method: { type: 'card' },
  success_url: 'https://myshop.com/success',
  cancel_url: 'https://myshop.com/cancel'
});

// Get payment
await pay.get('pay_xyz789');

// List payments
await pay.list({ status: 'succeeded', per_page: 20 });

// Refund
await pay.refund('pay_xyz789', { reason: 'Customer request' });

Marketplace

import { MarketplaceAPI } from 'chariow-sdk/marketplace';

const marketplace = new MarketplaceAPI(client);

// List stores
const stores = await marketplace.listStores({ search: 'tech' });

// Get store
const store = await marketplace.getStore('my-store');

// Get store products
const products = await marketplace.getStoreProducts('my-store');

Webhooks

import { HooksAPI } from 'chariow-sdk/hooks';

const hooks = new HooksAPI(client);

// Create webhook
await hooks.create({
  url: 'https://myserver.com/webhook',
  events: ['sale.created', 'payment.succeeded'],
  secret: 'your-webhook-secret'
});

// List webhooks
await hooks.list();

// Test webhook
await hooks.test('wh_abc123', 'sale.created');

// Get deliveries
await hooks.deliveries('wh_abc123');

DNS / Domains

import { DnsAPI } from 'chariow-sdk/dns';

const dns = new DnsAPI(client);

// Add domain
await dns.add({ domain: 'myshop.com' });

// List domains
await dns.list();

// Verify domain
await dns.verify('dom_abc123');

// Set default domain
await dns.setDefault('dom_abc123');

WebSocket

import { ChariowWebSocket } from 'chariow-sdk/websocket';

const ws = new ChariowWebSocket('your-api-key');

// Connect
await ws.connect();

// Subscribe to events
await ws.subscribeToStore();
await ws.subscribeToProduct('prod_abc123');

// Listen for events
ws.on('new_sale', (sale) => {
  console.log(`New sale: ${sale.amount} ${sale.currency}`);
});

ws.on('product_updated', (product) => {
  console.log(`Product updated: ${product.name}`);
});

ws.on('notification', (notification) => {
  console.log(`Notification: ${notification.message}`);
});

// Search products in real-time
const results = await ws.searchProducts({
  term: 'awesome',
  minPrice: 10,
  maxPrice: 50,
  sortBy: 'rating'
});

๐ŸŒ Payment Gateway (Stripe-compatible)

# Start the gateway
chariow serve --port 4242

# Generate nginx config with SSL
chariow serve --ssl --domain pay.myshop.com

Endpoints

Method Endpoint Description POST /v1/payment_intents Create payment intent GET /v1/payment_intents/:id Get payment intent POST /v1/payment_intents/:id/confirm Confirm payment POST /v1/payment_intents/:id/cancel Cancel payment POST /v1/charges Create charge GET /v1/charges List charges POST /v1/refunds Create refund POST /v1/customers Create customer GET /v1/balance Get balance GET /v1/products List products

Example with curl

# Create payment intent
curl -X POST http://localhost:4242/v1/payment_intents \
  -H "Authorization: Bearer your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 5000,
    "currency": "usd",
    "customer_email": "user@example.com",
    "items": [{"product_id": "prod_abc123", "quantity": 1}]
  }'

# Process charge
curl -X POST http://localhost:4242/v1/charges \
  -H "Authorization: Bearer your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 2999,
    "currency": "usd",
    "product_id": "prod_abc123",
    "customer_email": "buyer@example.com"
  }'

๐Ÿงช Testing

# Run all tests
npm test

# Run unit tests
npm run test:unit

# Run integration tests
npm run test:integration

# Run tests with coverage
npm run test:coverage

# Run tests in watch mode
npm run test:watch

๐Ÿ“Š Test Results

โœ… 141 tests passed
โœ… 31 test suites
โฑ๏ธ  3.63 seconds

๐Ÿ› ๏ธ Development

# Clone repository
git clone git@github.com:gopu-inc/chariow-sdk.git
cd chariow-sdk

# Install dependencies
npm install

# Build
npm run build

# Development mode
npm run dev

# Type check
npm run type-check

# Link locally
npm run link:local

๐Ÿ“– Examples

Check out the examples directory for complete usage examples:

ยท Basic Product Management ยท Payment Processing ยท Webhook Setup ยท Marketplace Integration ยท WebSocket Monitoring ยท Full E-commerce Flow

๐Ÿค Contributing

We welcome contributions! Please see our Contributing Guide.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“ License

This project is licensed under the MIT License โ€” see the LICENSE file for details.

๐Ÿ™ Acknowledgments

ยท Built with TypeScript ยท Powered by Chariow Platform ยท CLI with Commander.js ยท TUI with Chalk + Inquirer

๐Ÿ“ซ Contact & Support

ยท Documentation: docs.chariow.com ยท API Reference: docs.chariow.com/api ยท Issues: GitHub Issues ยท Discord: Chariow Community ยท Twitter: @Chariow


Built with โค๏ธ by the Chariow Team

โญ Star us on GitHub โ€” it helps!