Helcim Logo Support & Tutorials

© Copyright 2006-2019 Helcim Inc.

All Rights Reserved.

Helcim Commerce API » Processing Payments » Card Payments »

Refund (Return) with Card Token

This API call let's you process a refund using a card token. The response is an XML of the processed refund.

Request Fields

Field Name Type Required Description
transactionType String Yes refund
accountId Integer Yes The Helcim Commerce account ID.
apiToken String Yes API token used for authentication and access control. 
amount Decimal Yes The amount of the transaction.
cardToken String Yes The credit card token.
cardF4L4Skip Integer Yes 1 or 0. Must enter 1.
transaction ID Integer No The transaction ID of the original sale.

Response Fields (XML)

Field Name Type Description
message - XML structure
response Integer 1 or 0. Whether the transaction was approved or declined.
responseMessage String Result of transaction (Approved/Denied).
notice String Error/warning message from Helcim. 
transaction - XML structure
transactionId Integer The transaction ID.
type String The transaction type (purchase, refund, pre-auth, capture).
date String The date of the transactions
time String The time of the transaction.
cardHolderName String The card holder's name.
amount Decimal The amount of the transactions.
currency String The currency of the transaction.
cardnumber String The credit card number (first 4 and last 4 digits only).
cardToken String The credit card token.
expiryDate Integer The credit card expiry date.
cardType String The credit card type (Visa, Mastercard, Amex, Discovery).
avsResponse String The address verification response.
cvvResponse String The CVV verification response.
approvalCode String The approval code.
orderNumber String The order number.
customerCode String The customer code.

Errors

For all API requests, there are also generic API authentication and user access restriction errors.
Response Code Error Code Message Description
0 - Invalid Amount The transaction amount was not entered.
0 - Declined - Invalid Card Number Invalid Expiry Date The credit card token was not entered or is invalid.
0 - Card F4L4 Does Not Match Card Token Request field cardF4L4Skip was not populated with integer '1'

Code Samples

Sample Transaction Type Refund with Card Token Response XML

<?xml version="1.0"?>
<message>
    <response>0</response>
    <responseMessage>DECLINED - INVALID CARD NUMBER INVALID EXPIRY DATE </responseMessage>
    <notice></notice>
    <transaction>
        <transactionId></transactionId>
        <type>refund</type>
        <date></date>
        <time></time>
        <cardHolderName></cardHolderName>
        <amount>100.00</amount>
        <currency>CAD</currency>
        <cardNumber></cardNumber>
        <cardToken></cardToken>
        <expiryDate></expiryDate>
        <cardType></cardType>
        <avsResponse></avsResponse>
        <cvvResponse></cvvResponse>
        <approvalCode></approvalCode>
        <orderNumber></orderNumber>
        <customerCode></customerCode>
    </transaction>
</message>

HTML Form Sample HTML

<input type="hidden" name="accountId" value="YOUR-ACCOUNT-ID">
<input type="hidden" name="apiToken" value="YOUR-API-TOKEN">
<input type="hidden" name="transactionType" value="refund">
<input type="hidden" name="amount" value="12.99">
<input type="hidden" name="ccardToken" value="cc203fdb2e0ac09d51419b">
<input type="hidden" name="cardF4L4Skip" value="1">