Knowledgebase

how to process a credit card

How to process a credit card payment

Anchor has provided a simple API for processing credit card payments. All that should be required is copying the example code for your preferred language into the relevant section of your code. The 'Integration guide' is recommended reading if you haven't used a payment gateway before.

Sample PHP code

Anchor has gone to some lengths to simplify the processing of credit card payments. There are two ways to process transactions:
A simple method where you supply credit card details, an amount and a transaction reference and get back a 'yes or no' response as to whether or not the transaction succeeded.
  • An advanced method which takes the same arguments as the simple method but returns more detailed information about the transaction. This is the recommended method as it will allow you to inform your customers about recoverable problems such as a lack of funds in their account.

  • The transaction reference is a string of text that will appear on your bank statement for that payment. In general it is good practice to ensure that it is something that will uniquely identify

    the payment to your accounting system. Invoice numbers make excellent transaction references.

    NOTE. The transaction reference must be less than 16 characters or difficult to find errors will occur.

    To use the simple method, use code like this:

    To use the advanced method, use code like this:

    The advanced method will return an associative array containing the following information about the transaction:
    summaryCode. The response code from the bank's server. This will refer to a value in the Error codes section of this document.
  • summaryText. Human readable version of the summary response.
  • responseCode. A more detailed response code from the bank's server. This will refer to a value in the "Error codes" section of this document.
  • responseText. The response text from the bank's server. This will be a plain-english description of the result of the transaction.
  • orderNumber. Your personal reference number for that transaction
  • authResponse. The receipt number of the transaction from the bank's server.

  • If you are logging payments to a database, we recommend recording the date, the amount, the orderNumber and responseCode values.

    Source: www.anchor.com.au

    Category: Credit

    Similar articles: