Update Payment Link - Flex Documentation
Update Payment Link
cURL
curl --request PATCH \
--url https://api.withflex.com/v1/payment_links/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"payment_link": {
"label": "Example",
"after_completion": {},
"active": false
}
}
'
Python
import requests
url = "https://api.withflex.com/v1/payment_links/{id}"
payload = { "payment_link": {
"label": "Example",
"after_completion": {},
"active": False
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)
JavaScript (Fetch)
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({payment_link: {label: 'Example', after_completion: {}, active: false}})
};
fetch('https://api.withflex.com/v1/payment_links/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, [\
CURLOPT_URL => "https://api.withflex.com/v1/payment_links/{id}",\
CURLOPT_RETURNTRANSFER => true,\
CURLOPT_ENCODING => "",\
CURLOPT_MAXREDIRS => 10,\
CURLOPT_TIMEOUT => 30,\
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\
CURLOPT_CUSTOMREQUEST => "PATCH",\
CURLOPT_POSTFIELDS => json_encode([\
'payment_link' => [\
'label' => 'Example',\
'after_completion' => [\
\
],\
'active' => false\
]\
]),\
CURLOPT_HTTPHEADER => [\
"Authorization: Bearer <token>",\
"Content-Type: application/json"\
],\
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>
Go
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.withflex.com/v1/payment_links/{id}"
payload := strings.NewReader("{\n \"payment_link\": {\n \"label\": \"Example\",\n \"after_completion\": {},\n \"active\": false\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
200 Response Example
{
"payment_link": {
"payment_link_id": "fplink_01J9XR8M3K7VZ8N2YB4WJ6T0RA",
"label": "Example",
"active": false,
"allow_promotion_codes": false,
"shipping_address_collection": false,
"shipping_options": {},
"metadata": {
"order_id": "8842",
"channel": "shopify"
},
"url": "https://example.com",
"created_at": "2026-06-15T14:30:00Z",
"payment_intent_data": {},
"after_completion": {},
"origin": "shopify",
"tax_rate": {},
"setup_future_use": "on_session",
"test_mode": false
}
}
Error Response Example
{
"code": "string",
"detail": "string"
}
Path Parameters
- id: (string) required - Example:
"fplink_01J9XR8M3K7VZ8N2YB4WJ6T0RA"
Body
- payment_link (object) required - The payment link. Example:
{
"label": "Example",
"after_completion": { "type": "redirect" },
"active": false
}
Response Structure
- payment_link (object) required - The payment link with the following attributes:
{
"payment_link_id": "string",
"label": "string",
"active": boolean,
"allow_promotion_codes": boolean,
"shipping_address_collection": boolean,
"shipping_options": {},
"metadata": {
"order_id": "string",
"channel": "string"
},
"url": "string",
"created_at": "string",
"payment_intent_data": {},
"after_completion": {},
"origin": "string",
"tax_rate": {},
"setup_future_use": "string",
"test_mode": boolean
}