|
|
Connecting to NetRegistry's External Gateway for eCommerce transactionsDescription from: http://www.chilisoft.com/caspdoc/ Using NetRegistry's e-payment gateway with ASP.IMPORTANT: The following information is only relevant to clients hosted on our Chilisoft ASP servers. E-commerce on the ASP server is enabled by including ecom.asp in your ASP script. ecom.asp will be located in the /secure directory off your website base - if it is not, please contact NetRegistry Technical Support. The /secure directory is linked to our https server so you can collect sensitive information securely. Any documents and subdirectories under /secure will be available under the following URL : https://secure.netregistry.net/your_domain.com.au/ For example, if your domain was www.shopping.com and your script to collect and process credit cards was called "checkout.asp", you would place "checkout.asp" in www.shopping.com/secure/ and redirect clients to the following URL : https://secure.netregistry.net/shopping.com/checkout.asp ecom.asp provides the following API : ecom_process (MERCHID,PASSWORD,AMOUNT,CCNUM,CCEXP,COMMENT) returns : 1 on success, 0 on failure (Please note : this return code does NOT indicate if the card was successfully processed - it provides very basic sanity checking of the input data, and success here only indicates the request was passed on to the payment gateway.) All arguments to ecom_process are strings, and all fields must be supplied and non-empty. MERCHID = Your merchant ID as provided by NetRegistry. Should
be a 2 or 3 digit number. PASSWORD = Your external access password. AMOUNT = The amount you wish to charge, including the cents.
CCNUM = The credit card number, without spaces or separators. CCEXP = credit card expiry date, in the form mm/yy. COMMENT = A comment for the transaction, for later tracking.
If ecom_process returns 0, the reason for the rejection will be in the ecom_problem variable. (see example script below). You must check if ecom_process succeeds before calling any of the functions below, or your script may return an error. Upon successful completion of the ecom_process call, the following functions can be used. ecom_status returns string ("approved","declined" or "failed") This function returns the status of the transaction. ecom_status should be the first result checked. If the transaction was "failed", other functions may return undefined results. ecom_txnref returns string This function returns the bank transaction reference. This number should be recorded for reference. May be empty if the ecom_status is "failed" or "declined". ecom_settlement_date returns string This function returns the date on which the transaction took place, in Sydney Australia, Eastern Standard Time (EST). ecom_response_text returns string This function returns the text response from the bank. If the transaction was "declined", this function will provide more details. (e.g. "Invalid card", "Insufficient funds".) Some banks will return "SIGNATURE REQUIRED" in this field for a successful transaction - this is NOT an error - the transaction has gone through successfully. ecom_card_desc returns string This function returns the type of card that was processed. (eg "visa", "mastercard"). May be undefined if ecom_status was "declined" or "failed". ecom_dump returns string This function returns the full response from the bank. This should only be used for debugging purposes, as the results are not formatted or parsed, and field order may change. **The following functions are for Quest (National Australia Bank) customers only. ecom_amount returns string This function returns the amount that was processed. The value is in cents (eg $125.23 = "12523"). ecom_card_number ecom_card_expiry returns string These functions return the card number and expiry date respectively. ecom_rrn returns string Returns the banks rrn number for the transaction. Sample ScriptsThe following sample scripts are provided as an example of how to use ecom.asp. It assumes that your form has collected and checked the required information. Please note that it is vitally important to do safety and sanity checking of any input to your script. There are two examples, for VBScript and JavaScript ASP. If your ASP script is not located in the /secure directory, you will need to adjust the #include line appropriately. Example 1: VBScript <!-- #include file="ecom.asp" --> 'To store the result from ecom_process MERCHID = "44" 'The following are hard-coded for example only. 'Process the transaction 'Check the result from the process call.
Response.write "The following error occurred, (credit card was not processed) <BR><BR>" Response.write ecom_problem else
if ecom_status = "approved" then
Response.write "The transaction was approved.<BR>" Response.write ecom_txnref
Response.write ecom_card_desc elseif ecom_status = "declined" then
Response.write "The transaction was declined.<BR>" elseif ecom_status = "failed" then
Response.write "The transaction failed. This may be due to network " end if end if %> Example 2: JavaScript <%@ Language=JavaScript%> MERCHID = "44"; //The following fields are hard-coded for example only. //Process the transaction //Check the result from the process call.
Response.write("The following error occurred, (credit card was not processed) <BR><BR>"); Response.write(ecom_problem); } else {
//Process call succeeded. } } Related topics |