Cancel Payment Link
Use the Cancel Payment Link API to deactivate an active payment link that is no longer required. This helps ensure that customers can’t make payments through outdated or invalid links. Once cancelled, the link becomes inactive and cannot be used for further transactions.
Environment
| Environment | HTTP Method | API |
| Sandbox | POST | https://api-preprod.phonepe.com/apis/pg-sandbox/paylinks/v1/{merchantOrderId}/cancel |
| Production | POST | https://api.phonepe.com/apis/pg/paylinks/v1/{merchantOrderId}/cancel |
Request
Request Headers
| Header Name | Header Value |
Content-Type | application/json |
Authorization | O-Bearer <merchant-auth-token> |
⚠️ For Partner Integrations!
It is mandatory to include the X-MERCHANT-ID header with the MerchantID of the end merchant.
Response
Case 1: Response for Payment Link cancelled Successfully
{
"orderId": "OMOxx",
"state": "CANCELLED"
}Case 2: Response for Payment Link already in Terminal State.
{
"code": "BAD_REQUEST",
"message": "Please check the inputs you have provided. [already in terminal state]"
}Response Parameters
| Environment | Type | Description |
orderId | String | Payment Gateway generated internal order ID. |
state | String | Defines the State of the Payment Link as Cancelled. |
Error Response Parameters
| Environment | Type | Description |
code | String | Error Code |
message | String | Error Description |
Try it yourself!
headers
url params
What’s Next?
Now that you have learnt on how to cancel the created payment link. Now let’s proceed to understand how the payment link can be shared with customers through various communication channels such as SMS, email services.