programmers guide 3.8 final

34
Bardo Programmers’ Guide Page 1 ProgrammersGuide Release 3.8 19-11-2014 Last correction: 11 th December 2014

Upload: sp

Post on 05-Jan-2016

45 views

Category:

Documents


2 download

DESCRIPTION

Programers Guide for Deployment of Bardo Payment Solution

TRANSCRIPT

Page 1: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 1

Programmers’ Guide

Release 3.8

19-11-2014 Last correction: 11

th December 2014

Page 2: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 2

Table of Contents

1 Bardo Contact Information ___________________________________________________ 3 2 Process Overview __________________________________________________________ 3

2.1 Goal and context _______________________________________________________ 3

2.2 Versions and releases __________________________________________________ 4

2.3 Process explanation ____________________________________________________ 4

2.4 Pattern and Process explanation ___________________________________________ 5

2.5 Files which need to be implemented by the merchant ___________________________ 6

2.6 Connection Set up ______________________________________________________ 6 3 Data Format ______________________________________________________________ 8

3.1 Communication protocol _________________________________________________ 8

3.2 REQUEST : Data sent to Bardo by the Merchant _______________________________ 9

3.3 RESPONSE: Return sent by Bardo on the URL_RETURN _______________________ 10

3.4 RESPONSE (DISPLAY): Return sent by Bardo on the URL_DISPLAY ______________ 12 4 Tricks for yours tests _____________________________________________________ 13 5 Integration Examples – ASP Technology _____________________________________ 14

5.1 The file Form.asp (Form.asp is the user page) _______________________________ 14

5.2 The file Merchant.asp : (Merchant.asp is used to send data to Bardo‟s servers) ______ 14

5.3 The file return.asp – The results are sent by Bardo on this URL and are written in the database ____________________________________________________________________________ 16

5.4 The file display_result.asp (Display_result.asp query the database to know if the result is arrived) ____________________________________________________________________________ 16

6 Integration Examples – PHP Technology _____________________________________ 19

6.1 The file Form.php (Form.php is the user page) ______________________________ 19

6.2 The file Merchant.php : (Merchant.php is used to send data to Bardo‟s servers) ______ 19

6.3 The file return.php – The results are sent by Bardo on this URL and are written in the database. ____________________________________________________________________________ 20

6.4 The file display_result.php (Display_result.php query the database to know if the result is arrived) ____________________________________________________________________________ 21

8 Contact Bardo Technical Service ____________________________________________ 24 Annex ________________________________________________________________________ 25

Page 3: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 3

1 Bardo Contact Information

Website Visit the Bardo Web site www.bardo.com for information about the products and services of Bardo. Technical services Technical contact team Email: [email protected] Bardo back office The on-line management information tool of Bardo, the Bardo back office, can be accessed at https://backoffice.bardo-gateway.com To access this application, a username and password, is provided during the implementation process.

2 Process Overview

2.1 Goal and context Goal: This document describes the Bardo Merchant Programmers Integration Guide. It explains how to make the connection needed to exchange data between a merchant‟s web site and the Bardo payment server, aiming to make this process transparent and easy to understand for web developers, programmers, merchants and other parties. Bardo resellers and merchants will be informed prior to any updates of this document by email. Comments:

Comments on or suggestions to this document are welcome and can be sent to: [email protected]

Document structure: In chapter 2 and 3 of this document the process flow is given with the expected formatted data. Chapter 4 and 5 give source code example to implement easily Bardo solution. Chapter 6 reminds important tricks not to forget to finish the implementation. In the Annex helpful information is given e.g. about countries, states, languages and currencies codes.

Page 4: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 4

Disclaimer: Bardo gives extensive attention to the content of this document but makes no warranties or representations about the accuracy or completeness of it. Neither Bardo nor any of its affiliates shall be liable for any direct, incidental, consequential, indirect or punitive damages arising out of access to or use of any content of this document. Because of the complexity of the process of direct debit and the right of banking institutions to alter conditions, this document can only serve as a description and is subject to modifications.

2.2 Versions and releases

Version Changes

3.2 o New parameter : URL_RETURN allow a merchant to process with

several sites (www.mysite1.com, www.mysite2.com) o New sample code in PHP language.

3.3 o New process URL (https://payment.bardo- secured.com/bardo/process.aspx)

3.8 o Replacement of both gateway/processing and backoffice URLs.

2.3 Process explanation

This chapter provides a brief description of the process flows between the consumer, the merchant site and Bardo.

The end user submits payment information to the merchant site. This information is submitted to Bardo, and then bank server processes the payment and returns the payment status back to the merchant. If the payment is accepted, Bardo sends an email to the customer to inform him about the payment and the descriptor on his bank statement.

Page 5: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 5

2.4 Pattern and Process explanation

https://gate.bardo-gateway.com/bardo/process.aspx

Page 6: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 6

Steps Comments

The end-user submits the forms on the merchant site.

The Merchant sends the data to Bardo after verifying data‟s integrity.

Bardo gateway checks Card Number, transactions parameters with the AntiFraud system, and sends the payment to Banks.

Bardo gives the response to the Merchant on the URL_RETURN (posted data). This page isn‟t displayed, but only updates the merchant data.

The file URL_RETURN of the Merchant updates the Merchant database.

Bardo called the URL_DISPLAY (posted data) which displays the result of the process.

The File return.asp queries the database (updated by URL_RETURN step 4) to know the result of the transaction.

The merchant displays the result to the end user through the display_result.asp file.

2.5 Files which need to be implemented by the merchant

a) The file “merchant.asp” collects the payment information and sends the information to Bardo.

