Cancel Payment Link
Cancel an active payment link
POST
/
api
/
v2
/
payment-links
/
{id}
/
cancel
Cancel Payment Link
curl --request POST \
--url https://api.example.com/api/v2/payment-links/{id}/cancelimport requests
url = "https://api.example.com/api/v2/payment-links/{id}/cancel"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/api/v2/payment-links/{id}/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v2/payment-links/{id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v2/payment-links/{id}/cancel"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v2/payment-links/{id}/cancel")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v2/payment-links/{id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyCancel Payment Link
Cancel an active payment link to prevent it from being used. Only links withactive status can be cancelled.
Authentication
Authorization: Bearer glm_test_YOUR_API_KEY
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Payment link ID (e.g., plink_abc123xyz) |
Request Body
{
"reason": "Customer requested cancellation"
}
| Parameter | Type | Required | Description |
|---|---|---|---|
reason | string | No | Reason for cancellation (max 500 chars) |
Response
All monetary amounts are integers in cents (e.g., 4995 = $49.95).
{
"id": "plink_abc123xyz",
"amount": 4995,
"currency": "USD",
"description": "Premium Blood Pressure Monitor",
"status": "cancelled",
"cancelled_at": "2026-02-25T16:00:00Z",
"cancellation_reason": "Customer requested cancellation"
}
Example
curl -X POST https://api.withgale.com/api/v2/payment-links/plink_abc123xyz/cancel \
-H "Authorization: Bearer glm_test_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "reason": "Order cancelled by customer" }'
Cancellation Rules
| Current Status | Can Cancel? | Notes |
|---|---|---|
active | Yes | Status changes to cancelled |
paid | No | Use Create Refund instead |
expired | No | Already expired |
cancelled | No | Already cancelled |
Cancelled links cannot be reactivated. Create a new link if needed.
Webhooks
Cancelling a link triggers apayment_link.cancelled webhook event. See Webhooks Reference for details.
Errors
| Status Code | Error Code | Description |
|---|---|---|
| 400 | invalid_state | Link is not in cancellable state |
| 401 | unauthorized | Invalid or missing API key |
| 404 | not_found | Payment link not found |
Related
โI
Cancel Payment Link
curl --request POST \
--url https://api.example.com/api/v2/payment-links/{id}/cancelimport requests
url = "https://api.example.com/api/v2/payment-links/{id}/cancel"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/api/v2/payment-links/{id}/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v2/payment-links/{id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v2/payment-links/{id}/cancel"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v2/payment-links/{id}/cancel")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v2/payment-links/{id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body