Tuesday, December 07, 2004

Credit Card Payment Gateway API

Four major credit card payment gateway:
1. Verisign => http://verisign.com/
2. Psigate => http://psigate.com/
3. Linkpoint => http://linkpoint.com/
4. Authorize => http://authorize.net/

Another two payment gateway:
5. 2CheckOut => http://2checkout.com/
6. Paypal => http://paypal.com/

Five Transaction Type:
0(S). Sale
1(A). Authorisation
2(D). Delayed Capture
3(C). Credit
9(V). Void

API
1. Verisign Payment Services: Payflow Pro
The Payflow Pro client resides on your computer system and is available on all major Web server platforms in a variety of formats to support integration requirements. It comes as a binary executable, activated via a Common Gateway Interface (CGI) script, or integrated as a C-interface application library. It is also available as DLL, COM, Site Server, Java Native Interface, or Perl Module
Interface

Config:
Host=test-payflow.verisign.com
Port=443

Set ccObj = CreateObject("PFProCOMControl.PFProCOMControl.1")
Query = "USER=MerchantLogin&VENDOR=MerchantLogin&PARTNER=MerchantPartner
&PWD=MerchantPassword&TRXTYPE=transactionType&TENDER=C&ACCT=accountNumber
&EXPDATE=expDate&AMT=Amount&COMMENT1=UserName&MERCHDESCR=CompanyName&MERCHSVC=CustomerTel"
Ctx = creditcardObj.CreateContext(HostAddress, HostPort, 30, "", 0, "", "")
Response = ccObj.SubmitTransaction(Ctx, Query , Len(Query))
'RESULT=0&RESPMSG=Approved&PNREF=V53A53032326
ccObj.DestroyContext (Ctx)

2. PsiGate
Config:
Host=secure.psigate.com
Port=1139

Set ccObj = CreateObject("MyServer.PsiGate")
ccObj.ConfigFile = MerchantConfig
ccObj.KeyFile = MerchantKeyFile
ccObj.Host = HostAddress
ccObj.Port = HostPort
ccObj.Result = TestMode
ccObj.Bname = cardName
ccObj.CardNumber = accountNumber
ccObj.expMonth = expMonth
ccObj.expYear = expYear
ccObj.ChargeType = transactionType
ccObj.userID = clientType
ccObj.Email = clientType
ret = ccObj.AddItem("cc transaction for CompanyName", "total price", Amount, 1, "", 0, "")
if ret = 1 then
ret = ccObj.ProcessOrder()
if ret = 1 then
Appr = ccObj.Appr 'APPROVED
Err = ccObj.Err '
OrdNo = ccObj.OrdNo '69.158.48.111-1102444389-363202-15893-7
end if
end if

3.LinkPoint: API
a collection of functions for processing payment transactions over the Internet in a highly secure manner.
Transition between COM Object versions 5.4(using 1139) and 6.0(using 1129) before Feb 2005.

Config:
Host=staging.linkpt.net
Port=1129

'=================V5.4===================================================
Set ccObj= Server.CreateObject("ComApi_3_8.ComApi")
OrderCtx = ccObj.csi_order_alloc()
ItemCtx = ccObj.csi_item_alloc()
ReqCtx = ccObj.csi_req_alloc()
Flag = ccObj.csi_req_set(ReqCtx, ReqField_Configfile, merchantconfig)
Flag = ccObj.csi_req_set(ReqCtx, ReqField_Keyfile, keylocation)
Flag = ccObj.csi_req_set(ReqCtx, ReqField_Host, hostaddress)
Flag = ccObj.csi_req_set(ReqCtx, ReqField_Port, hostport)

Flag = ccObj.csi_order_setrequest(OrderCtx, ReqCtx)
if ccObj.bStat <> Succeed Then
'Error
End If

