PhonePey by Lushai Dev
Official PhonePey Gateway Documentation & API Specs

Developer API & Integration Guide

Accept fast, zero-fee UPI payments directly into your bank. Our engine verifies payments in real time. We provide ready code for PHP, Node.js, Python, and JavaScript.

1. Overview & Authentication

PhonePey provides a clean REST API. You can create orders and verify payments in real time. Authentication is fast. Pass your user_token with each request.

Base Endpoint URL https://phonepey.lushai.dev/api
Authentication Methods Pass user_token in JSON body or Bearer Token header

2. Create Order API

POST /api/create-order

Create a dynamic UPI checkout session. Buyers can scan a QR code. They can also tap a 1-click intent button for PhonePe, Google Pay, or Paytm.

Request Parameters:

Parameter Type Requirement Description
user_token string Required Your unique merchant integration token obtained from Developer Settings.
amount string / float Required Transaction amount (e.g. "149" or 149.00). Min ₹1.00.
order_id string Required Your custom unique order identifier (e.g. "ORD_174000123").
customer_mobile string Required Customer's active 10-digit mobile number.
redirect_url string Required Destination URL where customer is redirected upon successful payment.
remark1 string Optional Internal customer name, product title, or correlation note.
remark2 string Optional Additional server-side tracking reference.
curl -X POST https://phonepey.lushai.dev/api/create-order \ -H "Content-Type: application/json" \ -d '{ "user_token": "YOUR_USER_TOKEN", "amount": "149.00", "order_id": "ORD_174000123", "customer_mobile": "9876543210", "redirect_url": "https://yourwebsite.com/payment-success", "remark1": "Pro Plan Subscription" }'

JSON Response (200 OK):

{ "status": true, "message": "Order created successfully", "result": { "order_id": "ORD_174000123", "payment_url": "https://phonepey.lushai.dev/pay?token=8c4e51...", "amount": "149.00", "token": "8c4e5192c73bb...", "upi_intent": "upi://pay?pa=store@ybl&pn=Store&am=149.00&cu=INR&tn=ORD_174000123", "qr_data": "upi://pay?pa=store@ybl&pn=Store&am=149.00&cu=INR&tn=ORD_174000123", "created_at": "2026-08-22 17:20:00" } }

3. Check Order Status API

POST /api/check-status

Check the real-time status of an order using your order_id. When paid, the engine returns the verified 12-digit UTR number.

Request Parameters:

Parameter Type Requirement Description
user_token string Required Your merchant integration token.
order_id string Required The specific unique order ID string to verify status for.
curl -X POST https://phonepey.lushai.dev/api/check-status \ -H "Content-Type: application/json" \ -d '{ "user_token": "YOUR_USER_TOKEN", "order_id": "ORD_174000123" }'

Verified JSON Response:

{ "status": true, "message": "Order status retrieved", "result": { "order_id": "ORD_174000123", "status": "SUCCESS", "amount": "149.00", "utr": "412398765432", "verified": true, "transaction_date": "2026-08-22 17:21:00", "remark1": "Pro Plan Subscription" } }

4. Webhooks & Instant Payment Notifications

When a customer payment succeeds, PhonePey sends an instant HTTP POST event to your Webhook URL. You can set your Webhook URL in Developer Settings:

WEBHOOK PAYLOAD (POST)
{ "event": "order.paid", "timestamp": "2026-08-22T17:21:00+05:30", "order_id": "ORD_174000123", "amount": "149.00", "utr": "412398765432", "status": "SUCCESS", "remark1": "Pro Plan Subscription" }
PHP WEBHOOK LISTENER EXAMPLE
<?php $payload = file_get_contents('php://input'); $event = json_decode($payload, true); if ($event && ($event['status'] ?? '') === 'SUCCESS') { $orderId = $event['order_id']; $utr = $event['utr']; $amount = $event['amount']; // Update your database order as PAID // fulfill_order($orderId, $utr); http_response_code(200); echo json_encode(['status' => 'acknowledged']); } else { http_response_code(400); } ?>

5. JavaScript Embed SDK (Popup Modal)

Recommended for Websites

Add a popup payment modal to your site. You need only two lines of JavaScript code:

HTML / FRONTEND CODE
<!-- 1. Include PhonePey SDK --> <script src="https://phonepey.lushai.dev/assets/phonepey.js"></script> <!-- 2. Trigger Payment Button --> <button onclick="checkout()" class="btn btn-primary">Pay ₹149 with UPI</button> <script> function checkout() { PhonePey.pay({ user_token: "YOUR_USER_TOKEN", amount: 149.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>
Official Plugin • WordPress 5.6 - 6.6+ • WooCommerce 4.0 - 9.2+

6. Official WooCommerce UPI Gateway Plugin

Connect your WooCommerce e-commerce store with PhonePey. Accept UPI payments straight to your bank account with zero gateway fee and real-time automated order fulfillment.

Download Plugin (.ZIP)
1. Instant Installation

Download the ZIP file. In your WordPress Admin, go to Plugins → Add New → Upload Plugin, choose phonepey-woocommerce.zip, click Install Now and Activate.

2. One-Key Configuration

Navigate to WooCommerce → Settings → Payments → PhonePey UPI. Enable the gateway and paste your API Key (user_token) from your PhonePey Dashboard.

3. Automated Instant Fulfillment

Copy your Webhook endpoint: https://yourdomain.com/?wc-api=phonepey_webhook and paste it into your PhonePey API Integration settings. All paid orders automatically update to Processing with UTR reference recorded!

7. Auto Payment Capture & Merchant Setup Guides

PhonePey delivers instant 0% commission direct settlement. To enable automated real-time transaction verification, complete these 2 quick setup steps:

Step 1: Add Email in PhonePe Business App
Link your notification Gmail address inside your PhonePe Business profile
Step 2: Generate Google App Password Settings
Create a 16-character secure App Password for IMAP auto-capture

8. Interactive Live API Tester & Demo

Open Full Checkout Demo

Execute live test requests to /api/create-order directly in your browser, or visit our dedicated Live Checkout Simulator to test real-time 10–40s auto-capture:

Compatible Apps: UPI PhonePe Google Pay Paytm BharatPe
API RESPONSE AWAITING REQUEST
Click "Execute Create Order Request" above to test live endpoint...

9. HTTP Status Codes & Error Handling

PhonePey returns standard HTTP response codes alongside JSON error objects:

Code Meaning Typical Cause
200 OK Success Order created or status retrieved successfully.
401 Unauthorized Invalid Token Missing, invalid, or expired user_token.
422 Unprocessable Validation Error Missing order_id, invalid customer_mobile, or amount < ₹1.
404 Not Found Not Found Order identifier does not exist in your account.