This document provides technical specifications for processing financial transactions through Paysafe PaymentXP gateway. We have written this specifically for web designers and professionals who design, implement and support the intended systems. We use HTTPS POST to transmit and receive data.
Please explore our payment gateway through our demonstration account with given test credentials.
To verify your transactions processed successfully, log on to the Payment XP gateway at www.paymentxp.com. The credentials are below.
Disclaimer: If you process live activity with the gateway mode to ‘test’, everything will appear as normal however, none of the activity will be sent to the processor. Please be sure mode is updated to ‘LIVE’ when ready.
Notes: Activity will NOT reach the processor(s) in test mode or pre-production environments. Some functionality may be limited such as, but not limited to, credit transactions, real-time processor responses, etc.
Test values can be used with the pre-production demo account OR the merchant’s account in test mode.
Test transactions can be submitted with the following information:
A sale can be created in many ways: either by charging a credit card, or debiting from an account using the ACH System.
This operation will charge the credit card. This method performs both authorization and capture into one operation.
Credit Card Charge Example: (C#)
File: Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <P> This sample code is designed to generate a post using PaymentXP's Web Host Interface. Response will be displayed on the screen after post method. </P> <br /> <h3>Response:</h3> <asp:Label ID="lblResponse" runat="server" Text=""></asp:Label> </div> </form> </body> </html>
File: Default.aspx.cs
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Collections; using System.Net; using System.IO; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string url = "https://webservice.paymentxp.com/wh/webhost.aspx"; //Sample credit card charge Hashtable prms = new Hashtable(); prms.Add("TransactionType","CreditCardCharge"); prms.Add("MerchantID","10012"); prms.Add("MerchantKey","69711A34-5B4C-49E3-816D-F3840004F0D7"); prms.Add("CardNumber","4111111111111111"); prms.Add("ExpirationDateMMYY","0115"); prms.Add("TransactionAmount", "19.99"); prms.Add("BillingNameFirst", "John"); prms.Add("BillingNameLast","Doe"); prms.Add("BillingFullName","John Doe"); prms.Add("BillingAddress","455 Abc Street"); prms.Add("BillingZipCode","92708"); prms.Add("BillingCity","Santa Ana"); prms.Add("BillingState","CA"); String postdata = string.Empty; foreach (DictionaryEntry prm in prms) { postdata += prm.Key + "=" + prm.Value + "&"; } postdata = postdata.TrimEnd('&'); //Create Request Object HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = "POST"; request.ContentLength = postdata.Length; request.ContentType = "application/x-www-form-urlencoded"; //Post Data StreamWriter sw = null; sw = new StreamWriter(request.GetRequestStream()); sw.Write(postdata); sw.Close(); //Get response String post_response; HttpWebResponse objResponse = (HttpWebResponse)request.GetResponse(); using (StreamReader responseStream = new StreamReader(objResponse.GetResponseStream())) { post_response = responseStream.ReadToEnd(); responseStream.Close(); } lblResponse.Text = post_response; } }
Credit Card Charge Example: (Python)
import httplib import urllib import urlparse # establish connection conn = httplib.HTTPSConnection('webservice.paymentxp.com', 443) # set parameters params = urllib.urlencode({ "CardNumber":'4111111111111111', "ExpirationDateMMYY":'0615', "MerchantID":'10012', "MerchantKey":'69711A34-5B4C-49E3-816D-F3840004F0D7', "TransactionAmount":'2.34', "TransactionType":'CreditCardCharge', "BillingFirstName":"john", #optional "BillingLastName":"smith", #optional "BillingFullName":"john smith", #optional "BillingZipCode":"90210", #optional }) # set headers headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain", "Content-Length": "%d"%(len(params))} # post request conn.request("POST", '/wh/webhost.aspx', params, headers) # retrieve response resp = conn.getresponse() if resp.status == 200 and resp.reason == "OK": # parse return value into dictionary resp_dict = urlparse.parse_qs(resp.read(), True) if str(resp_dict["StatusID"]) == "['0']": print "good" # transaction good! else: print "bad" # invalid transaction, handle accordingly conn.close() else: # could not connect print "could not connect"
Credit Card Charge Example: (PHP)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML lang='en'> <HEAD> <TITLE> Web Host Sample </TITLE> </HEAD> <BODY> <P> This sample code is designed to connect to PaymentXP using the Web Host Interface. Response will be displayed on the screen after post method. </P> <HR /> <?PHP // Post URL $postURL = "https://webservice.paymentxp.com/wh/webhost.aspx"; //Set Post Array $postArray = array ( //Post Parameters "TransactionType" => "CreditCardCharge", "MerchantID" => "10012", "MerchantKey" => "69711A34-5B4C-49E3-816D-F3840004F0D7", "CardNumber" => "4111111111111111", "ExpirationDateMMYY" => "0115", "TransactionAmount" => "19.99", "BillingNameFirst" => "John", "BillingNameLast" => "Doe", "BillingFullName" => "John Doe", "BillingAddress" => "455 Abc Street", "BillingZipCode" => "92708", "BillingCity" => "Santa Ana", "BillingState" => "CA", ); //Generate post String $postString = ""; foreach( $postArray as $key => $value ) { $postString .= "$key=" . urlencode( $value ) . "&"; } $postString = rtrim( $postString, "& " ); // This sample code uses the CURL library for php to establish an HTTP POST // To find out if Curl is enabled. Include code below on your page. Then searh for the word Curl. // <?php phpinfo(); ?> $request = curl_init($postURL); // Initiate curl_setopt($request, CURLOPT_HEADER, 0); curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); curl_setopt($request, CURLOPT_POSTFIELDS, $postString); //HTTP POST curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE); $post_response = curl_exec($request); // Execute curl_close ($request); // Close //Write reponse echo $post_response ?> </BODY> </HTML>
Related Functions:
ACH Debit Example: (C#)
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Collections; using System.Net; using System.IO; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string url = "https://webservice.paymentxp.com/wh/webhost.aspx"; //Sample credit card charge Hashtable prms = new Hashtable(); prms.Add("TransactionType","ACHDebit"); prms.Add("MerchantID","10012"); prms.Add("MerchantKey","69711A34-5B4C-49E3-816D-F3840004F0D7"); prms.Add("RoutingNumber","123456780"); prms.Add("Amount", "19.99"); prms.Add("ProcessDate", "12152015"); prms.Add("Description", "Test Trans"); prms.Add("BankAccountType", "1"); prms.Add("ACHCheckType", "1"); prms.Add("AccountNumber", "123456"); prms.Add("AccountName", "John Smith"); String postdata = string.Empty; foreach (DictionaryEntry prm in prms) { postdata += prm.Key + "=" + prm.Value + "&"; } postdata = postdata.TrimEnd('&'); //Create Request Object HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = "POST"; request.ContentLength = postdata.Length; request.ContentType = "application/x-www-form-urlencoded"; //Post Data StreamWriter sw = null; sw = new StreamWriter(request.GetRequestStream()); sw.Write(postdata); sw.Close(); //Get response String post_response; HttpWebResponse objResponse = (HttpWebResponse)request.GetResponse(); using (StreamReader responseStream = new StreamReader(objResponse.GetResponseStream())) { post_response = responseStream.ReadToEnd(); responseStream.Close(); } lblResponse.Text = post_response; } }
Ach Debit Example: (Python)
import httplib import urllib import urlparse # establish connection conn = httplib.HTTPSConnection('webservice.paymentxp.com', 443) # set parameters params = urllib.urlencode({ "TransactionType":"ACHDebit", "MerchantID":"10012", "MerchantKey":"69711A34-5B4C-49E3-816D-F3840004F0D7", "RoutingNumber":"123456780", "Amount":"19.99", "ProcessDate":"12152015", "Description":"Test Trans", "BankAccountType":"1", "ACHCheckType":"1", "AccountNumber":"123456", "AccountName":"John Smith", }) # set headers headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain", "Content-Length": "%d"%(len(params))} # post request conn.request("POST", '/wh/webhost.aspx', params, headers) # retrieve response resp = conn.getresponse() if resp.status == 200 and resp.reason == "OK": # parse return value into dictionary resp_dict = urlparse.parse_qs(resp.read(), True) if str(resp_dict["StatusID"]) == "['1']": print "good" # transaction good! else: print "bad" # invalid transaction, handle accordingly conn.close() else: # could not connect print "could not connect"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML lang='en'> <HEAD> <TITLE> Web Host Sample </TITLE> </HEAD> <BODY> <P> This sample code is designed to connect to PaymentXP using the Web Host Interface. Response will be displayed on the screen after post method. </P> <HR /> <?PHP // Post URL $postURL = "https://webservice.paymentxp.com/wh/webhost.aspx"; //Set Post Array $postArray = array ( //Post Parameters "TransactionType" => "ACHDebit", "MerchantID" => "10012", "MerchantKey" => "69711A34-5B4C-49E3-816D-F3840004F0D7", "RoutingNumber" => "123456780", "Amount" => "19.99", "ProcessDate" => "12152015", "Description" => "Test Trans", "BankAccountType" => "1", "ACHCheckType" => "1", "AccountNumber" => "123456", "AccountName" => "John Smith" ); //Generate post String $postString = ""; foreach( $postArray as $key => $value ) { $postString .= "$key=" . urlencode( $value ) . "&"; } $postString = rtrim( $postString, "& " ); // This sample code uses the CURL library for php to establish an HTTP POST // To find out if Curl is enabled. Include code below on your page. Then searh for the word Curl. // <?php phpinfo(); ?> $request = curl_init($postURL); // Initiate curl_setopt($request, CURLOPT_HEADER, 0); curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); curl_setopt($request, CURLOPT_POSTFIELDS, $postString); //HTTP POST curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE); $post_response = curl_exec($request); // Execute curl_close ($request); // Close //Write reponse echo $post_response ?> </BODY> </HTML>
You can refund the entire amount of the original transaction, or a partial amount.
Credit Card Refund Example: (C#)
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Collections; using System.Net; using System.IO; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string url = "https://webservice.paymentxp.com/wh/webhost.aspx"; //Sample credit card refund Hashtable prms = new Hashtable(); prms.Add("TransactionType","CreditCardCredit"); prms.Add("MerchantID","10012"); prms.Add("MerchantKey","69711A34-5B4C-49E3-816D-F3840004F0D7"); prms.Add("ReferenceNumber","testref"); prms.Add("TransactionAmount", "19.99"); prms.Add("TransactionID","1000000"); String postdata = string.Empty; foreach (DictionaryEntry prm in prms) { postdata += prm.Key + "=" + prm.Value + "&"; } postdata = postdata.TrimEnd('&'); //Create Request Object HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = "POST"; request.ContentLength = postdata.Length; request.ContentType = "application/x-www-form-urlencoded"; //Post Data StreamWriter sw = null; sw = new StreamWriter(request.GetRequestStream()); sw.Write(postdata); sw.Close(); //Get response String post_response; HttpWebResponse objResponse = (HttpWebResponse)request.GetResponse(); using (StreamReader responseStream = new StreamReader(objResponse.GetResponseStream())) { post_response = responseStream.ReadToEnd(); responseStream.Close(); } lblResponse.Text = post_response; } }
Credit Card Capture Example: (Python)
import httplib import urllib import urlparse # establish connection conn = httplib.HTTPSConnection('webservice.paymentxp.com', 443) # set parameters params = urllib.urlencode({ "ReferenceNumber":'testref', "MerchantID":'10012', "MerchantKey":'69711A34-5B4C-49E3-816D-F3840004F0D7', "TransactionAmount":'19.99', "TransactionType":'CreditCardCredit', "TransactionID":"1000000", }) # set headers headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain", "Content-Length": "%d"%(len(params))} # post request conn.request("POST", '/wh/webhost.aspx', params, headers) # retrieve response resp = conn.getresponse() if resp.status == 200 and resp.reason == "OK": # parse return value into dictionary resp_dict = urlparse.parse_qs(resp.read(), True) if str(resp_dict["StatusID"]) == "['0']": print "good" # transaction good! else: print "bad" # invalid transaction, handle accordingly conn.close() else: # could not connect print "could not connect"
Credit Card Capture Example: (PHP)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML lang='en'> <HEAD> <TITLE> Web Host Sample </TITLE> </HEAD> <BODY> <HR /> <?PHP // Post URL $postURL = "https://webservice.paymentxp.com/wh/webhost.aspx"; //Set Post Array $postArray = array ( //Post Parameters "MerchantID" => "10012", "MerchantKey" => "69711A34-5B4C-49E3-816D-F3840004F0D7", "ReferenceNumber" => "testref", "TransactionAmount" => "19.99", "TransactionID" => "1000000", "TransactionType" => "CreditCardSettle" ); //Generate post String $postString = ""; foreach( $postArray as $key => $value ) { $postString .= "$key=" . urlencode( $value ) . "&"; } $postString = rtrim( $postString, "& " ); // This sample code uses the CURL library for php to establish an HTTP POST // To find out if Curl is enabled. Include code below on your page. Then searh for the word Curl. // <?php phpinfo(); ?> $request = curl_init($postURL); // Initiate curl_setopt($request, CURLOPT_HEADER, 0); curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); curl_setopt($request, CURLOPT_POSTFIELDS, $postString); //HTTP POST curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE); $post_response = curl_exec($request); // Execute curl_close ($request); // Close //Write reponse echo $post_response ?> </BODY> </HTML>
Creates a new customer in the Customer Vault.
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Collections; using System.Net; using System.IO; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string url = "https://webservice.paymentxp.com/wh/webhost.aspx"; //Sample credit card charge Hashtable prms = new Hashtable(); prms.Add("TransactionType","AddCustomer"); prms.Add("MerchantID","10012"); prms.Add("MerchantKey","69711A34-5B4C-49E3-816D-F3840004F0D7"); prms.Add("CardNumber","4111111111111111"); prms.Add("CardExpirationDate","0115"); prms.Add("AccountNumber","123456789"); prms.Add("CustomerName","Test Name"); prms.Add("RoutingNumber","123465780"); prms.Add("CustomerID","JaneSmith123"); String postdata = string.Empty; foreach (DictionaryEntry prm in prms) { postdata += prm.Key + "=" + prm.Value + "&"; } postdata = postdata.TrimEnd('&'); //Create Request Object HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = "POST"; request.ContentLength = postdata.Length; request.ContentType = "application/x-www-form-urlencoded"; //Post Data StreamWriter sw = null; sw = new StreamWriter(request.GetRequestStream()); sw.Write(postdata); sw.Close(); //Get response String post_response; HttpWebResponse objResponse = (HttpWebResponse)request.GetResponse(); using (StreamReader responseStream = new StreamReader(objResponse.GetResponseStream())) { post_response = responseStream.ReadToEnd(); responseStream.Close(); } lblResponse.Text = post_response; } }
import httplib import urllib import urlparse # establish connection conn = httplib.HTTPSConnection('webservice.paymentxp.com', 443) # set parameters params = urllib.urlencode({ "CardNumber":'4111111111111111', "ExpirationDateMMYY":'0615', "MerchantID":'10012', "MerchantKey":'69711A34-5B4C-49E3-816D-F3840004F0D7', "TransactionType":'AddCustomer', "CustomerName":'Kate Smith', "CustomerID":'KateSmith123', "AccountNumber":'123456', "RoutingNumber":'12346780', }) # set headers headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain", "Content-Length": "%d"%(len(params))} # post request conn.request("POST", '/wh/webhost.aspx', params, headers) # retrieve response resp = conn.getresponse() if resp.status == 200 and resp.reason == "OK": # parse return value into dictionary resp_dict = urlparse.parse_qs(resp.read(), True) if str(resp_dict["StatusID"]) == "['0']": print "good" # transaction good! else: print "bad" # invalid transaction, handle accordingly conn.close() else: # could not connect print "could not connect"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML lang='en'> <HEAD> <TITLE> Web Host Sample </TITLE> </HEAD> <BODY> <P> This sample code is designed to connect to PaymentXP using the Web Host Interface. Response will be displayed on the screen after post method. </P> <HR /> <?PHP // Post URL $postURL = "https://webservice.paymentxp.com/wh/webhost.aspx"; //Set Post Array $postArray = array ( //Post Parameters "TransactionType" => "AddCustomer", "MerchantID" => "10012", "MerchantKey" => "69711A34-5B4C-49E3-816D-F3840004F0D7", "CardNumber" => "4111111111111111", "CardExpirationDate" => "0115", "RoutingNumber" => "123456780", "AccountNumber" => "123456", "CustomerID" => "Doe", "CustomerName" => "John Doe", ); //Generate post String $postString = ""; foreach( $postArray as $key => $value ) { $postString .= "$key=" . urlencode( $value ) . "&"; } $postString = rtrim( $postString, "& " ); // This sample code uses the CURL library for php to establish an HTTP POST // To find out if Curl is enabled. Include code below on your page. Then searh for the word Curl. // <?php phpinfo(); ?> $request = curl_init($postURL); // Initiate curl_setopt($request, CURLOPT_HEADER, 0); curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); curl_setopt($request, CURLOPT_POSTFIELDS, $postString); //HTTP POST curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE); $post_response = curl_exec($request); // Execute curl_close ($request); // Close //Write reponse echo $post_response ?> </BODY> </HTML>
Create transactions from saved customers stored in the Customer Vault.
Charge Customer Credit Card Example: (C#)
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Collections; using System.Net; using System.IO; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string url = "https://webservice.paymentxp.com/wh/webhost.aspx"; //Sample credit card charge Hashtable prms = new Hashtable(); prms.Add("TransactionType","AddCustomerCCCharge"); prms.Add("MerchantID","10012"); prms.Add("MerchantKey","69711A34-5B4C-49E3-816D-F3840004F0D7"); prms.Add("TransactionAmount", "19.99"); prms.Add("CustomerID", "TestCustomer"); String postdata = string.Empty; foreach (DictionaryEntry prm in prms) { postdata += prm.Key + "=" + prm.Value + "&"; } postdata = postdata.TrimEnd('&'); //Create Request Object HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = "POST"; request.ContentLength = postdata.Length; request.ContentType = "application/x-www-form-urlencoded"; //Post Data StreamWriter sw = null; sw = new StreamWriter(request.GetRequestStream()); sw.Write(postdata); sw.Close(); //Get response String post_response; HttpWebResponse objResponse = (HttpWebResponse)request.GetResponse(); using (StreamReader responseStream = new StreamReader(objResponse.GetResponseStream())) { post_response = responseStream.ReadToEnd(); responseStream.Close(); } lblResponse.Text = post_response; } }
Charge Customer Credit Card Example: (Python)
import httplib import urllib import urlparse # establish connection conn = httplib.HTTPSConnection('webservice.paymentxp.com', 443) # set parameters params = urllib.urlencode({ "MerchantID":'10012', "MerchantKey":'69711A34-5B4C-49E3-816D-F3840004F0D7', "TransactionAmount":'2.34', "TransactionType":'AddCustomerCCCharge', "CustomerID":"TestCustomer", }) # set headers headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain", "Content-Length": "%d"%(len(params))} # post request conn.request("POST", '/wh/webhost.aspx', params, headers) # retrieve response resp = conn.getresponse() if resp.status == 200 and resp.reason == "OK": # parse return value into dictionary resp_dict = urlparse.parse_qs(resp.read(), True) if str(resp_dict["StatusID"]) == "['0']": print "good" # transaction good! else: print "bad" # invalid transaction, handle accordingly conn.close() else: # could not connect print "could not connect"
Charge Customer Credit Card Example: (PHP)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML lang='en'> <HEAD> <TITLE> Web Host Sample </TITLE> </HEAD> <BODY> <P> This sample code is designed to connect to PaymentXP using the Web Host Interface. Response will be displayed on the screen after post method. </P> <HR /> <?PHP // Post URL $postURL = "https://webservice.paymentxp.com/wh/webhost.aspx"; //Set Post Array $postArray = array ( //Post Parameters "TransactionType" => "AddCustomerCCCharge", "MerchantID" => "10012", "MerchantKey" => "69711A34-5B4C-49E3-816D-F3840004F0D7", "TransactionAmount" => "3.44", "CustomerID" => "TestCustomerID", ); //Generate post String $postString = ""; foreach( $postArray as $key => $value ) { $postString .= "$key=" . urlencode( $value ) . "&"; } $postString = rtrim( $postString, "& " ); // This sample code uses the CURL library for php to establish an HTTP POST // To find out if Curl is enabled. Include code below on your page. Then searh for the word Curl. // <?php phpinfo(); ?> $request = curl_init($postURL); // Initiate curl_setopt($request, CURLOPT_HEADER, 0); curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); curl_setopt($request, CURLOPT_POSTFIELDS, $postString); //HTTP POST curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE); $post_response = curl_exec($request); // Execute curl_close ($request); // Close //Write reponse echo $post_response ?> </BODY> </HTML>
Create recurring transactions
Add Recurring Credit Card Charge: (C#)
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Collections; using System.Net; using System.IO; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string url = "https://webservice.paymentxp.com/wh/webhost.aspx"; //Sample credit card charge Hashtable prms = new Hashtable(); prms.Add("TransactionType","CreditCardRecurringCharge"); prms.Add("MerchantID","10012"); prms.Add("MerchantKey","69711A34-5B4C-49E3-816D-F3840004F0D7"); prms.Add("TransactionAmount", "19.99"); prms.Add("StartDate", "01012014"); prms.Add("WeekOption", "0"); prms.Add("WeekdayOption", "0"); prms.Add("OccurenceOption", "2"); prms.Add("MonthOfYearOption", "1"); prms.Add("MonthlyOption", "1"); prms.Add("DayOfMonthOption", "05"); prms.Add("CardNumber", "4111111111111111"); prms.Add("ExpirationDateMMYY", "1216"); String postdata = string.Empty; foreach (DictionaryEntry prm in prms) { postdata += prm.Key + "=" + prm.Value + "&"; } postdata = postdata.TrimEnd('&'); //Create Request Object HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = "POST"; request.ContentLength = postdata.Length; request.ContentType = "application/x-www-form-urlencoded"; //Post Data StreamWriter sw = null; sw = new StreamWriter(request.GetRequestStream()); sw.Write(postdata); sw.Close(); //Get response String post_response; HttpWebResponse objResponse = (HttpWebResponse)request.GetResponse(); using (StreamReader responseStream = new StreamReader(objResponse.GetResponseStream())) { post_response = responseStream.ReadToEnd(); responseStream.Close(); } lblResponse.Text = post_response; } }
Add Recurring Credit Card Charge: (Python)
import httplib import urllib import urlparse # establish connection conn = httplib.HTTPSConnection('webservice.paymentxp.com', 443) # set parameters params = urllib.urlencode({ "MerchantID":'10012', "MerchantKey":'69711A34-5B4C-49E3-816D-F3840004F0D7', "TransactionAmount":'2.34', "TransactionType":'CreditCardRecurringCharge', "StartDate":"01012014", "WeekOption":"0", "WeekdayOption":"0", "OccurenceOption":"2", "MonthOfYearOption":"1", "MonthlyOption":"1", "DayOfMonthOption":"05", "CardNumber":"4111111111111111", "ExpirationDateMMYY":"1216", }) # set headers headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain", "Content-Length": "%d"%(len(params))} # post request conn.request("POST", '/wh/webhost.aspx', params, headers) # retrieve response resp = conn.getresponse() if resp.status == 200 and resp.reason == "OK": # parse return value into dictionary resp_dict = urlparse.parse_qs(resp.read(), True) if str(resp_dict["StatusID"]) == "['0']": print "good" # transaction good! else: print "bad" # invalid transaction, handle accordingly conn.close() else: # could not connect print "could not connect"
Add Recurring Credit Card Charge: (PHP)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML lang='en'> <HEAD> <TITLE> Web Host Sample </TITLE> </HEAD> <BODY> <P> This sample code is designed to connect to PaymentXP using the Web Host Interface. Response will be displayed on the screen after post method. </P> <HR /> <?PHP // Post URL $postURL = "https://webservice.paymentxp.com/wh/webhost.aspx"; //Set Post Array $postArray = array ( //Post Parameters "TransactionType" => "CreditCardRecurringCharge", "MerchantID" => "10012", "MerchantKey" => "69711A34-5B4C-49E3-816D-F3840004F0D7", "TransactionAmount" => "2.33", "StartDate" => "01012014", "WeekOption" => "0", "WeekdayOption" => "0", "OccurenceOption" => "2", "MonthOfYearOption" => "1", "MonthlyOption" => "1", "DayOfMonthOption" => "05", "CardNumber" => "4111111111111111", "ExpirationDateMMYY" => "1216", ); //Generate post String $postString = ""; foreach( $postArray as $key => $value ) { $postString .= "$key=" . urlencode( $value ) . "&"; } $postString = rtrim( $postString, "& " ); // This sample code uses the CURL library for php to establish an HTTP POST // To find out if Curl is enabled. Include code below on your page. Then searh for the word Curl. // <?php phpinfo(); ?> $request = curl_init($postURL); // Initiate curl_setopt($request, CURLOPT_HEADER, 0); curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); curl_setopt($request, CURLOPT_POSTFIELDS, $postString); //HTTP POST curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE); $post_response = curl_exec($request); // Execute curl_close ($request); // Close //Write reponse echo $post_response ?> </BODY> </HTML>
You should use a token whenever you want to process a transaction, but don't want to handle the sensitive data on your servers.
You'll want to use a Token for all transactions if you want to remove yourself from PCI Scope.
Meritus.js is the jQuery library that sends the sensitive information to Paysafe, and returns back a single use Token for processing.
NOTE: The token will expire in 20 minutes after initialization.
Meritus.js is no longer supported by Paysafe. Although it is still functional, we recommend all new and existing customers use our PaysafePXP.js product.
PaysafePXP.js is the jQuery library that sends the sensitive information to Paysafe, and returns back a single use Token for processing.
Processing a Credit Card transaction with tokens requires the following steps:
Step 1) Collect sensitive information and use Meritus.js to convert that information into a Token (client side)
<!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8" /> <title>Meritus Credit Card Token sample</title> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> <script type="text/javascript" src="https://webservice.paymentxp.com/js/Meritus.js"></script> <script type="text/javascript"> $(document).ready(function () { // attaches a function to the submit event on the form $("#form1").submit(function (event) { // disable button to prevent multiple clicks $('.submit-button').attr("disabled", "disabled"); // create token Meritus.createToken({ merchantid: $('.merchantid').val(), cardnumber: $('.cardnumber').val(), cvv2: $('.cvv2').val(), expmonth: $('.expmonth').val(), expyear: $('.expyear').val() }, meritusResponseHandler); // prevent default action. return false; }); // this is the callback function that Meritus.createToken() calls after creating the token function meritusResponseHandler(token, statusid) { if (statusid != "0") { // show the errors on the form alert("Error: StatusID: " + statusid); // enable button so you can process again. $(".submit-button").removeAttr("disabled"); } else { // locate our form var myform = $("#form1"); // insert our token into our form. we'll be using this to process the transaction myform.append("<input type='hidden' name='Token' value='" + token + "'/>"); // for debugging $("#mytoken").text(token); // submit the form myform.get(0).submit(); } } }); </script> </head> <body> <form id="form1" > <div> <div> <label>MerchantID</label> <!-- This is the merchantid issued to you from Meritus. Use 10012 for testing. --> <input type="text" class="merchantid" value="10012" /> </div> <div> <label>Card Number</label> <!-- notice that there are no "name" attributes. this ensures that these sensitive values are never communicated back to your server on postback --> <input type="text" size="20" autocomplete="off" value="4242424242424242" class="cardnumber" /> </div> <div> <label>CVV2</label> <input type="text" size="4" autocomplete="off" value="123" class="cvv2" /> </div> <div> <label>Expiration (MM/YY)</label> <input type="text" size="2" class="expmonth" value="01" /> <span>/ </span> <input type="text" size="4" class="expyear" value="15" /> </div> <button type="submit" class="submit-button"> Submit Payment </button> </div> <!-- for debugging --> <div id="mytoken"></div> </form> </body> </html>
Step 1) Collect sensitive information and use PaysafePXP.js to convert that information into a Token (client side)
<!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8" /> <title>Meritus Credit Card Token sample</title> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> <script type="text/javascript" src="https://webservice.paymentxp.com/js/PaysafePXP.js"></script> <script type="text/javascript"> $(document).ready(function () { // attaches a function to the submit event on the form $("#form1").submit(function (event) { // disable button to prevent multiple clicks $('.submit-button').attr("disabled", "disabled"); // create token Paysafe.createToken({ merchantid: $('.merchantid').val(), cardnumber: $('.cardnumber').val(), cvv2: $('.cvv2').val(), expmonth: $('.expmonth').val(), expyear: $('.expyear').val() }, paysafePXPResponseHandler); // prevent default action. return false; }); // this is the callback function that Meritus.createToken() calls after creating the token function paysafePXPResponseHandler(token, statusid) { if (statusid != "0") { // show the errors on the form alert("Error: StatusID: " + statusid); // enable button so you can process again. $(".submit-button").removeAttr("disabled"); } else { // locate our form var myform = $("#form1"); // insert our token into our form. we'll be using this to process the transaction myform.append("<input type='hidden' name='Token' value='" + token + "'/>"); // for debugging $("#mytoken").text(token); // submit the form myform.get(0).submit(); } } }); </script> </head> <body> <form id="form1" > <div> <div> <label>MerchantID</label> <!-- This is the merchantid issued to you from Paysafe. Use 10012 for testing. --> <input type="text" class="merchantid" value="10012" /> </div> <div> <label>Card Number</label> <!-- notice that there are no "name" attributes. this ensures that these sensitive values are never communicated back to your server on postback --> <input type="text" size="20" autocomplete="off" value="4242424242424242" class="cardnumber" /> </div> <div> <label>CVV2</label> <input type="text" size="4" autocomplete="off" value="123" class="cvv2" /> </div> <div> <label>Expiration (MM/YY)</label> <input type="text" size="2" class="expmonth" value="01" /> <span>/ </span> <input type="text" size="4" class="expyear" value="15" /> </div> <button type="submit" class="submit-button"> Submit Payment </button> </div> <!-- for debugging --> <div id="mytoken"></div> </form> </body> </html>
Step 2) Use that token to process the transaction (server side)
Credit Card Charge Example: (.Net)
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Collections; using System.Net; using System.IO; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string url = "https://webservice.paymentxp.com/wh/webhost.aspx"; string token = Request["Token"]; //Sample credit card charge Hashtable prms = new Hashtable(); prms.Add("TransactionType","CreditCardCharge"); prms.Add("MerchantID","10012"); prms.Add("MerchantKey","69711A34-5B4C-49E3-816D-F3840004F0D7"); prms.Add("Token","token"); prms.Add("TransactionAmount", "19.99"); prms.Add("BillingNameFirst", "John"); prms.Add("BillingNameLast","Doe"); prms.Add("BillingFullName","John Doe"); prms.Add("BillingAddress","455 Abc Street"); prms.Add("BillingZipCode","92708"); prms.Add("BillingCity","Santa Ana"); prms.Add("BillingState","CA"); String postdata = string.Empty; foreach (DictionaryEntry prm in prms) { postdata += prm.Key + "=" + prm.Value + "&"; } postdata = postdata.TrimEnd('&'); //Create Request Object HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = "POST"; request.ContentLength = postdata.Length; request.ContentType = "application/x-www-form-urlencoded"; //Post Data StreamWriter sw = null; sw = new StreamWriter(request.GetRequestStream()); sw.Write(postdata); sw.Close(); //Get response String post_response; HttpWebResponse objResponse = (HttpWebResponse)request.GetResponse(); using (StreamReader responseStream = new StreamReader(objResponse.GetResponseStream())) { post_response = responseStream.ReadToEnd(); responseStream.Close(); } lblResponse.Text = post_response; } }
import httplib import urllib import urlparse # establish connection conn = httplib.HTTPSConnection('webservice.paymentxp.com', 443) # NOTE: this all depends on your framework. token = request.POST.get['token'] # set parameters params = urllib.urlencode({ "Token":token, "MerchantID":'10012', "MerchantKey":'69711A34-5B4C-49E3-816D-F3840004F0D7', "TransactionAmount":'2.34', "TransactionType":'CreditCardCharge', "BillingFirstName":"john", #optional "BillingLastName":"smith", #optional "BillingFullName":"john smith", #optional "BillingZipCode":"90210", #optional }) # set headers headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain", "Content-Length": "%d"%(len(params))} # post request conn.request("POST", '/wh/webhost.aspx', params, headers) # retrieve response resp = conn.getresponse() if resp.status == 200 and resp.reason == "OK": # parse return value into dictionary resp_dict = urlparse.parse_qs(resp.read(), True) if str(resp_dict["StatusID"]) == "['0']": print "good" # transaction good! else: print "bad" # invalid transaction, handle accordingly conn.close() else: # could not connect print "could not connect"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML lang='en'> <HEAD> <TITLE> Web Host Sample </TITLE> </HEAD> <BODY> <P> This sample code is designed to connect to PaymentXP using the Web Host Interface. Response will be displayed on the screen after post method. </P> <HR /> <?PHP // Post URL $postURL = "https://webservice.paymentxp.com/wh/webhost.aspx"; $token = $_REQUEST['token']; //Set Post Array $postArray = array ( //Post Parameters "TransactionType" => "CreditCardCharge", "MerchantID" => "10012", "MerchantKey" => "69711A34-5B4C-49E3-816D-F3840004F0D7", "Token" => $token, "TransactionAmount" => "19.99", "BillingNameFirst" => "John", "BillingNameLast" => "Doe", "BillingFullName" => "John Doe", "BillingAddress" => "455 Abc Street", "BillingZipCode" => "92708", "BillingCity" => "Santa Ana", "BillingState" => "CA", ); //Generate post String $postString = ""; foreach( $postArray as $key => $value ) { $postString .= "$key=" . urlencode( $value ) . "&"; } $postString = rtrim( $postString, "& " ); // This sample code uses the CURL library for php to establish an HTTP POST // To find out if Curl is enabled. Include code below on your page. Then searh for the word Curl. // <?php phpinfo(); ?> $request = curl_init($postURL); // Initiate curl_setopt($request, CURLOPT_HEADER, 0); curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); curl_setopt($request, CURLOPT_POSTFIELDS, $postString); //HTTP POST curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE); $post_response = curl_exec($request); // Execute curl_close ($request); // Close //Write reponse echo $post_response ?> </BODY> </HTML>
This document provides technical specifications for processing financial transactions through Paysafe PaymentXP Gateway Host by interfacing with the Gateway API.
The audiences of this document are for business analysts and software programmers who design, implement, and support the intended system.
Gateway API is a server side application that provides a direct link to the Paysafe PaymentXP Gateway Host. All communications between the client machines and the Gateway API takes place over a Hypertext Transfer Protocol (HTTP) over a 128-bit Secure Socket Layer (HTTPS) on the Internet. Any device or platform with the ability to originate an HTTPS connection can perform financial transactions through the Gateway API.
The request is constructed using name/value pairs as defined per transaction type. The response received would also be in name/value pairs as defined per transaction type.
Description: This method returns a Token that can be used to perform various credit card transactions through the functions below. The Token will replace the values passed in the GetToken method to be used with these functions.
Resource Url: https://webservice.paymentxp.com/wh/GetToken.aspx
Method: POST
Description: GetToken for ACH Transactions
Description: GetToken for Payment Hosted
Description: GetToken for Customer Hosted
Description: This method authorizes a credit card transaction by requesting an authorization number from the card issuer. An approved authorization means that the transaction dollar amount has been reserved for usage but not yet deducted from the cardholder’s account. Funds are not settled (transferred to the merchant) until the CreditCardSettle() method is called using the authorization number returned by this method.
Resource Url: https://webservice.paymentxp.com/wh/WebHost.aspx
Description: This method captures (transfers to the merchant) a transaction previously authorized with the Authorize() method. Captured transactions are scheduled for settlement at the determined batch time.
Description: This method performs both authorization and settlement into one operation.
Description: This method credits a credit card account with an originating Settle or Charge transaction. The credit is based on a prior transaction performed through either CreditCardSettle() or CreditCardCharge().
Description: This method cancels a previously completed Authorization or Charge transaction. A transaction that has already been settled using the CreditCardSettle() method cannot be voided, but instead do perform a Credit on the account.
Description: This method cancels a previously completed/authorized Credit transaction. A Credit transaction that has already been authorized for settlement using the CreditCardCredit() method but not yet submitted for settlement, cannot be voided but instead perform a CreditCardCreditReversal to reverse the amount.
Description: This method modifies the Transaction Amount of a previously processed CreditCardCharge(), CreditCardAuthorization(), or AddCustomerCCCharge(). This method can be used to modify the captured amount up to the original Transaction Amount. To Adjust over the original Transaction Amount, contact your Integration Specialist for more details.
Description: This method creates a credit card transaction for settlement by with an offline authorization number from the card issuer. An approved authorization through other means is required to be submitted.
Description: This method credits a credit card without the need of an originating Sales Transaction. Contact your Integration Specialist for more details.
Description: This method can only be used when the settlement time is set to MANUAL. This method will initiate a batch closure and schedule the batch for settlement. Contact your Integration Specialist for more details.
Description: This method creates a credit card charge transaction from a customer record.
Description: Use this method to let Paysafe perform collection of sensitive credit card information on our secure servers.
Resource Url: https://webservice.paymentxp.com/wh/EnterPayment.aspx
Description: Use this method to re-process a historical transaction.
Description: This method schedules a credit card charge via a recurring payment. In most cases, CreditCardRebill() Method is preferred.
Description: This method updates an existing recurring rule in the database.
Description: This method retrieves a credit card transaction record from the database.
To use this interface option, all transaction data must be correctly formatted and saved in a batch file. Batch files can be formatted as comma-delimited. Our program polls the FTP directories every fifteen minutes to look for files that have been uploaded for processing.
FTP
Upon request, we will issue you a test account for development and testing. Once you’ve been certified, a production account will be created for you. The certification process includes the following steps:
All files sent to us via SFTP shall be encrypted using PGP. Please contact us to obtain a free version of the PGP software and our public PGP key.
Credit Card File Specification (Comma-Delimited)
The following guidelines shall be used for formatting transaction data sent in a comma-delimited batch file.