From 47493524f4cbad63df179f05c028bf9c0cdcce75 Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Mon, 9 Mar 2026 11:28:07 +0530 Subject: [PATCH] added cancel token --- documents/token.md | 23 +++++++++++++++++++++++ src/Token.php | 7 +++++++ 2 files changed, 30 insertions(+) diff --git a/documents/token.md b/documents/token.md index 35f62f13..bafbc986 100644 --- a/documents/token.md +++ b/documents/token.md @@ -384,6 +384,29 @@ $api->token->processPaymentOnAlternatePAorPG(array("id"=>"spt_4lsdksD31GaZ09")); } ``` ------------------------------------------------------------------------------------------------------- + +### Cancel token +```php +$api->token->cancel($customerId, $tokenId); +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|--------------------------------------| +| customerId* | string | The id of the customer to be fetched | +| tokenId* | string | The id of the token to be fetched | + + +**Response:** +```json +{ + "status": "cancellation_initiated” +} +``` + +------------------------------------------------------------------------------------------------------- + **PN: * indicates mandatory fields**

diff --git a/src/Token.php b/src/Token.php index 8f55874c..8f4ae8ae 100644 --- a/src/Token.php +++ b/src/Token.php @@ -56,4 +56,11 @@ public function processPaymentOnAlternatePAorPG($attributes = array()) return $this->request('POST', $relativeUrl, $attributes); } + + public function cancel($customer_id, $token_id) + { + $relativeUrl = 'customers/'.$customer_id.'/'.$this->getEntityUrl().$token_id.'/cancel'; + + return $this->request('PUT', $relativeUrl); + } }