Common Lisp Package: CL-CREDITCARD

Library for charging credit cards.

README:

FUNCTION

Private

READ-KEYWORD-FROM-STRING (STR)

Safely read a string into the keyword package.

REPLACE-ALL (STRING PART REPLACEMENT &KEY (TEST #'CHAR=))

Returns a new string in which all the occurences of the part is replaced with replacement. [FROM http://cl-cookbook.sourceforge.net/strings.html#manip]

GENERIC-FUNCTION

Public

AUTHORIZE (PROCESSOR CC-DATA AMOUNT &KEY &ALLOW-OTHER-KEYS)

Do a pre-authorization without capture returning a transaction identifier that can later be used with preauth-capture.

ENOUGH-DATA-P (CC-DATA &KEY REQUIRE-AVS REQUIRE-CCV ERROR-P)

Check that a cc-data like structure has enough data to complete a transaction. Can optionally require that AVS verification, Card Verfication data be present. Can optionally signal an error if data isn't present. Some merchant accounts will incur extra fees if AVS isn't used.

LUHN-CHECK-P (CARD-NUMBER)

Check the credit-card number is valid looking based on the luhn algorithm: http://en.wikipedia.org/wiki/Luhn_algorithm

PREAUTH-CAPTURE (PROCESSOR TRANSACTION-ID &KEY AMOUNT &ALLOW-OTHER-KEYS)

Capture a charge that was previously authorized with authorize. Some processors allow capturing a different amount than was originally authorized.

SALE (PROCESSOR CC-DATA AMOUNT &KEY &ALLOW-OTHER-KEYS)

Do a one time charge on a credit card for an amount using the given processor. Other provided keys are up to the processor to interpret or ignore. Returns the transaction's unique identifier if successful.

VOID (PROCESSOR TRANSACTION-ID &KEY &ALLOW-OTHER-KEYS)

Void a previous transaction.

Private

CREDIT (PROCESSOR CC-DATA &KEY TRANSACTION-ID AMOUNT &ALLOW-OTHER-KEYS)

Credit a charge, if transaction-id is present this is a credit against a precviouly charged authorization

Undocumented

USER-MESSAGE (CONDITION)

SETFUSER-MESSAGE (NEW-VALUE CONDITION)

VERBIAGE (CONDITION)

SETFVERBIAGE (NEW-VALUE CONDITION)

SLOT-ACCESSOR

Public

ACCOUNT (OBJECT)

The card number.

SETFACCOUNT (NEW-VALUE OBJECT)

The card number.

ADDRESS (OBJECT)

Street address for AVS. Typically only numbers need to be passed in this fields. Letters and other characters are ignored.

SETFADDRESS (NEW-VALUE OBJECT)

Street address for AVS. Typically only numbers need to be passed in this fields. Letters and other characters are ignored.

CCV (OBJECT)

Card [Code] Verification value. Usually 3-4 digits on back of card.

SETFCCV (NEW-VALUE OBJECT)

Card [Code] Verification value. Usually 3-4 digits on back of card.

EXPDATE (OBJECT)

The card expiration date

SETFEXPDATE (NEW-VALUE OBJECT)

The card expiration date

ZIP (OBJECT)

Zipcode for AVS verfication.

SETFZIP (NEW-VALUE OBJECT)

Zipcode for AVS verfication.

CLASS

Public

CC-DATA

Class to hold data that normally goes with a credit card charge. We interact with this class only through the accessors and never actually check the type, so you can feed it any data structure that responds to these set of accessors.

CONDITION

Public

DENY-EXCEPTION

Error signalled when the CC is denied and error signalling is requested.

Private

CC-ERROR

Requested errors when processing the credit will inherit from here. user-message, when supplied, should be a safe string to display to clients informing them of the error.