b) The page “return.asp” updates the response received from Bardo into the Merchant database but this page is not displayed.

c) The file “display_result.asp” queries the Merchant database to know if the result has been sent by Bardo. If the result is in the database, the result is displayed to the user. Examples of these files with ASP and SQLServer are given in the Chapter 4.

2.6 Connection Set up

This chapter provides a practical overview of the technical steps needed to set up all the necessary interfaces. Step 0: pre-conditions Please make sure that all relevant information has been exchanged with Bardo before you start setting up the connection between the Merchant System and Bardo gateway. You have to: to fill out the application form. to fill out the technical form supplied with this Integration guide.

Order id (SHOP_NUMBER): Each order should have a unique OrderID and several mandatory key variables which can be found in chapter 3. The OrderID can be an order number that is incremented by 1 for every order you process in your shop. This OrderID will be used to communicate with the payment server of Bardo.

Page 7: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 7

Step 1: Store your order For later purposes and reference you need to store the order in your system. You could store it in a database or in a file. Storing the order is required for your order fulfillment. Step 2: Security Checks A security key will be shared with a merchant as soon as the account is created and activated. This

key will always be part of the order string sent to Bardo for processing.

When the order is sent to the Payment Server, the key supplied as part of the order string is matched against the key value stored on the server for the merchant. The IP address or IP address range from where the connection was made is also checked based on the type of merchant as categorized by Bardo. If it matches with the IP address supplied by the Merchant at a previous stage, the order information will be verified. In case of missing or incorrect information, the Payment Server will respond with an appropriate error message, indicating what is wrong with the order information. Please note that you should not change the IP address mentioned above without contacting Bardo first. Failing to do so will mean we cannot store your order! Step 3: Sending requests A request should be HTML POST-ed with the order or payment details to the Bardo Payment Server. The string will be made of different parameters detailed on chapter 3. The URL to use to send payments is: https://gate.bardo-gateway.com/bardo/process.aspx "We strongly advise you to NOT use a direct IP-address but use the DNS name instead. This, to avoid connectivity problems if the server IP addresses changes." A request should always be POSTed for security reasons, as opposed to using a HTML GET. Step 4: Processing https messages When the Bardo system processes a payment posting by the Merchant, it communicates the result back to the Merchant using posted parameters on a URL given by the merchant (URL_RETURN which have to update de merchant‟s database). Then it posts another data on a second URL (URL_DISPLAY which have to get and display the data stored on the database).

Page 8: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 8

3 Data Format

3.1 Communication protocol

SSL

SSL transactions are the current standard. Until such time as SET is fully implemented all transactions must be sent to https://gate.bardo-gateway/bardo/process.aspx utilizing SSL protocols.

Protocol

HTTPS

Ports

443 Thawte SSL Certificate

Production Mode

Request :

Method

POST

Content-Type application/x-www-form-urlencoded

URL https://gate.bardo-gateway.com/bardo/process.aspx

Response :

Method

GET

Content-Type text/html

URL Encoded Response Data Format

Query string” data submitted on the MERCHANT URL

Encryption Level RSA SSL Version 3.0

Page 9: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 9

3.2 REQUEST : Data sent to Bardo by the Merchant You must send data to BARDO servers with Post Method to URL:

https://gate.bardo-gateway.com/bardo/process.aspx

Position and name of data that merchant must send to BARDO, all fields are compulsories: Parameters Definition Type Example SHOP_ID Identification code of shop given by AN 8 BARDOSHP

BARDO.

SHOP_NUMBER Shop transaction number. UAN 40225 Important: this transaction number must 20

be unique for each transaction! Even if the

transaction is not valid.

CUSTOMER_LAST_NAME Customer‟s last name. AN 50 Smith CUSTOMER_FIRST_NAME Customer‟s first name AN 50 Jon CUSTOMER_EMAIL Customer‟s email AN 50 [email protected] CUSTOMER_ADDRESS Customer‟s address AN 19 testing road

150

CUSTOMER_CITY Customer‟s city AN 50 London CUSTOMER_ZIP_CODE Customer‟s zip code AN 10 SM13ND CUSTOMER_STATE Customer‟s state (USA, CANADA… only) AN 2-3 WA

Use ISO code or blank if there is no state

for the country.

Important: A bad code will be rejected by

the system!

CUSTOMER_COUNTRY Customer‟s country AN 2 US Important: A bad code will be rejected by

the system!

CUSTOMER_PHONE Customer‟s phone number AN 15 +33475655522 CUSTOMER_IP Customer‟s IP address AN 15 12.61.124.189 PRODUCT_NAME Product which is bought by the customer AN 50 CD player TRANSAC_AMOUNT Transaction‟s amount N 10 For 123.45

Important: The amount will be sent in The field must be cents and without other type than figure 12345

CURRENCY_CODE Transaction‟s currency AN 3 USD Use ISO code : € = EUR, $ = USD, £ =

GBP

CB_TYPE CB type, V for VISA and M for MasterCard AN 1 V CB_NUMBER CB number (with no space) N 20 4015504397328242 CB_MONTH CB expiration month N 2 01 CB_YEAR CB expiration year N 2 13 CB_CVC CB CVC code N 3 123 LANGUAGE_CODE Language use by end user, (only English AN 3 ENG

for the moment).

