Pay Links
Toggle Pay Link Status
Manually switch a link between active and inactive.
PATCH
https://dev.mytpe.app/api/v2/mytpe-pay/links/{id}/toggle-statusToggles the status of a payment link between 'active' and 'inactive'.
Authentication: API Key (X-API-KEY + X-API-SECRET headers)
State Logic
This endpoint is strictly for pausing and resuming links. It cannot be used to "reset" a finished transaction flow.
Closed Links are Locked
You cannot use this endpoint on a link that is closed.
- Why? A closed link means the business goal (invoice paid, stock sold out) has been met.
- How to fix? To reopen a
limitedlink, you must use the Update Link endpoint to increase themax_paymentsquota.
Path Parameters
Prop
Type
Example Request
const toggleStatus = async () => {
const response = await fetch("https://dev.mytpe.app/api/v2/mytpe-pay/links/paylink_id/toggle-status", {
method: "PATCH",
headers: {
"X-API-KEY": "your_api_key",
"X-API-SECRET": "your_api_secret",
},
});
const data = await response.json();
console.log(data);
};
toggleStatus();interface ToggleStatusResponse {
success: boolean;
message: string;
data: {
id: string;
title: string;
status: string;
updated_at: string;
};
}
const toggleStatus = async (): Promise<void> => {
const response = await fetch("https://dev.mytpe.app/api/v2/mytpe-pay/links/paylink_id/toggle-status", {
method: "PATCH",
headers: {
"X-API-KEY": "your_api_key",
"X-API-SECRET": "your_api_secret",
},
});
const data: ToggleStatusResponse = await response.json();
console.log(data);
};
toggleStatus();import requests
url = "https://dev.mytpe.app/api/v2/mytpe-pay/links/paylink_id/toggle-status"
headers = {
"X-API-KEY": "your_api_key",
"X-API-SECRET": "your_api_secret",
}
response = requests.patch(url, headers=headers)
print(response.json())use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'X-API-KEY' => 'your_api_key',
'X-API-SECRET' => 'your_api_secret',
])->patch('https://dev.mytpe.app/api/v2/mytpe-pay/links/paylink_id/toggle-status');
$data = $response->json();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://dev.mytpe.app/api/v2/mytpe-pay/links/paylink_id/toggle-status',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_HTTPHEADER => [
'X-API-KEY: your_api_key',
'X-API-SECRET: your_api_secret',
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;const axios = require("axios");
axios
.patch("https://dev.mytpe.app/api/v2/mytpe-pay/links/paylink_id/toggle-status", null, {
headers: {
"X-API-KEY": "your_api_key",
"X-API-SECRET": "your_api_secret",
},
})
.then((response) => {
console.log(response.data);
})
.catch((error) => {
console.error(error);
});Success Response
200 OK
{
"success": true,
"message": "Pay link status updated successfully",
"data": {
"id": "paylink_abc123",
"title": "Awesome Product",
"status": "inactive",
"updated_at": "2025-12-17T13:00:00.000000Z"
}
}Error Responses
403 Forbidden
{
"message": "Cannot change status of a closed payment link. A closed link cannot be reopened."
}