OVN Pay Integration Demos

Code examples for integrating OVN Pay with your systems

ERP Integration Example

This example shows TWO ways to integrate OVN Pay with OVN's ERP system:

  • OVN API Worker (Recommended) - Simple REST API calls
  • Paystream SDK (Advanced) - Direct TypeScript client

1. Health Check

// Check API health
const response = await fetch('https://api.ovnpays.com/health', {
  headers: { 'Authorization': `Bearer ${apiKey}` }
});
const { status, version } = await response.json();

2. Create Single Load Payout

// Standard ACH payout
const payout = await fetch('https://api.ovnpays.com/api/v1/payouts', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${apiKey}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    loadId: 'L-12345',
    urgency: 'standard'  // ~2-3 business days
  })
}).then(r => r.json());

3. Request Instant Pay

// Instant payout (~30 seconds)
const payout = await fetch('https://api.ovnpays.com/api/v1/payouts/instant', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${apiKey}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    loadId: 'L-12345',
    urgency: 'instant'
  })
}).then(r => r.json());

4. Weekly Batch Payouts

// Create batch from delivered loads
const batch = await fetch('https://api.ovnpays.com/api/v1/batches', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${apiKey}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    loadIds: ['L-12345', 'L-12346', 'L-12347'],
    description: 'Week 42 Payouts'
  })
}).then(r => r.json());

5. Register New Driver

// Register driver in Paystream
const driver = await fetch('https://api.ovnpays.com/api/v1/drivers', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${apiKey}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    ovnDriverId: 'DRV-001',
    name: 'John Driver',
    email: 'john@example.com',
    phone: '+1234567890'
  })
}).then(r => r.json());

6. Check Wallet Balance

// Get current wallet balance
const balance = await fetch('https://api.ovnpays.com/api/v1/balance', {
  headers: { 'Authorization': `Bearer ${apiKey}` }
}).then(r => r.json());

console.log(`Available: ${balance.available / 100} USD`);

View full source code on GitHub

View erp-integration.ts

API Endpoints Reference

Drivers

GET /api/v1/drivers List drivers
GET /api/v1/drivers/:id Get driver
POST /api/v1/drivers Register driver
GET /api/v1/drivers/:id/payouts Driver payouts

Payouts

POST /api/v1/payouts Create payout
POST /api/v1/payouts/instant Instant pay
GET /api/v1/payouts/:id Get payout
POST /api/v1/payouts/:id/cancel Cancel payout

Batches

GET /api/v1/batches List batches
POST /api/v1/batches Create batch
POST /api/v1/batches/:id/release Release batch

Balance

GET /api/v1/balance Wallet balance

OVN Pay - Driver payout platform for OVN Logistics

View on GitHub