Example Usage

PHP Example

<?php

$apiKey = 'your_api_key_here';
$baseUrl = 'https://app.julypay.net/api/v1';

// Send money example
$data = [
    'recipient_phone' => '256701234567',
    'amount' => 50000,
    'description' => 'Payment for services',
    'sender_pays_fee' => true
];

$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_URL => $baseUrl . '/wallet/send-money',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => json_encode($data),
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . $apiKey,
        'Content-Type: application/json',
        'Accept: application/json'
    ]
]);

$response = curl_exec($curl);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);

$result = json_decode($response, true);

if ($httpCode === 200 && $result['success']) {
    echo "Money sent successfully!";
    echo "Transaction ID: " . $result['data']['transaction_id'];
} else {
    echo "Error: " . $result['message'];
}
?>Copy

JavaScript/Node.js Example

const axios = require('axios');

const apiKey = 'your_api_key_here';
const baseUrl = 'https://app.julypay.net/api/v1';

async function sendMoney() {
    try {
        const response = await axios.post(`${baseUrl}/wallet/send-money`, {
            recipient_phone: '256701234567',
            amount: 50000,
            description: 'Payment for services',
            sender_pays_fee: true
        }, {
            headers: {
                'Authorization': `Bearer ${apiKey}`,
                'Content-Type': 'application/json'
            }
        });

        if (response.data.success) {
            console.log('Money sent successfully!');
            console.log('Transaction ID:', response.data.data.transaction_id);
        }
    } catch (error) {
        console.error('Error:', error.response.data.message);
    }
}

sendMoney();Copy

Python Example

import requests
import json

api_key = 'your_api_key_here'
base_url = 'https://app.julypay.net/api/v1'

def send_money():
    headers = {
        'Authorization': f'Bearer {api_key}',
        'Content-Type': 'application/json'
    }
    
    data = {
        'recipient_phone': '256701234567',
        'amount': 50000,
        'description': 'Payment for services',
        'sender_pays_fee': True
    }
    
    response = requests.post(
        f'{base_url}/wallet/send-money',
        headers=headers,
        json=data
    )
    
    if response.status_code == 200:
        result = response.json()
        if result['success']:
            print('Money sent successfully!')
            print(f"Transaction ID: {result['data']['transaction_id']}")
        else:
            print(f"Error: {result['message']}")
    else:
        print(f"HTTP Error: {response.status_code}")

send_money()Copy

cURL Example

# Check balance
curl -X GET "https://app.julypay.net/api/v1/wallet/balance" \
  -H "Authorization: Bearer your_api_key_here" \
  -H "Content-Type: application/json"

# Send money
curl -X POST "https://app.julypay.net/api/v1/wallet/send-money" \
  -H "Authorization: Bearer your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "recipient_phone": "256701234567",
    "amount": 50000,
    "description": "Payment for services",
    "sender_pays_fee": true
  }'

# Withdraw to mobile money
curl -X POST "https://app.julypay.net/api/v1/wallet/withdraw/mobile" \
  -H "Authorization: Bearer your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "phone": "256701234567",
    "amount": 100000,
    "description": "Withdrawal to personal account"
  }'Copy

Rate Limits

To ensure fair usage and system stability, the following rate limits apply:

Endpoint

Rate Limit

Window

Balance check

60 requests

per minute

Send money

10 requests

per minute

Withdrawals

5 requests

per minute

Transaction history

30 requests

per minute

Rate Limit Headers

API responses include rate limit headers: X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset.

SDK Libraries (Coming Soon)

Official SDK libraries are in development for the popular programming languages

Updated on