Skip to content

SDKs & Libraries

Official Nivatio SDKs for popular programming languages.

Available SDKs

  • :fontawesome-brands:js: JavaScript/TypeScript --- @nivatio/sdk-js - For Node.js and browser npm package

  • :fontawesome-brands:python: Python --- nivatio-python - For Python applications PyPI package

  • Go --- go-nivatio - For Go applications GitHub


JavaScript/TypeScript SDK

Installation

npm install @nivatio/sdk-js
# or
yarn add @nivatio/sdk-js

Usage

import { NivatioClient } from '@nivatio/sdk-js';

// Initialize with API key
const client = new NivatioClient({
  apiKey: 'nv_sk_live_abc123...',
  environment: 'production' // or 'sandbox'
});

// Create an order
const order = await client.orders.create({
  amount: 100000, // 100.000 NUSD (6 decimals)
  currency: 'NUSD',
  description: 'Premium Subscription',
  successUrl: 'https://yourapp.com/success',
  cancelUrl: 'https://yourapp.com/cancel',
  metadata: {
    internalOrderId: 'order_123'
  }
});

console.log('Checkout URL:', order.checkoutUrl);

// Retrieve an order
const retrieved = await client.orders.retrieve(order.id);
console.log('Order status:', retrieved.status);

// List orders
const orders = await client.orders.list({
  status: 'PAID',
  limit: 10
});

Python SDK

Installation

pip install nivatio-python

Usage

from nivatio import NivatioClient

# Initialize client
client = NivatioClient(
    api_key='nv_sk_live_abc123...',
    environment='production'  # or 'sandbox'
)

# Create an order
order = client.orders.create(
    amount=100000,  # 100.000 NUSD
    currency='NUSD',
    description='Premium Subscription',
    success_url='https://yourapp.com/success',
    cancel_url='https://yourapp.com/cancel',
    metadata={'internal_order_id': 'order_123'}
)

print(f"Checkout URL: {order.checkout_url}")

# Retrieve an order
retrieved = client.orders.retrieve(order.id)
print(f"Order status: {retrieved.status}")

# List orders
orders = client.orders.list(status='PAID', limit=10)
for order in orders:
    print(f"Order {order.id}: {order.status}")

Go SDK

Installation

go get github.com/nivatio/go-nivatio

Usage

package main

import (
    "fmt"
    nivatio "github.com/nivatio/go-nivatio"
)

func main() {
    // Initialize client
    client := nivatio.NewClient("nv_sk_live_abc123...", "production")

    // Create an order
    order, err := client.Orders.Create(&nivatio.CreateOrderRequest{
        Amount:      100000,
        Currency:     "NUSD",
        Description:  "Premium Subscription",
        SuccessURL:   "https://yourapp.com/success",
        CancelURL:    "https://yourapp.com/cancel",
        Metadata: map[string]string{
            "internal_order_id": "order_123",
        },
    })
    if err != nil {
        panic(err)
    }

    fmt.Printf("Checkout URL: %s\n", order.CheckoutURL)

    // Retrieve an order
    retrieved, _ := client.Orders.Retrieve(order.ID)
    fmt.Printf("Order status: %s\n", retrieved.Status)
}

Community Libraries

Language Library Maintained By
Ruby nivatio-ruby Community
PHP nivatio-php Community
Java nivatio-java Community
C# Nivatio.Net Community

Community Libraries

These libraries are maintained by the community. Nivatio does not guarantee their reliability.


Feature Comparison

Feature JavaScript Python Go
Order Creation ✅ ✅ ✅
Order Retrieval ✅ ✅ ✅
Order Listing ✅ ✅ ✅
Webhook Validation ✅ ✅ ✅
TypeScript Support ✅ N/A N/A
Sandbox Mode ✅ ✅ ✅

Next Steps