API Reference

Complete REST API documentation for Davspay payment gateway

Authentication

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.

Payments

POST/payments

Create a new payment. Returns a payment object with payment URL for customer checkout.

Request Body

ParameterTypeRequiredDescription
amountintegerRequiredAmount in paise (e.g., 1000 for ₹10)
currencystringRequiredThree-letter ISO currency code (INR)
customerobjectRequiredCustomer information (email, phone, name)
descriptionstringOptionalDescription of the payment
callback_urlstringRequiredURL to redirect after payment
metadataobjectOptionalCustom metadata (max 50 key-value pairs)

Example Request

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>

Example Response

{
  <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>
  }
}
GET/payments/:id

Retrieve details of a specific payment by its ID.

Example Request

curl -X GET https://api.davspaysolution.com/v1/payments/pay_1234567890abcdef \
  -H <span class="string">"Authorization: Bearer your_api_key_here"</span>

Payment Status Values

StatusDescription
createdPayment created, awaiting customer action
pendingPayment initiated by customer
authorizedPayment authorized, awaiting capture
capturedPayment successfully captured
failedPayment failed
cancelledPayment cancelled by customer or merchant

Refunds

POST/refunds

Initiate a refund for a captured payment. Partial and full refunds are supported.

Request Body

ParameterTypeRequiredDescription
payment_idstringRequiredID of the payment to refund
amountintegerOptionalAmount to refund (defaults to full amount)
reasonstringOptionalReason for refund

Webhooks

Webhooks allow you to receive real-time notifications about payment events. Configure your webhook URL in the Dashboard under Settings → Webhooks.

Webhook Events

EventDescription
payment.createdPayment object created
payment.capturedPayment successfully captured
payment.failedPayment failed
refund.createdRefund initiated
refund.completedRefund completed successfully

Webhook Payload Example

{
  <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>
    }
  }
}