Introduction
The PhonePe Custom Checkout API allows you to integrate the PhonePe Payment Gateway directly into your website and within your custom-designed checkout page. This gives you full control over the user experience while supporting popular payment methods like UPI, NetBanking and Cards.
To enable card payments using the Custom Checkout flow, your system must be PCI DSS compliant. This ensures secure handling of card data and aligns with industry standards for safeguarding sensitive payment information.
If you are using the API-based integration, this guide will help you understand the overall payment journey and show you how to implement a smooth and consistent checkout experience tailored to your users.
Prerequisites
Before you start the integration process, ensure you have:
- Access to PhonePe PG’s UAT (User Acceptance Testing) and production environments.
- API credentials, including the client ID and client secret.
- A basic understanding of HTTP methods (GET, POST) and JSON.
- A testing environment to simulate payment flows.
Environments
Use the environment URLs below to integrate and test your API calls. The Sandbox environment is intended for testing and validation, while the Production environment should be used once your integration is live. Make sure to switch the base URL based on the environment you’re working in.
| Environment | API |
| Sandbox | https://api-preprod.phonepe.com/apis/pg-sandbox/<Endpoint> |
| Production | https://api.phonepe.com/apis/pg/<Endpoint> |
📘 Test Before Production!
To ensure a smooth integration, please integrate with the Test environment first and then move to production.
API Endpoints
Here is a quick reference to the key APIs used in the Custom Checkout flow. Each API serves a specific purpose, from starting a transaction to processing refunds and retrieving statuses. Use this table to identify the right endpoint to call for every step in the payment journey.
| API | Method | Endpoint |
| Authorization | POST | /v1/oauth/token |
| Initiate Payment | POST | /payments/v2/pay |
| Order Status | GET | /payments/v2/order/{merchantOrderId}/status |
| Refund | POST | /payments/v2/refund |
| Refund Status API | GET | /payments/v2/refund/{merchantRefundId}/status |
What’s Next?
In the next section, you will find the steps to integrate with PhonePe PG. It provides a clear overview of the integration flow, outlining what needs to be integrated and how to get started with the implementation.