Pay Links
Update Pay Link
Update the details of a specific payment link.
POST
https://dev.mytpe.app/api/v2/mytpe-pay/links/update/{id}Updates the details of an existing payment link.
Authentication: API Key (X-API-KEY + X-API-SECRET headers)
Update Logic & Constraints
The ability to update a link depends heavily on its Current Status and Payment Mode.
Strict Rules
- One-Shot Links: Cannot be updated once created. They are immutable.
- Mode Switching: You cannot change the
payment_modeortype(e.g., switching fromlimitedtoreusableis forbidden). - Restocking: If a
limitedlink is Closed (sold out), you can only update it if you increase themax_payments. This will automatically reopen the link.
Body Parameters
Prop
Type
Example Request
const linkId = 'link-demo-123';
const form = new FormData();
form.append('_method', 'PATCH');
form.append('max_payments', '100');
form.append('title', 'Concert Ticket (Batch 2)');
const response = await fetch(
`https://dev.mytpe.app/api/v2/mytpe-pay/links/update/${linkId}`,
{
method: 'POST',
headers: {
'X-API-KEY': 'your_api_key',
'X-API-SECRET': 'your_api_secret',
},
body: form,
}
);
const data = await response.json();
console.log(data);interface UpdatePayLinkResponse {
success: boolean;
message: string;
data: {
id: string;
title: string;
amount: string;
status: string;
payment_mode: string;
max_payments: number;
successful_payments_count: number;
remaining_payments: number;
};
}
const linkId = 'link-demo-123';
const form = new FormData();
form.append('_method', 'PATCH');
form.append('max_payments', '100');
form.append('title', 'Concert Ticket (Batch 2)');
const response = await fetch(
`https://dev.mytpe.app/api/v2/mytpe-pay/links/update/${linkId}`,
{
method: 'POST',
headers: {
'X-API-KEY': 'your_api_key',
'X-API-SECRET': 'your_api_secret',
},
body: form,
}
);
const data: UpdatePayLinkResponse = await response.json();
console.log(data);import requests
link_id = 'link-demo-123'
url = f'https://dev.mytpe.app/api/v2/mytpe-pay/links/update/{link_id}'
headers = {
'X-API-KEY': 'your_api_key',
'X-API-SECRET': 'your_api_secret',
}
payload = {
'_method': 'PATCH',
'max_payments': '100',
'title': 'Concert Ticket (Batch 2)',
}
response = requests.post(url, headers=headers, data=payload)
data = response.json()
print(data)use Illuminate\Support\Facades\Http;
$linkId = 'link-demo-123';
$response = Http::asMultipart()
->withHeaders([
'X-API-KEY' => 'your_api_key',
'X-API-SECRET' => 'your_api_secret',
])
->post("https://dev.mytpe.app/api/v2/mytpe-pay/links/update/{$linkId}", [
'_method' => 'PATCH',
'max_payments' => 100,
'title' => 'Concert Ticket (Batch 2)',
]);
$data = $response->json();<?php
$linkId = 'link-demo-123';
$curl = curl_init();
$boundary = uniqid();
$delimiter = '-------------' . $boundary;
$fields = [
'_method' => 'PATCH',
'max_payments' => '100',
'title' => 'Concert Ticket (Batch 2)',
];
$postData = '';
foreach ($fields as $name => $value) {
$postData .= "--{$delimiter}\r\n";
$postData .= "Content-Disposition: form-data; name=\"{$name}\"\r\n\r\n";
$postData .= "{$value}\r\n";
}
$postData .= "--{$delimiter}--\r\n";
curl_setopt_array($curl, [
CURLOPT_URL => "https://dev.mytpe.app/api/v2/mytpe-pay/links/update/{$linkId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => $postData,
CURLOPT_HTTPHEADER => [
'X-API-KEY: your_api_key',
'X-API-SECRET: your_api_secret',
'Content-Type: multipart/form-data; boundary=' . $delimiter,
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;const axios = require('axios');
const FormData = require('form-data');
const linkId = 'link-demo-123';
const form = new FormData();
form.append('_method', 'PATCH');
form.append('max_payments', '100');
form.append('title', 'Concert Ticket (Batch 2)');
axios.post(
`https://dev.mytpe.app/api/v2/mytpe-pay/links/update/${linkId}`,
form,
{
headers: {
...form.getHeaders(),
'X-API-KEY': 'your_api_key',
'X-API-SECRET': 'your_api_secret',
},
}
)
.then(response => console.log(response.data))
.catch(error => console.error(error.response?.data));Example Success Response (200 OK)
200 OK
{
"success": true,
"message": "Pay link updated successfully",
"data": {
"id": "link-demo-123",
"mytpe_pay_id": "instance-001",
"title": "Updated Product Title",
"details": "Updated detailed description.",
"logo": null,
"slug": "demo-product",
"type": "dynamic",
"amount": "2500.00",
"status": "active",
"payment_mode": "limited",
"max_payments": 100,
"successful_payments_count": 15,
"metadata": {
"order_id": "ORD-456",
"customer_type": "premium"
},
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-17T10:00:00.000Z",
"payment_link": "https://frontdev.mytpe.app/pay/demo-product",
"remaining_payments": 85
}
}Error Responses
422 Validation Error
{
"message": "The given data was invalid.",
"errors": {
"max_payments": ["The limit (40) cannot be lower than the 50 payments already received."]
}
}403 Forbidden Action
{
"message": "One-shot links cannot be updated."
}