PhonePey Gateway Integration Guide
Merchant Integration & API Docs
Accept 0% commission UPI payments directly into your PhonePe Business or UPI account with real-time automated verification.
1. Quick Overview & Authentication
Integrating PhonePey requires only a single parameter: your user_token (API Token). You don't need complicated public/private key pairs or mandatory webhooks.
Authentication
Pass
user_token in JSON body or Bearer Header
Direct Settlements
0% Commission straight to your Bank / PhonePe
2. JavaScript Embed Modal (2-Line Integration)
Recommended for WebsitesInclude the PhonePey JavaScript SDK in your website and trigger the popup modal with a single function call:
HTML / FRONTEND CODE
<!-- 1. Include PhonePey SDK -->
<script src="https://www.phonepey.lushai.dev/assets/phonepey.js"></script>
<!-- 2. Trigger Payment Button -->
<button onclick="checkout()">Pay ₹499 with UPI</button>
<script>
function checkout() {
PhonePey.pay({
user_token: "YOUR_API_USER_TOKEN",
amount: 499.00,
order_id: "ORD_" + Date.now(),
title: "Pro Monthly License",
customer_name: "John Doe",
customer_mobile: "9876543210",
onSuccess: function(data) {
alert("Payment Successful! UTR: " + data.utr);
window.location.reload();
},
onFailure: function(err) {
alert("Payment Failed or Cancelled");
}
});
}
</script>
3. Create Order / Payment Link (Backend API)
POST /api/v1/create_linkCreate a payment session from your backend server (PHP, Node.js, Python, WordPress, Laravel, etc.).
| Field | Type | Required | Description |
|---|---|---|---|
user_token |
string | REQUIRED | Your Merchant API Token from Dashboard. |
amount |
float | OPTIONAL | Order amount in INR (₹). If null, customer enters amount. |
title |
string | OPTIONAL | Product name or Order ID (e.g. Order #1024). |
redirect_url |
string (URL) | OPTIONAL | Redirect destination URL after payment is captured. |
cURL
curl -X POST "https://www.phonepey.lushai.dev/api/v1/create_link" \
-H "Content-Type: application/json" \
-d '{
"user_token": "YOUR_USER_TOKEN",
"amount": 499.00,
"title": "Order #1024",
"redirect_url": "https://yourstore.com/thankyou"
}'