Void
This API will invalidate a payment authorization and will cancel the payment.
Usually, the Auth & Capture mode of payment is used whenever the customer is booking a product or service from the merchant. First merchant authorizes the payment amount from the customer and depending on the result of service or product delivery, the authorized payment is either captured or cancelled. The cancellation of the authorized payment can be performed through this void API.
Request URL: {base_URL}/tokenized/checkout/payment/confirm/capture/void
**base_URL will be shared during onboarding.
Request Headers
| Header Name | Value |
|---|---|
| Accept | "application/json" |
| Authorization | id_token value found from the Grant Token and Refresh Token API. |
| X-App-Key | Application Key value shared by bKash during on-boarding. |
Request Parameters
| Property | Presence | Type | Description |
|---|---|---|---|
| paymentID | Mandatory | String | PaymentID returned in the response of Create Payment API. |
Success Response Parameters
| Property | Type | Description |
|---|---|---|
| paymentID | String | bKash generated payment ID for this payment creation request. This payment ID can be used later to track down the payment and in other payment related APIs. |
| createTime | String | The payment creation time. Format is** **- "yyyy-MM-dd'T'HH:mm:ss 'GMT'Z". |
| updateTime | String | The payment update time. Format is** **- "yyyy-MM-dd'T'HH:mm:ss 'GMT'Z". |
| trxID | String | A transaction ID created after the successful completion of this payment request. This ID can be used later to get the details of this transaction. |
| transactionStatus | String | Final status of the transaction. For a successful payment, this status should be "Completed". |
Error Response Parameters
| Property | Type | Description |
|---|---|---|
| errorCode | String | Unique code assigned to the occurred error. |
| errorMessage | String | Message associated with the error, explaining the error reason. |
Sample Request
POST /tokenized/checkout/payment/confirm/capture/void HTTP/1.1
Host: {{base_URL}}
Accept: application/json
authorization: id_token
x-app-key: x-app-key$paymentID=$_GET['paymentID'];
$url=curl_init('$baseURL/checkout/payment/void/'.$paymentID);
$header=array(
'Content-Type:application/json',
'authorization:'.$_SESSION['token'],
'x-app-key:shared_appKey');
curl_setopt($url,CURLOPT_HTTPHEADER, $header);
curl_setopt($url,CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($url,CURLOPT_RETURNTRANSFER, true);
curl_setopt($url,CURLOPT_FOLLOWLOCATION, 1);
$resultdatax=curl_exec($url);
curl_close($url);
echo $resultdatax;$.ajax({
url: '$baseURL/checkout/payment/void/'+"?paymentID="+paymentID,
type: 'POST',
contentType: 'application/json',
beforeSend: function(request) {
request.setRequestHeader("authorization", id_token);
request.setRequestHeader("X-APP-Key", "shared_appKey");
},
data: JSON.stringify({
"paymentID": paymentID
}),
success: function (data) {
console.log('data ::=>');
console.log(JSON.stringify(data));
data = JSON.parse(data);
if (data && data.paymentID != null) {
document.write(JSON.stringify(data));
} else {
document.write("error with request");
}
},
});Sample Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"paymentId": "UO0CX661558594922927",
"createTime": "2019-05-23T07:03:02:972 GMT+0000",
"updateTime": "2019-05-23T07:03:03:089 GMT+0000",
"trxID ": "6ZN1019BV9",
"transactionStatus": "Completed"
}Updated about 1 year ago
