Payment Integration Guide
This guide will walk you through the process of integrating payments into your application using Open Market API.Supported Countries
Open Market supports payments in the following countries:West Africa
- Benin
- Burkina Faso
- Ivory Coast
- Mali
- Senegal
- Togo
Central Africa
- Cameroon
- Congo
- DR Congo
- Gabon
Other Regions
- Uganda
- Zambia
- International
Creating a Payment
To create a payment, you’ll need to make a POST request to our payment endpoint with the required information.Required Parameters
| Parameter | Type | Description |
|---|---|---|
| product_name | string | Name of the product or service being sold |
| price | number | Price in the local currency |
| description | string | Description of the product or transaction |
| buyer_name | string | Customer’s full name |
| buyer_country | string | Customer’s country (see supported countries) |
| reference | string | Your unique transaction reference (6-24 alphanumeric characters, must contain both letters and numbers) |
Optional Parameters
| Parameter | Type | Description |
|---|---|---|
| meta_data | object | Additional data you want to store with the payment |
| success_url | string | URL to redirect after successful payment (must be valid HTTPS/HTTP URL) |
| failed_url | string | URL to redirect after failed payment (must be valid HTTPS/HTTP URL) |
Example Request
Payment Flow
- Create Payment Request
- Send payment details to our API
- Receive a payment URL in response
- Redirect Customer
- Redirect your customer to the received payment URL
- The customer will see our secure payment page
- Payment Processing
- Customer selects their preferred payment method
- Completes the payment on our secure platform
- Payment Confirmation
- After successful payment, customer is redirected to your success URL
- Our system sends a webhook notification to your callback URL
- Failed payments are redirected to your failure URL
Make sure you’ve configured your callback URLs in the API Settings before processing payments.
Country Codes
When specifying thebuyer_country, use one of these exact values:
Best Practices
API Key Security
API Key Security
- Store API keys in environment variables
- Never expose API keys in frontend code
- Use different keys for development and production
- Rotate keys periodically
- Implement IP whitelisting when possible
Environment Variables
Meta Data Usage
Meta Data Usage
Store additional information in the meta_data object to enhance your payment tracking:Benefits of using meta_data:
- Enhanced transaction tracking
- Easier payment reconciliation
- Better customer support handling
- Detailed reporting capabilities
- Simplified order management
- Custom analytics integration
Backend Implementation
Backend Implementation
Always implement payment requests through your backend:
Input Validation
Input Validation
- Always verify the price is positive
- Ensure the country is supported
- Validate buyer information
- Sanitize all user inputs
- Implement request rate limiting
Error Handling
Error Handling
Implement proper error handling and user feedback:
Webhook Security
Webhook Security
- Validate webhook signatures using your private key
- Process webhooks asynchronously
- Implement retry mechanism for failed webhooks
- Store webhook events for audit purposes
Testing Strategy
Testing Strategy
- Use test API keys in development
- Test various payment scenarios
- Verify webhook handling
- Test error scenarios
- Implement end-to-end testing
- Simulate network issues
Monitoring & Logging
Monitoring & Logging
- Log all payment attempts
- Monitor API response times
- Track success/failure rates
- Set up alerts for unusual activity
- Implement transaction tracking
Testing Tips
During development, use test cards and mobile money numbers available in our testing guide.
Common Issues
Payment URL Not Generated
Payment URL Not Generated
- Verify your API key is correct
- Check if all required fields are provided
- Ensure the country code is valid
Redirect Not Working
Redirect Not Working
- Verify the payment URL is valid
- Check if you’re using proper redirect method
- Ensure no client-side JavaScript is blocking the redirect