URL_RETURN_ID (optional) this parameter is required when AN 8 BARDOSH1 the merchant has more than one site to Related URL -> process the transaction. The merchant URL_RETURN : has to give to bardo 2 other www.urlreturn.com URL_RETURN and URL_DISPLAY which URL_DISPLAY : bardo store on the database, and bardo www.urldisplay.com give him a code. Stored on Bardo Database

Page 10: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 10

UAN : Unique Alphanumeric AN : Alphanumeric N : Numeric D : Date

3.3 RESPONSE: Return sent by Bardo on the URL_RETURN

BARDO returns data with Get Method on the URL_RETURN given by merchant

Position and name of data return by BARDO to the merchant.

Parameters Definition Type Example

SHOP_NUMBER Shop transaction number (the same as the UAN 20 40225

number posted by the merchant).

BARDO_NUMBER BARDO transaction number UAN 12 BDFR00001574

TRANSAC_STATUS Transaction‟s status (accepted or refused). AN 50 00

Accepted value: “00”

Refused value: “05“

Page 11: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 11

Pending value: “07”

STATUS_DETAILLED Status of transaction, accepted or refused and AN 50 “00: Approved why. Transaction”

These codes are visible on the merchant account (https://backoffice.bardo-secured.com)

as well.

“00: Approved Transaction” “05: Refused by bank”

“06: No response from banks/IP address not

registered in database”

“07: Pending”

“08: Bad Card Number”

“09: Antifraud Error”

“13: Miss 3DS Code“

These codes are not visible on the merchant account, but ensure to identify easily a possible

error in the front office.

“70: Duplicate transaction” “72: Field Error”

(ie. Empty file, country error, state error…)

“74: Merchant error”

(ie. Impossible to identify the merchant…)

3DS Transaction warranty by 3D secure or not. AN 1 - “Y” for warranty and “N” for non-warranty, “-“ if

the status isn‟t known or not implemented.

To avoid connection problem when BARDO sends back data, we can made „n‟ attempts on the Post Back to your server. You have to integrate a confirmation string into your script (this string means for BARDO there is no connection problem and you are able to receive the result of the transaction). After „n‟ unsuccessful attempts, we will send you a confirmation email (You have to give us an email address used to send back the result after the nth unsuccessful attempt).

Return string = "BARDO". You have to integrate this string on your page URL_RETURN.

The following lines illustrate what could be the script receiving the response from our servers (in VBScript):

<%@LANGUAGE="VBSCRIPT"%> <% Response.write(“BARDO”)

Set Conn = Server.CreateObject("ADODB.Connection")

Page 12: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 12

Conn.Open connect_STRING

' Merchant Transaction Number data1 = "" & Request("SHOP_NUMBER") & ""

' BARDO Transaction Number Data2 = "" & Request("BARDO_NUMBER") & ""

' Status of the Transaction data3 = "" & Request("TRANSAC_STATUS") & ""

' Status detailed of the Transaction data4 = "" & Request("STATUS_DETAILED") & ""

' 3DS mode Data5 = "" & Request("3DS") & ""

' update Merchant database start --------------------------------------------------------

SQL="INSERT INTO RESULT VALUES ('"&data1&"','"&data2&"','"&data3&"','"&data4&"', '"&data5&"')" Conn.execute(SQL) Conn.close

' update Merchant database end --------------------------------------------------------- %>

3.4 RESPONSE (DISPLAY): Return sent by Bardo on the

URL_DISPLAY

BARDO returns data with Get Method on the URL_DISPLAY given by merchant

Position and name of data return by BARDO to the merchant.

Parameters Definition Type Example SHOP_NUMBER Shop transaction number (the same as the UAN 20 40225

number posted by the merchant).

Page 13: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 13

4 Tricks for yours tests It‟s better to send transactions to 100 (1USD) for the tests, because our services can identify the test attempts easily. For your test you can use this VISA test code: CC number: 4444333322221111 MM: 12 YY: 18 CVV: 123

Or MasterCard: CC number: 5275009999999913 MM: 12 YY: 18 CVV: 123

Important: With these test credit cards, all the transactions are accepted (on test mode) and refused (on production mode).

Page 14: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 14

5 Integration Examples – ASP Technology

5.1 The file Form.asp (Form.asp is the user page) ------------------------------------------------------------------------- <html> <head> <title>Payment</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script language="JavaScript"> self.name="receive" </script> </head> <body> <%SHOP_NUMBER="123456"%> <form method="post" action="merchant.asp"> <input type="text" name="SHOP_ID" value="SHOP_ID"> <input type="text" name="SHOP_NUMBER" value="<%=SHOP_NUMBER%>"> <input

type="text" name="CUSTOMER_LAST_NAME" value="LASTNAME"> <input type="text"

name="CUSTOMER_FIRST_NAME" value="FISRTNAME"> <input type="text"

name="CUSTOMER_EMAIL" value="[email protected]"> <input type="text"

name="CUSTOMER_ADDRESS" value="ADDRESS"> <input type="text"

name="CUSTOMER_CITY" value="CITY"> <input type="text" name="CUSTOMER_ZIP_CODE" value="ZIPCODE"> <input

type="text" name="CUSTOMER_STATE" value="UT"> <input type="text" name="CUSTOMER_COUNTRY" value="US"> <input type="text"

name="CUSTOMER_PHONE" value="1234567890"> <input type="text"

name="CUSTOMER_IP" value="123.45.67.9"> <input type="text"

name="PRODUCT_NAME" value="PRODUCTNAME"> <input type="text"

name="TRANSAC_AMOUNT" value="100"> <input type="text" name="CURRENCY_CODE" value="EUR"> <input

type="text" name="CB_TYPE" value="V"> <input type="text" name="CB_NUMBER" value="4015504397328242"> <input

type="text" name="CB_MONTH" value="12"> <input type="text" name="CB_YEAR" value="05"> <input

type="text" name="CB_CVC" value="123"> <input type="text" name="LANGUAGE_CODE" value="ENG"> <input type="submit" value="send"> </body> </html> -------------------------------------------------------------------------

5.2 The file Merchant.asp : (Merchant.asp is used to send data to Bardo’s servers) ------------------------------------------------------------------------- <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> // the fields sent from form.asp <% SHOP_ID=Replace(Request("SHOP_ID"),"'","''")

SHOP_NUMBER=Replace(Request("SHOP_NUMBER"),"'","''")

CUSTOMER_LAST_NAME=Replace(Request("CUSTOMER_LAST_NAME"),"'","''")

CUSTOMER_FIRST_NAME=Replace(Request("CUSTOMER_FIRST_NAME"),"'","''")

CUSTOMER_EMAIL=Replace(Request("CUSTOMER_EMAIL"),"'","''")

Page 15: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 15

CUSTOMER_ADDRESS=Replace(Request("CUSTOMER_ADDRESS"),"'","''") CUSTOMER_CITY=Replace(Request("CUSTOMER_CITY"),"'","''") CUSTOMER_ZIP_CODE=Replace(Request("CUSTOMER_ZIP_CODE"),"'","''") CUSTOMER_STATE=Replace(Request("CUSTOMER_STATE"),"'","''") CUSTOMER_COUNTRY=Replace(Request("CUSTOMER_COUNTRY"),"'","''") CUSTOMER_PHONE=Replace(Request("CUSTOMER_PHONE"),"'","''") CUSTOMER_IP=Replace(Request("CUSTOMER_IP"),"'","''") PRODUCT_NAME=Replace(Request("PRODUCT_NAME"),"'","''") TRANSAC_AMOUNT=Replace(Request("TRANSAC_AMOUNT"),"'","''") CURRENCY_CODE=Replace(Request("CURRENCY_CODE"),"'","''") CB_TYPE=Replace(Request("CB_TYPE"),"'","''") CB_NUMBER=Replace(Request("CB_NUMBER"),"'","''") CB_MONTH=Replace(Request("CB_MONTH"),"'","''") CB_YEAR=Replace(Request("CB_YEAR"),"'","''") CB_CVC=Replace(Request("CB_CVC"),"'","''") LANGUAGE_CODE=Replace(Request("LANGUAGE_CODE"),"'","''") URL= "https://payment.bardo-gateway.com/bardo/process.aspx"

Dim xmldoc dim

xmlhttp //The string xmldoc is the string which contains the field posted to Bardo Server xmldoc = "SHOP_ID="&SHOP_ID&"&SHOP_NUMBER="&SHOP_NUMBER&"&LANGUAGE_CODE="&LANGUAGE

_CODE&"&TRANSAC_AMOUNT="&TRANSAC_AMOUNT&"&CURRENCY_CODE="&CURRENCY_CODE&"

&CUSTOMER_EMAIL="&CUSTOMER_EMAIL&"&CUSTOMER_LAST_NAME="&CUSTOMER_LAST_NAM

E&"&CUSTOMER_FIRST_NAME="&CUSTOMER_FIRST_NAME&"&CUSTOMER_ADDRESS="&CUSTOM

ER_ADDRESS&"&CUSTOMER_ZIP_CODE="&CUSTOMER_ZIP_CODE&"&CUSTOMER_STATE="&CUS

TOMER_STATE&"&CUSTOMER_COUNTRY="&CUSTOMER_COUNTRY&"&CUSTOMER_CITY="&CUSTO

MER_CITY&"&CUSTOMER_PHONE="&CUSTOMER_PHONE&"&CB_TYPE="&CB_TYPE&"&PRODUCT_

NAME="&PRODUCT_NAME&"&CUSTOMER_IP="&CUSTOMER_IP&"&CB_NUMBER="&CB_NUMBER&"

&CB_MONTH="&CB_MONTH&"&CB_YEAR="&CB_YEAR&"&CB_CVC="&CB_CVC&"" xmldoc = replace(xmldoc, " ","%20")

set xmlhttp = server.Createobject("MSXML2.XMLHTTP")

xmlhttp.Open "POST",URL,False xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-

urlencoded" xmlhttp.Send xmldoc

//RESULT0 is the response done by Bardo server, it is the payment processing page

RESULT0 = "" & xmlhttp.responseText & ""

%> //The result is displayed to the user

<%=RESULT0%> -------------------------------------------------------------------------

Page 16: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 16

5.3 The file return.asp – The results are sent by Bardo on this URL and are written in the database. ------------------------------------------------------------------------- <%@LANGUAGE="VBSCRIPT"%> <% Response.write(“BARDO”) Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open connect_STRING ' Merchant Transaction Number data1 = "" & Request("SHOP_NUMBER") & "" ' BARDO Transaction Number data2 = "" & Request("BARDO_NUMBER") & "" ' Status of the Transaction data3 = "" & Request("TRANSAC_STATUS") & "" ' Status detailled of the Transaction data4 = "" & Request("STATUS_DETAILLED") & "" ' 3DS mode Data5 = "" & Request("3DS") & "" ' update Merchant database start ---------------------------------------- SQL="INSERT INTO RESULT VALUES

('"&data1&"','"&data2&"','"&data3&"','"&data4&"', '"&data5&"')"

Conn.execute(SQL) Conn.close ' update Merchant database end ------------------------------------------ %> ------------------------------------------------------------------------- 5.4 The file display_result.asp (Display_result.asp query the database to know if the result is arrived) ------------------------------------------------------------------------- <% 'CONNECTION STRING COMES HERE Set rs=Server.CreateObject("ADODB.RECORDSET") „We get the SHOP_NUMBER SEND THE PAGE MERCHANT.ASP SHOP_NUMBER=Request.QueryString(“SHOP_NUMBER”) „HERE IS THE CODE TO CHECK FOR THE DATABASE FOR THE RESULT '------------------------------------------------------------------------

Page 17: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 17

Sql="Select TRANSAC_STATUS,SHOP_NUMBER,BARDO_NUMBER from result where SHOP_NUMBER ='"&SHOP_NUMBER&"'" rs.open Sql,Conn,3,3 if not rs.eof then SHOP_NUMBER=rs(0)

BARDO_NUMBER=rs(1)

TRANSAC_STATUS =rs(2) end if rs.close '--------HERE I AM CHECKING WHETHER THE TRANSACTION RESULT IS APPROVED THAT IS 00 ----------------------------

if TRANSAC_STATUS ="00" then Response.Redirect

"creditcard.asp?TRANSAC_STATUS="&TRANSAC_STATUS&"&SHOP_NUMBER="&SHOP_NUMB

ER&"&BARDO_NUMBER="&BARDO_NUMBER

end if '--- THIS CODE IS TO CHECK WHETHER THE TRANSACTION IS FAILED if TRANSAC_STATUS ="05" then

Response.Redirect "orderdeclined.asp?

TRANSAC_STATUS="&TRANSAC_STATUS&"&SHOP_NUMBER="&SHOP_NUMBER&"&BARDO_NUMBE

R="&BARDO_NUMBER end if

'-------------------------------------

-----------------------------------

%>

<!-- THIS IS THE SCRIPT FOR KEEPING THE PAGE REFRESH FOR CONTINOUS FOR

EVERY 10 SECONDS ---------- >

<script language="JavaScript">

<!--

var id='<%=SHOP_NUMBER%>';

setTimeout("top.location.href='display_result.asp?SHOP_NUMBER='+id+''

",10000);

//-- >

</script>

<!------------------------------------

---------------------------------- >

<!-- THIS IS THE CODE TO SHOW THE PROCESSING CONTINOUSLY --------------- >

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0"

<p><font face="Arial, Helvetica, sans-serif" size="2"><b>PAYMENT

PROCESSING ...........</b></font></p>

Page 18: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 18

<p><font face="Arial, Helvetica, sans-serif" size="2">Please be

patient we are attempting to process your payment now. This may

take several minutes to complete! p> <p><font face="Arial, Helvetica, sans-serif" size="2">Thank

you!</font></p> </body> </html> -------------------------------------------------------------------------

Page 19: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 19

6 Integration Examples – PHP Technology 6.1 The file Form.php (Form.php is the user page) ------------------------------------------------------------------------- <html> <head> <title>Payment</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script language="JavaScript"> self.name="receive" </script> </head> <body> //Example with SHOP_NUMBER “123456”, you have to send your shop number <?$SHOP_NUMBER="123456"?> <form method="post" action="merchant.php"> <input type="text" name="SHOP_ID" value="YOUR_ID"> <input type="text" name="SHOP_NUMBER" value="<? echo $SHOP_NUMBER;?>"> <input

type="text" name="CUSTOMER_LAST_NAME" value="LASTNAME"> <input type="text" name="CUSTOMER_FIRST_NAME" value="FISRTNAME"> <input

type="text" name="CUSTOMER_EMAIL" value="[email protected]"> <input type="text"

name="CUSTOMER_ADDRESS" value="ADDRESS"> <input type="text"

name="CUSTOMER_CITY" value="CITY"> <input type="text" name="CUSTOMER_ZIP_CODE" value="ZIPCODE"> <input

type="text" name="CUSTOMER_STATE" value="UT "> <input type="text" name="CUSTOMER_COUNTRY" value="US"> <input type="text"

name="CUSTOMER_PHONE" value="1234567890"> <input type="text"

name="CUSTOMER_IP" value="123.45.67.9"> <input type="text"

name="PRODUCT_NAME" value="PRODUCTNAME"> <input type="text"

name="TRANSAC_AMOUNT" value="100"> <input type="text" name="CURRENCY_CODE" value="EUR"> <input

type="text" name="CB_TYPE" value="V"> <input type="text" name="CB_NUMBER" value="4015504397328242"> <input

type="text" name="CB_MONTH" value="12"> <input type="text" name="CB_YEAR" value="05"> <input

type="text" name="CB_CVC" value="123"> <input type="text" name="LANGUAGE_CODE" value="ENG"> <input type="submit" value="send"> </form> </body> </html> -------------------------------------------------------------------------

6.2 The file Merchant.php : (Merchant.php is used to send data to Bardo’s servers) ------------------------------------------------------------------------- <html> <head> <title>Payment Processing</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <?

Page 20: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 20

//The string $params is the string which contains the fields posted to Bardo Server $params="SHOP_ID=".$_POST["SHOP_ID"]."&SHOP_NUMBER=".$_POST["SHOP_NUMBER"

]."&LANGUAGE_CODE=".$_POST["LANGUAGE_CODE"]."&TRANSAC_AMOUNT=".$_POST["TR

ANSAC_AMOUNT"]."&CURRENCY_CODE=".$_POST["CURRENCY_CODE"]."&CUSTOMER_EMAIL

=".$_POST["CUSTOMER_EMAIL"]."&CUSTOMER_LAST_NAME=".$_POST["CUSTOMER_LAST_

NAME"]."&CUSTOMER_FIRST_NAME=".$_POST["CUSTOMER_FIRST_NAME"]."&CUSTOMER_A

DDRESS=".$_POST["CUSTOMER_ADDRESS"]."&CUSTOMER_ZIP_CODE=".$_POST["CUSTOME

R_ZIP_CODE"]."&CUSTOMER_STATE=".$_POST["CUSTOMER_STATE"]."&CUSTOMER_COUNT

RY=".$_POST["CUSTOMER_COUNTRY"]."&CUSTOMER_CITY=".$_POST["CUSTOMER_CITY"]

."&CUSTOMER_PHONE=".$_POST["CUSTOMER_PHONE"]."&CB_TYPE=".$_POST["CB_TYPE"

]."&PRODUCT_NAME=".$_POST["PRODUCT_NAME"]."&CUSTOMER_IP=".$_POST["CUSTOME

R_IP"]."&CB_NUMBER=".$_POST["CB_NUMBER"]."&CB_MONTH=".$_POST["CB_MONTH"].

"&CB_YEAR=".$_POST["CB_YEAR"]."&CB_CVC=".$_POST["CB_CVC"]."";

$param = str_replace(" ", "%20",$params);

//$url is the URL where the data are posted $url = "https://payment.bardo-secured.com/bardo/process.aspx"; $user_agent =

"Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";

// // You can use Curl method or Redirection method

// CURL Method //For example CURL can be used to send

Page 21: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 21

$ch = curl_init(); curl_setopt($ch,

CURLOPT_POST,1); curl_setopt($ch, CURLOPT_POSTFIELDS,$param); curl_setopt($ch,

CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,

2); curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);

curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // this line makes it work

under https

$result=curl_exec ($ch); curl_close

($ch); //The result is displayed to the user. echo($result); // END CURL Method

// OR

// Redirection Method header("location:".$url."?".$param"); // END Redirection Method

?> </body> </html> -------------------------------------------------------------------------

6.3 The file return.php – The results are sent by Bardo on this URL and are written in the database. ------------------------------------------------------------------------- See $4.4 Example based on a MySQL Database.

Page 22: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 22

<?

echo "BARDO";

// Merchant Transaction Number $ShopNumber =

$_REQUEST['SHOP_NUMBER']; // BARDO Transaction

Number $Bardonumber = $_REQUEST['BARDO_NUMBER']; // Status

of the Transaction $Status = $_REQUEST['TRANSAC_STATUS']; // Status

detailled of the Transaction $Status2 = $_REQUEST['STATUS_DETAILLED']; // 3DS mode $T3ds = $_REQUEST['3DS'];

$sql = "insert into result select

'$ShopNumber','$Bardonumber','$Status','$Status2','$T3ds';";

$server = "localhost"; $user =

"root"; $pass = "";

mysql_connect($server,$user,$pass) or die('Database error');

mysql_select_db("shop") or die('Database error'); mysql_query($sql); mysql_close();

?> ------------------------------------------------------------------------- 6.4 The file display_result.php (Display_result.php query the database to know if the result is arrived) ------------------------------------------------------------------------- See $4.4 Example based on a MySQL Database. <?

//CONNECTION STRING COMES HERE $server = "localhost"; $user = "root"; $pass =

"";

mysql_connect($server,$user,$pass) or die('Database error'); mysql_select_db("shop") or die('Database error');

//We get the SHOP_NUMBER SEND THE PAGE MERCHANT.ASP $shopnumber

= $_REQUEST['SHOP_NUMBER'];

// HERE IS THE CODE TO CHECK FOR THE DATABASE FOR THE RESULT $sql="Select

TRANSAC_STATUS,SHOP_NUMBER,BARDO_NUMBER from result where SHOP_NUMBER ='$shopnumber'";

$result=mysql_query($sql);

$row=mysql_fetch_object($result); if ($row) {

$status = $row->TRANSAC_STATUS;

Page 23: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 23

$bardonumber = $row->BARDO_NUMBER; $response = 1;

} else {

$status = ""; $bardonumber =

""; $response = 0 ; }

//--------HERE I AM CHECKING WHETHER THE TRANSACTION RESULT IS APPROVED THAT IS 00

if ($status == "00")

header("Location: creditcard.php?TRANSAC_STATUS=$status&SHOP_NUMBER=$shopnumber&BARDO_NUMBE

R=$bardonumber"); //--- THIS CODE IS TO CHECK WHETHER THE TRANSACTION IS FAILED if

(($status != "00") && ( $response == 1) ) header("Location:

orderdeclined.php?TRANSAC_STATUS=$status&SHOP_NUMBER=$shopnumber&BARDO_NU

MBER=$bardonumber"); ?> <!-- THIS IS THE SCRIPT FOR KEEPING THE PAGE REFRESH FOR CONTINOUS FOR EVERY 10 SECONDS ----------> <script language="JavaScript"> <!-- var id='<? echo $shopnumber ?>';

setTimeout("top.location.href='display_result.php?SHOP_NUMBER='+id+''",10 000); //--> </script> <!-- THIS IS THE CODE TO SHOW THE PROCESSING CONTINOUSLY ---------------> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" <p><font

face="Arial, Helvetica, sans-serif" size="2"><b>PAYMENT PROCESSING ...........</b></font></p> <p><font

face="Arial, Helvetica, sans-serif" size="2">Please be

patient we are attempting to process your payment now. This may

take several minutes to complete! p> <p><font face="Arial, Helvetica, sans-serif" size="2">Thank

you!</font></p> </body> </html> -------------------------------------------------------------------------

Page 24: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 24

7 Important Information about the Integration

You have to be careful with following information:

- For the test TRANSAC_AMOUNT must be set to 100.

- In the page URL_RETURN, do not forget to put the string BARDO at the top of the page.

- You can not use directly the URL_RETURN to display the response to the user. URL_RETURN must only write the results of transactions in the database. You must display the results with the URL_DISPLAY only.

- With the test credit card, all the transactions are refused (field STATUS_DETAILLED at 05) (it is not possible to receive an accepted payment with the test card even if you enter the right code into the pop-up).

- You have to use ISO code for the CUSTOMER_STATE field and the CUSTOMER_COUNTRY field.

- You should verify the integrity of each field before sending the data to reduce rejected transactions.

Page 25: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 25

8 Contact Bardo Technical Service

Technical contact Team E-mail: [email protected]

Page 26: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 26

Annex Currency Table

Currency Code

US Dollar USD

Euro EUR

Pound Sterling GBP States Tables

Australia

COUNTRY CODE STATE AU ACT Australian Capital Territory

AU NSW New South Wales

AU NT Northern Territory

AU QLD Queensland

AU SA South Australia

AU TAS Tasmania

AU VIC Victoria

AU WA Western Australia

Canada

COUNTRY CODE STATE CA AB Alberta

CA BC British Columbia

CA MB Manitoba

CA NB New Brunswick

CA NF Newfoundland

CA NN Nunavut

CA NS Nova Scotia

CA NT Northwest Territories

CA ON Ontario

CA PE Prince Edward Island

CA QC Quebec

CA SK Saskatchewan

CA YT Yukon

United Kingdom

COUNTRY CODE STATE GB EN England

GB NO Northern Ireland

GB SC Scotland

GB WA Wales

Page 27: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 27

COUNTRY CODE STATE US CO Colorado

US CT Connecticut

US DC District of Columbia

US DE Delaware

US FL Florida

US FM Federated States of Micronesia

US GA Georgia

US GU Guam

US HI Hawaii

US IA Iowa

US ID Idaho

US IL Illinois

US IN Indiana

US KS Kansas

US KY Kentucky

US LA Louisiana

US MA Massachusetts

US MD Maryland

US ME Maine

US MH Marshall Islands

US MI Michigan

US MN Minnesota

US MO Missouri

US MP Northern Mariana Islands

US MS Mississippi

US MT Montana

US NC North Carolina

US ND North Dakota

US NE Nebraska

US NH New Hampshire

US NJ New Jersey

US NM New Mexico

US NV Nevada

US NY New York

US OH Ohio

US OK Oklahoma

US OR Oregon

US PA Pennsylvania

Page 28: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 28

US PR Puerto Rico

US PW Palau

US RI Rhode Island

US SC South Carolina

US SD South Dakota

US TN Tennessee

US TX Texas

US UT Utah

US VA Virginia

US VI Virgin Islands

US VT Vermont

US WA Washington

US WI Wisconsin

US WV West Virginia

US WY Wyoming

South Africa

COUNTRY CODE STATE ZA EC Eastern Cape

ZA FS Free State

ZA GG Gauteng

ZA KN KwaZulu-Natal

ZA MG Mpumalanga

ZA NO Northern Cape

ZA NP Northern Province

ZA NW North West

ZA WC Western Cape

Countries Table

Country Code

AFGHANISTAN AF

ALBANIA AL

ALGERIA DZ

AMERICAN SAMOA AS

ANDORRA AD

ANGOLA AO

ANGUILLA AI

ANTARCTICA AQ

ANTIGUA AND BARBUDA AG

ARGENTINA AR

Page 29: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 29

Country Code ARMENIA AM

ARUBA AW

AUSTRALIA AU

AUSTRIA AT

AZERBAIJAN AZ

BAHAMAS BS

BAHRAIN BH

BANGLADESH BD

BARBADOS BB

BELARUS BY

BELGIUM BE

BELIZE BZ

BENIN BJ

BERMUDA BM

BHUTAN BT

BOLIVIA BO

BOSNIA AND HERZEGOVINA BA

BOTSWANA BW

BOUVET ISLAND BV

BRAZIL BR

BRITISH INDIAN OCEAN TERRITORY IO

BRUNEI DARUSSALAM BN

BULGARIA BG

BURKINA FASO BF

BURUNDI BI

CAMBODIA KH

CAMEROON CM

CANADA CA

CAPE VERDE CV

CAYMAN ISLANDS KY

CENTRAL AFRICAN REPUBLIC CF

CHAD TD

CHILE CL

CHINA CN

CHRISTMAS ISLAND CX

COCOS (KEELING) ISLANDS CC

COLOMBIA CO

Page 30: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 30

COMOROS KM

CONGO CG CONGO, THE DEMOCRATIC REPUBLIC OF THE CD

COOK ISLANDS CK

COSTA RICA CR

COTE D'IVOIRE CI

CROATIA HR

CUBA CU

CYPRUS CY

CZECH REPUBLIC CZ

DENMARK DK

DJIBOUTI DJ

DOMINICA DM

DOMINICAN REPUBLIC DO

EAST TIMOR TP

ECUADOR EC

EGYPT EG

EL SALVADOR SV

EQUATORIAL GUINEA GQ

ERITREA ER

ESTONIA EE

ETHIOPIA ET

FALKLAND ISLANDS (MALVINAS) FK

FAROE ISLANDS FO

FIJI FJ

FINLAND FI

FRANCE FR

FRENCH GUIANA GF

FRENCH POLYNESIA PF

FRENCH SOUTHERN TERRITORIES TF

GABON GA

GAMBIA GM

GEORGIA GE

GERMANY DE

GHANA GH

GIBRALTAR GI

GREECE GR

GREENLAND GL

GRENADA GD

GUADELOUPE GP

GUAM GU

Page 31: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 31

GUATEMALA GT

GUINEA GN

GUINEA-BISSAU GW

GUYANA GY

HAITI HT

HEARD ISLAND AND MCDONALD ISLANDS HM

HOLY SEE (VATICAN CITY STATE) VA

HONDURAS HN

HONG KONG HK

HUNGARY HU

ICELAND IS

INDIA IN

INDONESIA ID

IRAN, ISLAMIC REPUBLIC OF IR

IRAQ IQ

IRELAND IE

ISRAEL IL

ITALY IT

JAMAICA JM

JAPAN JP

JORDAN JO

KAZAKSTAN KZ

KENYA KE

KIRIBATI KI

KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF KP

KOREA, REPUBLIC OF KR

KUWAIT KW

KYRGYZSTAN KG

LAO PEOPLE'S DEMOCRATIC REPUBLIC LA

LATVIA LV

LEBANON LB

LESOTHO LS

LIBERIA LR

LIBYAN ARAB JAMAHIRIYA LY

LIECHTENSTEIN LI

LITHUANIA LT

LUXEMBOURG LU

MACAU MO

MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF MK MADAGASCAR MG

MALAWI MW

Page 32: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 32

MALAYSIA MY

MALDIVES MV

MALI ML

MALTA MT

MARSHALL ISLANDS MH

MARTINIQUE MQ

MAURITANIA MR

MAURITIUS MU

MAYOTTE YT

MEXICO MX

MICRONESIA, FEDERATED STATES OF FM

MOLDOVA, REPUBLIC OF MD

MONACO MC

MONGOLIA MN

MONTSERRAT MS

MOROCCO MA

MOZAMBIQUE MZ

MYANMAR MM

NAMIBIA NA

NAURU NR

NEPAL NP

NETHERLANDS NL

NETHERLANDS ANTILLES AN

NEW CALEDONIA NC

NEW ZEALAND NZ

NICARAGUA NI

NIGER NE

NIGERIA NG

NIUE NU

NORFOLK ISLAND NF

NORTHERN MARIANA ISLANDS MP

NORWAY NO

OMAN OM

PAKISTAN PK

PALAU PW

PALESTINIAN TERRITORY, OCCUPIED PS

PANAMA PA

PAPUA NEW GUINEA PG

Page 33: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 33

PARAGUAY PY

PERU PE

PHILIPPINES PH

PITCAIRN PN

POLAND PL

PORTUGAL PT

PUERTO RICO PR

QATAR QA

REUNION RE

ROMANIA RO

RUSSIAN FEDERATION RU

RWANDA RW

SAINT HELENA SH

SAINT KITTS AND NEVIS KN

SAINT LUCIA LC

SAINT PIERRE AND MIQUELON PM

SAINT VINCENT AND THE GRENADINES VC

SAMOA WS

SAN MARINO SM

SAO TOME AND PRINCIPE ST

SAUDI ARABIA SA

SENEGAL SN

SEYCHELLES SC

SIERRA LEONE SL

SINGAPORE SG

SLOVAKIA SK

SLOVENIA SI

SOLOMON ISLANDS SB

SOMALIA SO

SOUTH AFRICA ZA

SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS GS

SPAIN ES

SRI LANKA LK

SUDAN SD

SURINAME SR

SVALBARD AND JAN MAYEN SJ

SWAZILAND SZ

SWEDEN SE

SWITZERLAND CH

Page 34: Programmers Guide 3.8 Final

Bardo Programmers’ Guide Page 34

SYRIAN ARAB REPUBLIC SY

TAIWAN, PROVINCE OF CHINA TW

TAJIKISTAN TJ

TANZANIA, UNITED REPUBLIC OF TZ

THAILAND TH

TOGO TG

TOKELAU TK

TONGA TO

TRINIDAD AND TOBAGO TT

TUNISIA TN

TURKEY TR

TURKMENISTAN TM

TURKS AND CAICOS ISLANDS TC

TUVALU TV

UGANDA UG

UKRAINE UA

UNITED ARAB EMIRATES AE

UNITED KINGDOM GB

UNITED STATES US

UNITED STATES MINOR OUTLYING ISLANDS UM

URUGUAY UY

UZBEKISTAN UZ

VANUATU VU

VENEZUELA VE

VIET NAM VN

VIRGIN ISLANDS, BRITISH VG

VIRGIN ISLANDS, U.S. VI

WALLIS AND FUTUNA WF

WESTERN SAHARA EH

YEMEN YE

YUGOSLAVIA YU

ZAMBIA ZM

ZIMBABWE ZW

Language table:

Language Code

English ENG