Flag = ccObj.csi_order_set(OrderCtx, OrderField_Bname, cardname)
Flag = ccObj.csi_order_set(OrderCtx, OrderField_Cardnumber, accountnumber)
Flag = ccObj.csi_order_set(OrderCtx, OrderField_ChargeType, transactiontype)
Flag = ccObj.csi_order_set(OrderCtx, OrderField_Expmonth, expmonth)
Flag = ccObj.csi_order_set(OrderCtx, OrderField_Expyear, expyear)
Flag = ccObj.csi_order_set(OrderCtx, OrderField_Email, email)
Flag = ccObj.csi_order_set(OrderCtx, OrderField_Result, status)
Flag = ccObj.csi_item_set(ItemCtx, ItemField_Itemid, "total price")
Flag = ccObj.csi_item_set(ItemCtx, ItemField_Description, "cc transaction for companyname")
Flag = ccObj.csi_item_set(ItemCtx, ItemField_Price, amount)
Flag = ccObj.csi_item_set(ItemCtx, ItemField_Quantity, 1)
Flag = ccObj.csi_order_additem(OrderCtx, ItemCtx)
if ccObj.bStat <> Succeed Then
'Error
End If

Flag = ccObj.csi_item_drop(ItemCtx)
Flag = ccObj.csi_order_set(OrderCtx, OrderField_Subtotal, amount)
Flag = ccObj.csi_order_set(OrderCtx, OrderField_Chargetotal, amount)

Flag = ccObj.csi_order_process(OrderCtx)
if ccObj.bStat <> Succeed Then
'Error
End If

Ref = ccObj.csi_order_get(OrderCtx, OrderField_R_Ref)
Appr = ccObj.csi_order_get(OrderCtx, OrderField_R_Approved)
Err = ccObj.csi_order_get(OrderCtx, OrderField_R_Error)
Ord = ccObj.csi_order_get(OrderCtx, OrderField_R_Ordernum)

Flag = ccObj.csi_order_drop(OrderCtx)
Flag = ccObj.csi_req_drop(ReqCtx)
Set ccObj = nothing

'=================V6.0===================================================
Set order = Server.CreateObject("LpiCom_6_0.LPOrderPart")
order.setPartName("order")
Set ccObj = Server.CreateObject("LpiCom_6_0.LPOrderPart")
res=ccObj.put("ordertype", "SALE") 'PREAUTH, POSTAUTH, VOID
res=order.addPart("orderccObjtions", ccObj)

res=ccObj.put("name", bname)
res=ccObj.put("email", bemail)

res=ccObj.clear()
res=ccObj.put("zip", bzip)
res=ccObj.put("addrnum", baddrnum)
res=order.addPart("billing", ccObj)
'res=ccObj.put("oid", oid)
'res=order.addPart("transactiondetails", ccObj)

res=ccObj.clear()
res=ccObj.put("configfile", configfile)
res=order.addPart("merchantinfo", ccObj)

res=ccObj.clear()
res=ccObj.put("cardnumber", cardnumber)
res=ccObj.put("cardexpmonth", expmonth)
res=ccObj.put("cardexpyear", expyear)
res=order.addPart("creditcard", ccObj)

res=ccObj.clear()
res=ccObj.put("chargetotal", total)
res=order.addPart("payment", ccObj)

Set LPTxn = Server.CreateObject("LpiCom_6_0.LinkPointTxn")

outXml = order.toXML()
Response = LPTxn.send(keyfile, host, port, outXml)
'CSITue Dec 7 10:43:16 20040000017747459E306F-41B5F9C3-627-14FD240088730000017747:YNAM:12345678901234567890123:1102444996APPROVEDYNAM

Set LPTxn = Nothing
Set order = Nothing
Set ccObj = Nothing

4. Authorize:
The Standard Transaction Submission API defines how transactions should be submitted to the gateway using AIM. The gateway response API describes the gateway’s responses to transactions submitted to the gateway.

Config:
Host=https://secure.authorize.net/gateway/transact.dll
Port=1139

query = "x_login=MerchantLogin&amp;x_tran_key=MerchantKey&x_type=
x_type&x_amount=total&x_card_num=cardnumber&x_exp_date=
x_exp_date&x_trans_id=x_trans_id&x_first_name=x_first_name &x_last_name=x_last_name &x_email=emailaddress"
Set objsxh = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0")
objsxh.open "POST", HostAddress ,false
objsxh.setRequestHeader "Content-Type","application/x-www-form-urlencoded"
objsxh.setRequestHeader "Content-Length",len(query)
objsxh.send query
Response = objsxh.responseText
'1,1,1,This transaction has been approved.,000000,P,0,,,1.00,CC,auth_capture,,,,,,,,,,,,,,,,,,,,,,,,,,C8CCAF620C1287B7C2713F10E5D1FC54,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

No comments: