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.
user_token in JSON body or Bearer Token header
2. Create Order API
POST /api/create-orderCreate 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. |
JSON Response (200 OK):
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. |
Verified JSON Response:
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:
5. JavaScript Embed SDK (Popup Modal)
Recommended for WebsitesAdd a popup payment modal to your site. You need only two lines of JavaScript code:
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 the ZIP file. In your WordPress Admin, go to Plugins → Add New → Upload Plugin, choose phonepey-woocommerce.zip, click Install Now and Activate.
Navigate to WooCommerce → Settings → Payments → PhonePey UPI. Enable the gateway and paste your API Key (user_token) from your PhonePey Dashboard.
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:
7. UPI Intent & Mobile Deep Link Specs
Construct custom mobile deep links to trigger installed UPI applications directly:
| Target App | Intent Scheme Format |
|---|---|
| PhonePe | phonepe://pay?pa={VPA}&pn={NAME}&am={AMOUNT}&cu=INR&tn={NOTE} |
| Google Pay | gpay://upi/pay?pa={VPA}&pn={NAME}&am={AMOUNT}&cu=INR&tn={NOTE} |
| Paytm | paytmmp://pay?pa={VPA}&pn={NAME}&am={AMOUNT}&cu=INR&tn={NOTE} |
| Universal UPI | upi://pay?pa={VPA}&pn={NAME}&am={AMOUNT}&cu=INR&tn={NOTE} |
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:
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. |