Helcim Logo Support & Tutorials

© Copyright 2006-2018 Helcim Inc.

All Rights Reserved.

Helcim Commerce API » Customers »

Add a Credit Card

This API call let's you add a new credit card to a specific customer. The response is an XML of the available new credit card information.

Request Fields


Field Name Type Required Description
action String Yes customerCardEdit
accountId Integer Yes The Helcim Commerce account ID.
apiToken String Yes API token used for authentication and access control. 
customerCode String Yes The customer code.
cardHolderName String Yes The card holder's name.
cardNumber Integer Yes The credit card number.
cardExpiry String Yes The credit card expiry date.
cardCVV Integer No The card verification value.
cardToken String No If entered, user is editing an existing card
default Integer No 1 or 0. Whether the card is set as default or not.
cardHolderAddress String No The card holder's address.
cardHolderPostalCode String No The card holder's postal code.
terminalId Integer No The terminal ID.
verify Integer No 1 or 0. Whether the card will be verified or not.

Response Fields (XML)


Field Name Type Description
message - XML structure
response Integer 1 or 0. Whether the new credit card was added or not.
responseMessage String Response message confirming actions taken.
customer - XML structure
customerCode String the customer code.
businessName String The business name.
contactName String The contact name.
card - XML structure
cardNumber Integer The credit card number (first four and last four digits only).
cardToken String The credit card token.
cardF4L4 Integer The first four and last four credit card digits.
dateLastUsed String The date the credit card was last used.

Errors


For all API requests, there are also generic API authentication and user access restriction errors.

Response Code Error Code Message Description
0 - Invalid Customer Code The customer code you provided cannot be found.
0 - Invalid credit card number (Lunh Check) The credit card number you provided is invalid, or not entered.
0 - Invalid Field - Cardholder Name The card holder's name is invalid, or not entered.
0 - Card has expired The credit card has expired, or the credit card expiry date was not entered.

Code Samples

Sample Add a Credit Card Response XML

<?xml version="1.0"?>
<message>
    <response>1</response>
    <responseMessage>Card Verified and Save - APPROVAL CODE: T6E4ST</responseMessage>
    <customer>
        <customerCode>12A1141</customerCode>
        <businessName>Aaron Hamilton</businessName>
        <contactName>Aaron Hamilton</contactName>
        <card>
            <cardNumber>5454********5454</cardNumber>
            <cardToken>133bc061146d63284a7426</cardToken>
            <cardF4L4>54545454</cardF4L4>
            <dateLastUsed>2017-06-13 14:46:45</dateLastUsed>
        </card>
    </customer>
</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="action" value="customerCardEdit">
<input type="hidden" name="customerCode" value="12A1167">
<input type="hidden" name="cardHolderName" value="John Smith">
<input type="hidden" name="cardNumber" value="5454545454545454">
<input type="hidden" name="cardExpiry" value="0219">
<input type="hidden" name="cardCVV" value="100">
<input type="hidden" name="cardHolderAddress" value="123 Home Street">
<input type="hidden" name="cardHolderPostalCode" value="T2H1K7">
<input type="hidden" name="terminalId" value="13">
<input type="hidden" name="verify" value="1">