Developer Tools

Integrate our payment gateway into your application with our comprehensive API documentation and code examples.

API
API Overview
Learn how to integrate our payment gateway using REST API

Base URL

https://www.payesv.com/api/initiate-payment

Required Headers

x-api-key: YOUR_API_KEY
x-brand-key: YOUR_BRAND_KEY
x-api-secret: YOUR_API_SECRET
Content-Type: application/json

Request Body Format (Example)

{
  "amount": "100",
  "currency": "BDT/USD",
  "customer": {
    "name": "Anis Rahman",
    "email": "anis@gmail.com",
    "phone": "01826673690"
  },
  "orderId": "ord17238",
  "redirectUrl": {
    "success": "https://www.your-domain.com/success",
    "failed": "https://www.your-domain.com/failed"
  }
}
Integration Examples
Choose your preferred programming language to see implementation examples

Create Payment Integration

PHP Integration

<?php
// Payment Gateway Integration - PHP
class PaymentGateway {
    private $apiKey = 'YOUR_API_KEY';
    private $brandKey = 'YOUR_BRAND_KEY';
    private $apiSecret = 'YOUR_API_SECRET';
    private $baseUrl = 'https://www.payesv.com/api/initiate-payment';

    public function createPayment($amount, $customer, $orderId, $redirectUrls) {
        $data = [
            'amount' => $amount,
            'currency' => 'BDT',
            'customer' => $customer,
            'orderId' => $orderId,
            'redirectUrl' => $redirectUrls
        ];

        $headers = [
            'x-api-key: ' . $this->apiKey,
            'x-brand-key: ' . $this->brandKey,
            'x-api-secret: ' . $this->apiSecret,
            'Content-Type: application/json'
        ];

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $this->baseUrl);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

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

        $responseData = json_decode($response, true);
        
        if ($httpCode === 200) {
            return [
                'status' => 'success',
                'message' => $responseData['message'],
                'id' => $responseData['id'],
                'redirectGatewayUrl' => $responseData['redirectGatewayUrl']
            ];
        } else {
            return [
                'status' => 'error',
                'message' => $responseData['message'] ?? 'Request failed'
            ];
        }
    }
}

// Usage Example
$paymentGateway = new PaymentGateway();

$customer = [
    'name' => 'Anis Rahman',
    'email' => 'anis@gmail.com',
    'phone' => '01826673690'
];

$redirectUrls = [
    'success' => 'https://your-domain.com/success',
    'failed' => 'https://your-domain.com/failed'
];

$result = $paymentGateway->createPayment('100', $customer, 'ord17238', $redirectUrls);
echo json_encode($result, JSON_PRETTY_PRINT);
?>
Success Response
{
  "message": "Payment initiated successfully",
  "id": "transaction_id_here",
  "redirectGatewayUrl": "https://checkout.payesv.com/pay/transaction_id_here"
}
Error Response
{
  "status": "error",
  "message": "Invalid API Key or API Secret or Brand Key"
}
Security & Best Practices

🔐 Security Guidelines

  • Never expose your API credentials in client-side code
  • Use HTTPS for all API communications
  • Implement proper input validation and sanitization
  • Store sensitive data securely using environment variables
  • Implement rate limiting to prevent abuse

✅ Best Practices

  • Always handle API responses and errors gracefully
  • Implement webhook notifications for payment status updates
  • Use unique order IDs for each transaction
  • Test thoroughly in sandbox environment before going live
  • Implement proper logging for debugging and monitoring