Empowering innovation in agricultural finance through cutting-edge APIs and developer tools.
Comprehensive guides and references to integrate with our agricultural finance platform
Process agricultural payments, escrow services, and bulk disbursements with our unified API.
Manage farmer accounts, savings programs, and credit facilities programmatically.
Access market prices, weather data, and farm analytics to build smarter solutions.
API Uptime
Average Response
Developer Support
Example implementations with our most popular APIs
const nacpo = require('nacpo-sdk');
nacpo.configure({
apiKey: 'your_live_or_test_key',
environment: process.env.NODE_ENV || 'sandbox'
});
// Create payment for farm inputs
async function createFarmPayment() {
try {
const payment = await nacpo.payments.create({
amount: 75000, // in kobo (NGN)
farmerId: 'farmer_789XYZ',
description: 'Purchase of fertilizer and seeds',
metadata: {
cropType: 'Maize',
season: '2023 Planting Season',
location: 'Kaduna, NG'
},
callbackUrl: 'https://yourfarmapp.com/webhook'
});
console.log('Payment initialized:', payment);
return payment.authorizationUrl;
} catch (error) {
console.error('Payment error:', error.response?.data || error.message);
throw error;
}
}
import nacpoxygen
from nacpoxygen.exceptions import ApiError
# Configure the SDK
nacpoxygen.api_key = "your_live_or_test_key"
nacpoxygen.environment = "sandbox" # or "production"
def create_harvest_payment():
try:
payment = nacpoxygen.Payment.create(
amount=150000, # in kobo (NGN)
farmer_id="farmer_789XYZ",
description="Sale of harvested cassava",
metadata={
"crop_yield": "12.5 tons",
"buyer_id": "agro-processor-456",
"quality_rating": "Grade A"
}
)
print(f"Payment created: {payment.id}")
return payment.authorization_url
except ApiError as e:
print(f"Payment failed: {e}")
raise
curl -X POST https://api.nacpoxygen.com/v1/payments \
-H "Authorization: Bearer your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"amount": 50000,
"farmer_id": "farmer_123ABC",
"description": "Purchase of hybrid seeds",
"metadata": {
"farm_size": "5 hectares",
"crop_type": "Rice",
"season": "2023 Wet Season"
},
"callback_url": "https://yourwebhook.com/payments"
}'
// Webhook handler for farm transactions
app.post('/webhook/farm-payments', async (req, res) => {
const sig = req.headers['x-nacpo-signature'];
const payload = req.body;
try {
// Verify the webhook signature
const event = nacpo.webhooks.constructEvent(
payload,
sig,
process.env.NACPO_WEBHOOK_SECRET
);
if (event.type === 'payment.success') {
const payment = event.data;
// Update farm records
await updateFarmLedger(payment.farmerId, {
amount: payment.amount / 100, // Convert to Naira
transactionId: payment.id,
purpose: payment.description,
date: new Date(payment.createdAt)
});
// Trigger next actions (e.g., input delivery)
if (payment.metadata.cropType) {
await scheduleInputDelivery(payment);
}
}
res.status(200).send('Webhook processed');
} catch (err) {
console.error('Webhook error:', err);
res.status(400).send(`Webhook Error: ${err.message}`);
}
});
from flask import Flask, request, jsonify
import nacpoxygen
app = Flask(__name__)
@app.route('/webhook/farm-payments', methods=['POST'])
def handle_webhook():
payload = request.get_data(as_text=True)
sig_header = request.headers.get('X-Nacpo-Signature')
try:
event = nacpoxygen.Webhook.construct_event(
payload,
sig_header,
os.getenv('NACPO_WEBHOOK_SECRET')
)
if event['type'] == 'payment.success':
payment = event['data']
# Update agri-records
update_farm_transaction(
farmer_id=payment['farmerId'],
amount=payment['amount'] / 100,
purpose=payment['description'],
items=payment['metadata'].get('items', [])
)
# If harvest payment, trigger logistics
if 'harvest_details' in payment['metadata']:
schedule_produce_collection(payment)
return jsonify(success=True), 200
except Exception as e:
print(f"Webhook error: {str(e)}")
return jsonify(error=str(e)), 400
# Verify a transaction status
curl -X GET \
"https://api.nacpoxygen.com/v1/transactions/txn_123456789" \
-H "Authorization: Bearer your_api_key_here" \
-H "Content-Type: application/json"
# Sample Response:
# {
# "id": "txn_123456789",
# "amount": 50000,
# "status": "success",
# "farmerId": "farmer_123ABC",
# "description": "Purchase of hybrid seeds",
# "metadata": {
# "farm_size": "5 hectares",
# "crop_type": "Rice"
# },
# "createdAt": "2023-06-15T09:30:45Z"
# }
Language-specific packages for seamless integration
For Java 8 and Android
<dependency>
<groupId>com.nacpo</groupId>
<artifactId>oxygen</artifactId>
<version>2.3.0</version>
</dependency>
Everything you need to build agricultural finance solutions
Explore our open-source SDKs, sample apps, and community projects.
Browse GitHubJoin thousands of developers building the next generation of agri-finance solutions with NACPOXYGEN's powerful platform.