MyTPEMyTPE Pay
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-status

Toggles 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 limited link, you must use the Update Link endpoint to increase the max_payments quota.

Path Parameters

Prop

Type

Example Request

toggle-status.js
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();
toggle-status.ts
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();
toggle_status.py
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())
ToggleStatusController.php
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();
toggle-status.php
<?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;
toggle-status.cjs
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."
}

On this page