Transaction Search Result for Surcharge
CSDK adds two surcharge related attributes to transaction search results: surcharge amount and refunded surcharge amount.
- Surcharge amount: the surcharge amount, a part of the total amount authorized in a transaction.
- Refunded surcharge amount: the amount of surcharge having been refunded back to consumer in a transaction, performed by a related linked refund transaction. The attribute will be available only if a transaction has been partially or fully refunded. If a transaction is fully refunded, this attribute has same value as surcharge amount.
The following codes demonstrate how to retrieve the attributes from different integration platforms.
Code Samples
CWS
Request
// Sending transaction query
{
"method" : "searchPaymentTransaction",
"requestId" : "19183388",
"targetType" : "paymentGatewayConverge",
"version" : "1.0",
"parameters" : {
"first6CC" : null,
"creditCard" : null,
"utcDate" : null,
"paymentGatewayId" : "eb21592b-cd98-44a9-9865-ecba17568ef8",
"transId" : null,
"endDate" : "20200501",
"beginDate" : "20200501",
"note" : ""
}
}
Response
<!--
In this example transaction
The total amount is $10.30 (1030), i.e. purchase amount of $10.00 (1000) and surcharge amount of $0.30 (30) (surcharge of %3.00 at the time of purchase).
A linked refund of $1.03 (103) has been transacted against this transaction (purchase refund of $1.00 and surcharge refund of $0.03 (3)
Two surcharge attributes are added to a search result
totalSurchargeAmount : 30
surchargeAmountRefunded : 3
In addition, attribute amountRefundable is added to indicate the remaining refundable amount for a transaction. To send refund request for this transaction,
i.e. a linked refund request, the amount in the linked refund request MUST not include surcharge so to make a full linked refund request, this attribute can
be used as the amount in the request.
-->
{
"requestId": "19183388",
"statusDetails": "REQUEST_ACCEPTED",
"data": {
"paymentGatewayCommand": {
"completed": true,
"eventQueue": [],
"transactionSearchResults": {
"transactions": [
{
"id": "010520E3B-13A761DE-B634-400E-B9D6-7B57E775969F",
"transactionType": "SALE",
"tenderType": "CARD",
"cardScheme": "VISA",
"cardType": "CREDIT",
"date": "2020/05/01 13:02:54",
"amount": {
"value": 1030,
"currencyCode": "USD"
},
"amountRefundable": {
"value": 900,
"currencyCode": "USD"
},
"amountRefunded": {
"value": 103,
"currencyCode": "USD"
},
"totalSurchargeAmount": {
"value": 30,
"currencyCode": "USD"
},
"surchargeAmountRefunded": {
"value": 3,
"currencyCode": "USD"
},
"authCode": "401923",
"maskedPan": "47**********0119",
"currencyCode": null,
"note": null,
"tax": null,
"expDate": "1222",
"firstName": null,
"lastName": null,
"voidable": "Y",
"refundable": "N",
"result": "APPROVED",
"cardEntryType": "EMV_CONTACT",
"iccAppName": "VISA CREDIT",
"iccAid": "A0000000031010",
"iccTvr": "0000000000",
"iccTsi": null,
"iccCvmr": "FAILED",
"state": "UNCOMMITTED",
"signatureBitmap": null,
"gratuityAmount": null,
"invoiceNumber": null,
"avsresponse": null
}
}
}
}
}
}
Java
// Suppose transaction query is performed and a list of transaction query results is returned to the callback method
ECLTransactionSearchListener idSearchListener = new ECLTransactionSearchListener()
{
@Override
public void transactionSearchDidSucceed(ECLTransactionSearchCriteriaInterface criteria, List<ECLTransactionSearchResult> eclTransactionSearchResults)
{
for (ECLTransactionSearchResult result : eclTransactionSearchResults)
{
StringBuilder sb = new StringBuilder();
// Surcharge amount in a transaction
if (result.getTotalSurchargeAmount() != null)
{
sb.append("\nSurcharge Amount: ");
sb.append(result.getTotalSurchargeAmount().getAmount());
}
// Refunded surcharge amount in a transaction
if (result.getRefundedSurchargeAmount() != null)
{
sb.append("\nRefunded Surcharge Amount: ");
sb.append(result.getRefundedSurchargeAmount().getAmount());
}
// The remaining available amount for a full refund
if (data.getAmountRefundable() != null)
{
sb.append("\nAmount Available for Refund: ");
sb.append(data.getAmountRefundable().getAmount());
}
}
}
}
Objective-C (iOS)
// Suppose transaction query is performed and a list of transaction query results is returned to the callback method
+ (void)transactionSearchDidSucceed:(id<ECLTransactionSearchCriteriaProtocol>)criteria results:(ECLTransactionSearchResults *)results {
NSUInteger count = [results count];
for (NSUInteger i=0; i<count; i++) {
ECLTransactionSearchResult *result = [results objectAtIndexedSubscript:i];
// Surcharge amount in a transaction
ECLMoney *creditSurcharge = result.creditSurcharge;
// Refunded surcharge amount in a transaction
ECLMoney *refundedCreditSurcharge = result.refundedCreditSurcharge;
// The remaining available amount for a full refund
ECLMoney *amountRefundable = result.amountRefundable;
}
}
C#
// Three properties are added to CWS.Transaction class
// <summary>
// Total surcharge amount of the transaction - only applicable to a SALE transaction.
// </summary>
// public Money totalSurchargeAmount { get; set; }
// <summary>
// Refunded surcharge amount of the transaction - only applicable to a SALE transaction.
// </summary>
// public Money surchargeAmountRefunded { get; set; }
// <summary>
// Remaining refundable amount of the transaction - only applicable to a SALE transaction.
// This amount excludes surcharge. This amount should be used as the amount for a full linked refund transaction.
// </summary>
public Money amountRefundable { get; set; }
// Suppose transaction search is performed and a Transaction object transaction is returned
Money surchargeAmount = transaction.totalSurchargeAmount;
Money surchargeAmountRefunded = transaction.surchargeAmountRefunded;
Money amountRefundable = transaction.amountRefundable;