Cancel Payment
Request URL
POST /payment-link/payment/cancel
Description
This endpoint will allow you (the client/platform) to cancel the specified payment link. Payment links may only be cancelled if the current status is "Initiated", "Sent", or "Processing". Cancellation is not allowed once the payment has been sent to the bank (for ACH payments) or card processor (for card payments).
Schema
Property table for payment-link/payment/cancel
Property | Description | Required | Schema |
---|---|---|---|
cFiTransactionId | The transaction ID in the connectFi system | Yes | { "type": "string", "pattern": "^[0-9a-zA-Z_]+$", "minLength": 1, "maxLength": 36, "$id": "common-id" } |
Request Body
Snippet Examples
javascript
const axios = require('axios');
const data = {
"cFiTransactionId": "yJ6pRvSIsp26qbbLgMVX3"
};
const config = {
method: 'POST',
url: '${CONNECTFI_BASE_URL}/payment-link/payment/cancel',
headers: {
'Content-Type': "application/json",
'x-connectfi-token': "A long random string token received from /auth/get-token request"
},
data
};
let result;
try {
result = await axios.request(config);
if (result.status === 200) {
console.log(JSON.stringify(result.data));
}
} catch (err) {
console.log({
errCode: err.code,
responseStatus: err.response && err.response.status,
data: err.response && JSON.stringify(err.response.data)
});
}
cURL
curl --location "CONNECTFI_BASE_URL/payment-link/payment/cancel" --data "{ \"cFiTransactionId\":\"yJ6pRvSIsp26qbbLgMVX3\"}" --header "Content-Type: application/json" --header "x-connectfi-token: A long random string token received from /auth/get-token request"
Successful Response Examples
200 SUCCESSFUL RESPONSE
HEADERS
Header | Value |
---|---|
Content-Type | application/json |
x-connectfi-token | A long random string token received from /auth/get-token request |
REQUEST BODY
RESPONSE BODY
{
"code": "0",
"data": {
"cFiTransactionId": "yJ6pRvSIsp26qbbLgMVX3",
"cFiAggregatorId": "CLIENTID",
"cFiMerchantId": "2Bc0QW0VYJe7VhTyXXEYNQ",
"payerName": "Doe John",
"invoiceNumber": "11125",
"amount": 1.5,
"currency": "USD",
"dueDate": "2024-08-29",
"description": "test description",
"status": "Cancelled",
"fields": [
{
"index": 1,
"code": "firstName",
"label": "First Name",
"value": "John"
},
{
"index": 2,
"code": "lastName",
"label": "Last Name",
"value": "Doe"
},
{
"index": 3,
"code": "email",
"label": "Email",
"value": "customer_email@email.test"
},
{
"index": 4,
"code": "phone",
"label": "Phone",
"value": "15555555555"
}
],
"availablePaymentType": [
"card",
"ach"
],
"statusChangeHistory": [
{
"initiatorId": "2Bc0QW0VYJe7VhTyXXEYNQ",
"initiatorType": "merchant",
"status": "Initiated",
"dtsCreatedAt": "2024-07-31T10:45:58.778Z",
"dtsUpdatedAt": "2024-07-31T10:45:58.778Z"
},
{
"login": "CLIENTID",
"initiatorId": "1HTczC2VSZcJ3BB5pKr09Y",
"initiatorType": "user",
"status": "Cancelled",
"dtsCreatedAt": "2024-08-01T17:29:47.767Z",
"dtsUpdatedAt": "2024-08-01T17:29:47.767Z"
}
],
"dtsCreatedAt": "2024-07-31T10:45:58.779Z",
"dtsUpdatedAt": "2024-08-01T17:29:47.767Z",
"cFiMerchantRef": "1"
},
"requestId": "a668da40502b11efacdc860d03bdc411"
}