API Reference
Payin

Payin API

Create and manage payment collections.

Create Payment

POST https://api.payvanta.in/payin

Authentication

This endpoint requires Bearer token authentication. The token should be generated by Base64 encoding your API credentials in the format api_key:api_secret.

Authorization: Bearer <base64_encoded_credentials>

Request Headers

HeaderValueRequired
AuthorizationBearer {token}Yes
Content-Typeapplication/jsonYes

Request Parameters

Body Parameters

ParameterTypeRequiredDescription
order_idstringYesUnique identifier for the transaction (max 15 digits)
amountnumberYesAmount to be collected (in INR)
mobile_nostringYesCustomer's mobile number

Example Request

{
    "order_id": "123456789012345",
    "amount": 50,
    "mobile_no": "9910000065"
}

Validation Rules

  • order_id: Must be unique and cannot exceed 15 digits
  • amount: Must be a positive number
  • mobile_no: Must be a valid Indian mobile number

Response

Success Response (200 OK)

{
    "success": true,
    "message": "PAYIN_INITIATED",
    "data": {
        "order_id": "123456789012345",
        "amount": 50,
        "status": "PENDING",
        "payment_link": "upi://pay?ver=01&mode=19&pa=merchant@upi&pn=PayVanta&tr=123456789012345&cu=INR&mc=8241&qrMedium=04&tn=PaymenttoPayVanta&am=49.97"
    }
}

Response Fields

FieldTypeDescription
successbooleanIndicates if the request was successful
messagestringStatus message
data.order_idstringYour order ID for reference
data.amountnumberAmount of the transaction
data.statusstringStatus of the transaction (PENDING, FAILED)
data.payment_linkstringUPI payment link for direct app opening

Error Responses

Invalid Request (400)

{
    "success": false,
    "message": "INVALID_REQUEST",
    "error": "Missing required field: amount"
}

Invalid Order ID (400)

{
    "success": false,
    "message": "INVALID_ORDER_ID",
    "error": "Order ID cannot exceed 15 digits"
}

Unauthorized (401)

{
    "success": false,
    "message": "UNAUTHORIZED",
    "error": "Invalid authentication credentials"
}

Code Examples

cURL

curl -X POST https://api.payvanta.in/payin \
  -H "Authorization: Bearer YXBpX2tleTphcGlfc2VjcmV0" \
  -H "Content-Type: application/json" \
  -d '{
    "order_id": "123456789012345",
    "amount": 50,
    "mobile_no": "9910000065"
  }'

Python

import requests
import base64
 
# Generate Bearer token
api_key = "your_api_key"
api_secret = "your_api_secret"
credentials = f"{api_key}:{api_secret}"
token = base64.b64encode(credentials.encode()).decode()
 
# API endpoint
url = "https://api.payvanta.in/payin"
 
# Request headers
headers = {
    "Authorization": f"Bearer {token}",
    "Content-Type": "application/json"
}
 
# Request body
data = {
    "order_id": "123456789012345",
    "amount": 50,
    "mobile_no": "9910000065"
}
 
# Make the request
response = requests.post(url, headers=headers, json=data)
print(response.json())

Node.js

const axios = require('axios');
 
// Generate Bearer token
const apiKey = 'your_api_key';
const apiSecret = 'your_api_secret';
const credentials = `${apiKey}:${apiSecret}`;
const token = Buffer.from(credentials).toString('base64');
 
// API endpoint
const url = 'https://api.payvanta.in/payin';
 
// Request headers
const headers = {
  'Authorization': `Bearer ${token}`,
  'Content-Type': 'application/json'
};
 
// Request body
const data = {
  order_id: "123456789012345",
  amount: 50,
  mobile_no: "9910000065"
};
 
// Make the request
axios.post(url, data, { headers })
  .then(response => console.log(response.data))
  .catch(error => console.error(error));