Complete REST API documentation for Davspay payment gateway
All API requests must be authenticated using your API key. Include it in the Authorization header:
<span class="property">Authorization</span>: <span class="keyword">Bearer</span> <span class="string">your_api_key_here</span>
Base URL: https://api.davspaysolution.com/v1
You can get your API keys from the Dashboard under Settings → API Keys. Keep your API keys secure and never expose them in client-side code.
/paymentsCreate a new payment. Returns a payment object with payment URL for customer checkout.
| Parameter | Type | Required | Description |
|---|---|---|---|
amount | integer | Required | Amount in paise (e.g., 1000 for ₹10) |
currency | string | Required | Three-letter ISO currency code (INR) |
customer | object | Required | Customer information (email, phone, name) |
description | string | Optional | Description of the payment |
callback_url | string | Required | URL to redirect after payment |
metadata | object | Optional | Custom metadata (max 50 key-value pairs) |
curl -X POST https://api.davspaysolution.com/v1/payments \
-H <span class="string">"Authorization: Bearer your_api_key_here"</span> \
-H <span class="string">"Content-Type: application/json"</span> \
-d <span class="string">'{
"amount": 100000,
"currency": "INR",
"customer": {
"email": "customer@example.com",
"phone": "+919876543210",
"name": "John Doe"
},
"description": "Payment for Order #12345",
"callback_url": "https://yoursite.com/payment/success",
"metadata": {
"order_id": "12345",
"product_name": "Premium Plan"
}
}'</span>{
<span class="property">"id"</span>: <span class="string">"pay_1234567890abcdef"</span>,
<span class="property">"object"</span>: <span class="string">"payment"</span>,
<span class="property">"amount"</span>: <span class="number">100000</span>,
<span class="property">"currency"</span>: <span class="string">"INR"</span>,
<span class="property">"status"</span>: <span class="string">"created"</span>,
<span class="property">"customer"</span>: {
<span class="property">"email"</span>: <span class="string">"customer@example.com"</span>,
<span class="property">"phone"</span>: <span class="string">"+919876543210"</span>,
<span class="property">"name"</span>: <span class="string">"John Doe"</span>
},
<span class="property">"description"</span>: <span class="string">"Payment for Order #12345"</span>,
<span class="property">"payment_url"</span>: <span class="string">"https://checkout.davspaysolution.com/pay/1234567890abcdef"</span>,
<span class="property">"callback_url"</span>: <span class="string">"https://yoursite.com/payment/success"</span>,
<span class="property">"created_at"</span>: <span class="string">"2024-12-09T12:00:00Z"</span>,
<span class="property">"metadata"</span>: {
<span class="property">"order_id"</span>: <span class="string">"12345"</span>,
<span class="property">"product_name"</span>: <span class="string">"Premium Plan"</span>
}
}/payments/:idRetrieve details of a specific payment by its ID.
curl -X GET https://api.davspaysolution.com/v1/payments/pay_1234567890abcdef \ -H <span class="string">"Authorization: Bearer your_api_key_here"</span>
| Status | Description |
|---|---|
created | Payment created, awaiting customer action |
pending | Payment initiated by customer |
authorized | Payment authorized, awaiting capture |
captured | Payment successfully captured |
failed | Payment failed |
cancelled | Payment cancelled by customer or merchant |
/refundsInitiate a refund for a captured payment. Partial and full refunds are supported.
| Parameter | Type | Required | Description |
|---|---|---|---|
payment_id | string | Required | ID of the payment to refund |
amount | integer | Optional | Amount to refund (defaults to full amount) |
reason | string | Optional | Reason for refund |
Webhooks allow you to receive real-time notifications about payment events. Configure your webhook URL in the Dashboard under Settings → Webhooks.
| Event | Description |
|---|---|
payment.created | Payment object created |
payment.captured | Payment successfully captured |
payment.failed | Payment failed |
refund.created | Refund initiated |
refund.completed | Refund completed successfully |
{
<span class="property">"event"</span>: <span class="string">"payment.captured"</span>,
<span class="property">"timestamp"</span>: <span class="string">"2024-12-09T12:00:00Z"</span>,
<span class="property">"data"</span>: {
<span class="property">"id"</span>: <span class="string">"pay_1234567890abcdef"</span>,
<span class="property">"amount"</span>: <span class="number">100000</span>,
<span class="property">"currency"</span>: <span class="string">"INR"</span>,
<span class="property">"status"</span>: <span class="string">"captured"</span>,
<span class="property">"customer"</span>: {
<span class="property">"email"</span>: <span class="string">"customer@example.com"</span>,
<span class="property">"phone"</span>: <span class="string">"+919876543210"</span>
}
}
}