Appearance
Quick Start Guide
Get up and running with the OVN Pay API in 5 minutes.
1. Get Your API Key
Contact engineering@ovn.llc to request:
- Production API key
- Sandbox API key (for testing)
2. Install the SDK
bash
npm install @ovn/paystream-client3. Initialize the Client
typescript
import { PayStreamClient } from '@ovn/paystream-client';
const client = new PayStreamClient({
apiKey: process.env.PAYSTREAM_API_KEY,
apiUrl: 'https://api.ovnpays.com/api/v1'
});4. Register a Driver
typescript
const driver = await client.drivers.create({
ovnId: 'OVN123456',
email: 'john.doe@example.com',
phone: '+15555555555'
});
console.log('Driver ID:', driver.id); // drv_xxxxx5. Create Your First Payout
typescript
const payout = await client.payouts.create({
recipientId: driver.id,
amount: 50000, // $500.00 in cents
description: 'Load #12345 - Chicago to Detroit',
rail: 'standard'
});
console.log('Payout ID:', payout.id);
console.log('Status:', payout.status);6. Check the Status
typescript
const updatedPayout = await client.payouts.get(payout.id);
console.log('Status:', updatedPayout.status);7. Handle Webhooks (Optional)
typescript
import { verifyWebhookSignature } from '@ovn/paystream-client/webhook';
// In your webhook endpoint
const signature = request.headers['x-webhook-signature'];
const payload = await request.text();
try {
const event = verifyWebhookSignature(
payload,
signature,
process.env.WEBHOOK_SECRET
);
console.log('Event type:', event.type);
console.log('Event data:', event.data);
} catch (error) {
console.error('Invalid webhook signature');
return { success: false, error: 'Invalid signature' };
}Next Steps
- Read the Integration Guide
- Check API Reference
- Review Webhook Guide