Language

Query Parameters

ParameterRequiredTypeDescription
IDYesStringThe reference / ID of the Payment Link to cancel

The request above results to the following JSON payload when a Payment Link Result exists

POST https://sandbox.kopokopo.com/api/v2/payment_links/:id/cancel
Content-Type: application/json
Accept: application/json
Authorization: Bearer < AccessToken >


{
  "message": "Payment link cancelled."
}
#  Using K2Connect - https://github.com/kopokopo/k2-connect-ruby (Recommended)
location_url = "https://sandbox.kopokopo.com/api/v2/payment_links/f387e4d7-6a32-4f2d-ba1e-809eab2d9614"
k2_payment_links = K2ConnectRuby::K2Entity::PaymentLink.new("your_access_token")

# Cancel payment link
k2_payment_links.cancel_payment_link(location_url)
const PaymentLinkService = K2.PaymentLinkService

const paymentLinkCancelOptions = {
  location: 'https://sandbox.kopokopo.com/api/v2/payment_links/cc438b3e-ecf0-4600-b9cc-edba32ae7019',
  accessToken: 'myRand0mAcc3ssT0k3n'
}

PaymentLinkService.cancelPaymentLink(paymentLinkCancelOptions)
import k2connect

k2connect.initialize(CLIENT_ID, CLIENT_SECRET, BASE_URL)
payment_links_service = k2connect.PaymentLinks(access_token=access_token)

request_payload = {
    "payment_link_reference": "5a5e8e7b-9520-4dfb-81cb-a5c67f48cc86",
}
payment_link_resource_location_url = payment_links_service.cancel_payment_link(request_payload)
$paymentLinkService = $K2->paymentLinkService();

$cancellationOptions = [
  "location" => "https://sandbox.kopokopo.com/api/v2/payment_links/15513d7f-62c0-4e8d-91da-e5df670acfa6",
  "accessToken" => "myRand0mAcc3ssT0k3n",
];

$response = $paymentLinkService->cancelPaymentLink($cancellationOptions);
print_r($response); // Array([status] => success, [message] => Payment link cancelled.)
// Not Supported
// This feature is not currently available in the Flutter SDK.
// Please use one of the other SDKs (PHP, Ruby, Python, NodeJs) or the REST API.