Cancel a payment link
curl --request PATCH \
--url https://api.fintoc.com/v1/payment_links/{id}/cancel \
--header 'Authorization: <api-key>'import requests
url = "https://api.fintoc.com/v1/payment_links/{id}/cancel"
headers = {"Authorization": "<api-key>"}
response = requests.patch(url, headers=headers)
print(response.text)const options = {method: 'PATCH', headers: {Authorization: '<api-key>'}};
fetch('https://api.fintoc.com/v1/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.fintoc.com/v1/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 => "PATCH",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$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.fintoc.com/v1/payment_links/{id}/cancel"
req, _ := http.NewRequest("PATCH", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.fintoc.com/v1/payment_links/{id}/cancel")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fintoc.com/v1/payment_links/{id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"id": "plink_K2zwNNSxPyx8w3GZ",
"object": "payment_link",
"amount": 5000,
"checkout": {
"description": "Premium subscription"
},
"created_at": "2024-04-04T15:23:11.474Z",
"currency": "CLP",
"customer_email": "customer@example.com",
"expires_at": null,
"max_completed_sessions": null,
"metadata": {
"order_id": "1234"
},
"mode": "live",
"recipient_account": null,
"status": "canceled",
"url": "https://pay.fintoc.com/plink_K2zwNNSxPyx8w3GZ"
}{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "Invalid API Key: invalid-*oken"
}
}{
"error": {
"type": "invalid_request_error",
"code": "forbidden_request",
"message": "payment_link is not active",
"doc_url": "https://docs.fintoc.com/reference/errors"
}
}{
"error": {
"type": "invalid_request_error",
"code": "missing_resource",
"param": "id",
"message": "No such payment_link: plink_K2zwNNSxPyx8w3GZ",
"doc_url": "https://docs.fintoc.com/reference/errors"
}
}Payment links
Cancel a payment link
Cancels an active payment link. A canceled payment link stops accepting payments and cannot be reactivated. Only payment links matching the live or test mode of the API key can be canceled.
PATCH
/
v1
/
payment_links
/
{id}
/
cancel
Cancel a payment link
curl --request PATCH \
--url https://api.fintoc.com/v1/payment_links/{id}/cancel \
--header 'Authorization: <api-key>'import requests
url = "https://api.fintoc.com/v1/payment_links/{id}/cancel"
headers = {"Authorization": "<api-key>"}
response = requests.patch(url, headers=headers)
print(response.text)const options = {method: 'PATCH', headers: {Authorization: '<api-key>'}};
fetch('https://api.fintoc.com/v1/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.fintoc.com/v1/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 => "PATCH",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$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.fintoc.com/v1/payment_links/{id}/cancel"
req, _ := http.NewRequest("PATCH", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.fintoc.com/v1/payment_links/{id}/cancel")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fintoc.com/v1/payment_links/{id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"id": "plink_K2zwNNSxPyx8w3GZ",
"object": "payment_link",
"amount": 5000,
"checkout": {
"description": "Premium subscription"
},
"created_at": "2024-04-04T15:23:11.474Z",
"currency": "CLP",
"customer_email": "customer@example.com",
"expires_at": null,
"max_completed_sessions": null,
"metadata": {
"order_id": "1234"
},
"mode": "live",
"recipient_account": null,
"status": "canceled",
"url": "https://pay.fintoc.com/plink_K2zwNNSxPyx8w3GZ"
}{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "Invalid API Key: invalid-*oken"
}
}{
"error": {
"type": "invalid_request_error",
"code": "forbidden_request",
"message": "payment_link is not active",
"doc_url": "https://docs.fintoc.com/reference/errors"
}
}{
"error": {
"type": "invalid_request_error",
"code": "missing_resource",
"param": "id",
"message": "No such payment_link: plink_K2zwNNSxPyx8w3GZ",
"doc_url": "https://docs.fintoc.com/reference/errors"
}
}Respuesta
The canceled payment link, with status set to canceled.
Status of the payment link. One of active (accepts payments), expired (the expiration date passed), canceled (you canceled the link), or completed (the link reached its maximum number of completed sessions).
Opciones disponibles:
active, expired, canceled, completed Ejemplo:
"active"
¿Esta página le ayudó?