### MerchantApplication PHP Example Source: https://help.usaepay.info/developer/soap-api/boarding/objects/merchantapplication Demonstrates how to construct a MerchantApplication object in PHP with contact, billing, and platform setup details. ```php $App=new stdClass(); $App->ResellerEmail='applications@reseller.com'; $App->ContactInfo = new stdClass(); $App->MerchantName = "Acme Bagel Company"; $App->ContactInfo->Contact = "John Doe"; $App->ContactInfo->Street ='4929 Wilshire Blvd'; $App->ContactInfo->Street2 ='Suite 800'; $App->ContactInfo->City ='Los Angeles'; $App->ContactInfo->State ='CA'; $App->ContactInfo->Zip ='90010'; $App->ContactInfo->Country ='US'; $App->ContactInfo->Email = 'john@acme.com'; $App->ContactInfo->Fax ='012134567890'; $App->ContactInfo->Phone ='687668678677'; $App->ContactInfo->MobilePhone='798787978788'; $App->ContactInfo->AltEmail='mary@tmcode.com'; $App->ContactInfo->URL = 'http://acme bagels.com'; $App->BillingInfo = new stdClass(); $App->BillingInfo->BankName = 'Bank of America'; $App->BillingInfo->RoutingNumber = '12342313312'; $App->BillingInfo->AccountNumber = '57655765754'; $App->BillingInfo->GatewayPackage = 'Platinum Package'; $App->CreditCardPlatform = 'FDMS'; $App->CreditCardIndustry = 'Retail (Swipe)'; $App->CreditCardPlatformSetup = array(); $App->CreditCardPlatformSetup[] = array('Field'=>'MerchantNum', 'Value'=>'4454900399430020'); $App->CreditCardPlatformSetup[] = array('Field'=>'MerchantID', 'Value'=>'382772891'); $App->CreditCardPlatformSetup[] = array('Field'=>'TerminalID', 'Value'=>'112198000'); $App->eCheckPlatform = 'Vericheck'; $App->eCheckPlatformSetup = array(); $App->eCheckPlatformSetup[] = array('Field'=>'DefaultSEC', 'Value'=>'TEL'); $App->eCheckPlatformSetup[] = array('Field'=>'TaxID', 'Value'=>'123456789'); $App->eCheckPlatformSetup[] = array('Field'=>'PIN', 'Value'=>'231'); $App->eCheckPlatformSetup[] = array('Field'=>'MID', 'Value'=>'11231'); $App->eCheckPlatformSetup[] = array('Field'=>'AcceptedSecCodes', 'Value'=>'TEL,PPD,CCD'); $App->SourceKeyName = 'My Shopping Cart'; $App->SourceKeyPin = '1351'; $App->EmailSourceKeyTo = 'demo@acmebagels.com'; $App->UserName = 'acmebagels'; $App->EmailInstructionsTo = 'demo@acmebagels.com'; $App->ApplicationNotes = 'An example note for merchant application'; ``` -------------------------------- ### runQuickCredit Java Example Source: https://help.usaepay.info/developer/soap-api/methods/runquickcredit Uses the USAePay Java library to perform a quick credit transaction. Ensure the JAX-WS library is installed and the client/token objects are initialized. ```java try { //Set RefNum to the transaction refference number //you want to run a quick credit on BigInteger RefNum = new BigInteger("123456789"); //populate transaction details TransactionDetail details = new TransactionDetail(); details.setAmount(22.34); details.setDescription("QuickCredit"); details.setInvoice("119891"); // Create response object TransactionResponse response; response = client.runQuickCredit(token, RefNum, details, false); System.out.println("Response: " + response.getResult()); System.out.println("RefNum: " + response.getRefNum()); } catch (Exception e) { System.out.println("Soap Exception: " + e.getMessage()); } ``` -------------------------------- ### Full Implementation Example Source: https://help.usaepay.info/developer/sdks/jquery A complete example demonstrating custom field mapping, event handling, and error reporting. ```javascript
Address: Address cont.: Zip: Credit Card Number: cvv2: Exp Month: Exp Year:
``` -------------------------------- ### C Gateway Integration Example Source: https://help.usaepay.info/developer/sdks/c A complete C program example demonstrating how to parse form input and submit data to the USAePay gateway using libwww and cgi-html. ```c /*Code for libwwwPost.c /*Written by min2web for USAEpay for questions or comments you can contact us at: support@usaepay.com OR mind2webinfo@yahoo.com */ /*this program requires libwww libraries found at http://www.w3.org/Library to contact and submit info to the server. You will also need to have the SSL wrapper for libwww wwwssl.*/ #include "WWWLib.h" #include "WWWHTTP.h" #include "WWWInit.h" #include "WWWSSL.h" #include `` #include `` /*In this program we are using the ANSI C library cgi-html by Noel V Aguilar found at http://www.geocities.com/SiliconValley/Vista/6493/projects/cgi-lib.html It is not necessary to use this library. You can simply replace it with your own form parsing function.*/ #include "cgi-lib/cgi-lib.h" /* include the cgi-lib.h header file THIS SHOULD BE THE PATH TO THE cgi-html LIBRARY */ #include "cgi-lib/html-lib.h" /* include the html-lib.h header file THIS SHOULD BE THE PATH TO THE cgi-html LIBRARY */ /*as mentioned above you are not required to use the cgi-html library, it is only used in this program to facilitate the form processing functions. The main focus of the program is the libwww functions*/ //we set a variable of type HTChunk that will eventually contain the server response. PRIVATE HTChunk * result = NULL; char resultStatus[1000]; //The following two functions tell libwww what to do in case of //messages and trace. We will see these set as callback functions later on PRIVATE int printer (const char * fmt, va_list pArgs) { return (vfprintf(stdout, fmt, pArgs)); } PRIVATE int tracer (const char * fmt, va_list pArgs) { return (vfprintf(stderr, fmt, pArgs)); } //The following function describes what to do when libwww's main //event loop terminates. That is after libwww has contacted the //server and has recieved the result. This is where you might like //to add your own response handling function. PRIVATE int terminate_handler (HTRequest * request, HTResponse * response, void *param, int status) { if (status == HT_LOADED && result && HTChunk_data(result)) { //HTPrint("%s", HTChunk_data(result)); sprintf(resultStatus, "%s", HTChunk_data(result)); printf("\nresultStatus = %s", resultStatus); /*Results are saved in string resultStatus. For further validation comment out the above printf code, instead put your own URLdecoding function to decode the server's response and display it to your users.*/ HTChunk_delete(result); } /* We are done with this request */ HTRequest_delete(request); HTSSLhttps_terminate(); /* Terminate libwww */ HTProfile_delete(); exit(status ? status : 0); } int main (int argc, char ** argv) { HTRequest * request = NULL; HTAnchor * anchor = NULL; HTAssocList * formfields = NULL; char * uri = "https://www.usaepay.com/gate.php"; //Initiate CGI session. This is from cgi-html mime_header("text/html"); //LIST that cgi-html uses. LIST *head; //parse form variables. cgi-html head = cgi_input_parse(); //print HTML header. cgi-html html_begin("C USAePay Gateway connect",NULL); printf("`
`\n");

    char string[10000];

    //The following "if" statements determine if the required fields are found
    sprintf(string, "%s", find_val(head, "UMkey"));

    //find_val is a cgi-html function that returns the value of the form key.
    if (find_val(head, "UMkey") == NULL || strcmp(string, "") == 0)
    {
    printf("`
``

`ERROR`

``
`Source Key not found. Cannot complete operation."); html_end(); return 0; } if ((find_val(head, "UMcard") != NULL && find_val(head, "UMexpir") != NULL) || (find_val(head, "UMrouting") != NULL && find_val(head, "UMaccount") != NULL && find_val(head, "UMssn") != NULL && find_val(head, "UMdlnum") != NULL && find_val(head, "UMdlstate") != NULL)) { if (find_val(head, "UMamount") == NULL || find_val(head, "UMinvoice") == NULL || find_val(head, "UMname") == NULL || find_val(head, "UMstreet") == NULL || find_val(head, "UMzip") == NULL ) { printf("`
``

`ERROR`

``
`Missing form fields.`
`Please click the back button and complete all required fields.`
` Cannot complete operation."); html_end(); return 0; } } else { printf("`
``

`ERROR`

``
`Missing form fields.`
`Please click the back button and complete all required fields.`
` Cannot complete operation."); html_end(); return 0; } //Initiate SSL wrapper for libwww /* Create a new preemptive client */ HTProfile_newNoCacheClient("TestApp", "1.0"); HTSSL_protMethod_set (HTSSL_V23); ``` -------------------------------- ### runSale Java Example Source: https://help.usaepay.info/developer/soap-api/methods/runsale Processes a sale transaction using the USAePay Java library objects. Requires JAX-RPC or JAX-WS setup for the client and token. ```java try { TransactionRequestObject params = new TransactionRequestObject(); // set card holder name params.setAccountHolder("Test Joe"); // populate transaction details TransactionDetail details = new TransactionDetail(); details.setAmount(22.34); details.setDescription("My Test Sale"); details.setInvoice("119891"); params.setDetails(details); // populate credit card data CreditCardData ccdata = new CreditCardData(); ccdata.setCardNumber("4444555566667779"); ccdata.setCardExpiration("0919"); ccdata.setCardCode("999"); params.setCreditCardData(ccdata); // Create request object RunSale request = new RunSale(); request.setToken(token); request.setParams(params); // Create response object TransactionResponse response; // run sale response = client.runSale(token, params); System.out.println("Result: " + response.getResult()); } catch (Exception e) { System.out.println("Soap Exception: " + e.getMessage()); } ``` -------------------------------- ### getSession .NET VB Example Source: https://help.usaepay.info/developer/soap-api/methods/getsession Demonstrates calling getSession in VB.NET. ```vbnet Dim response As usaepay.TransactionSession response = client.getSession(token, report, options, format) Dim binary_data As Byte() = Convert.FromBase64String(response) MsgBox("SessionID: " & response.SessionID); ``` -------------------------------- ### UMhash Format Example Source: https://help.usaepay.info/developer/transaction-api Example of a formatted UMhash string used for transaction authentication. ```text UMhash=m/2123123/8827380daee8c6f935d3eaecf63e646c/y ``` -------------------------------- ### Test Source: https://help.usaepay.info/developer/sdks/php Tests PHP installation. If errors are detected, suggested solutions will be displayed. ```APIDOC ## Test ### Description Tests PHP installation. If errors are detected, suggested solutions will be displayed. ``` -------------------------------- ### Initialize LineItem in .NET Source: https://help.usaepay.info/developer/soap-api/objects/lineitem Examples for creating and populating a LineItem object in .NET environments. ```vbnet Dim line as usaepay.LineItem = new usaepay.Lineitem line.SKU = "123456" line.ProductRefNum = "90476" line.ProductName = "QuickBook" line.Description = "test" line.UnitPrice = "100" line.Qty = "5" ``` ```csharp usaepay.LineItem line = new usaepay.Lineitem(); line.SKU = "123456"; line.ProductRefNum = "90476"; line.ProductName = "QuickBook"; line.Description = "test"; line.UnitPrice = "100"; line.Qty = "5"; ``` -------------------------------- ### getSession PHP Example Source: https://help.usaepay.info/developer/soap-api/methods/getsession Demonstrates calling getSession using a SOAP client in PHP. ```php getSession($token); print_r($data); } catch (SoapFault $e) { die("Get Session failed :" .$e->getMessage()); } ?> ``` -------------------------------- ### moveCustomer Java Example Source: https://help.usaepay.info/developer/soap-api/methods/movecustomer Uses the USAePay Java library to move a customer between merchants. ```java try { //Set CustNum to the customer number that you want to move. "merch2token" //represents a token set up under the merchant the customer is being moved to. BigInteger CustNum = new BigInteger("123456"); BigInteger NewCustNum = client.moveCustomer(token, CustNum, merch2token); System.out.println(NewCustNum); } catch (Exception e) { System.out.println("Soap Exception: " + e.getMessage()); } ``` -------------------------------- ### giftcard:activate Source: https://help.usaepay.info/developer/transaction-api Activates a gift card and optionally sets a starting balance. ```APIDOC ## giftcard:activate ### Description For giftcard activate the cards are required to be activated before use and then you can pass in a starting balance. ### Command UMcommand=giftcard:activate ``` -------------------------------- ### getSession .NET C# Example Source: https://help.usaepay.info/developer/soap-api/methods/getsession Demonstrates calling getSession in C# with error handling. ```csharp usaepay.TransactionSession response; try { response = client.getSession(token); MessageBox.Show(response.SessionID); } catch (Exception err) { MessageBox.Show(err.Message); } ``` -------------------------------- ### searchMerchantApplications Java Example Source: https://help.usaepay.info/developer/soap-api/boarding/methods/searchmerchantapplications Demonstrates searching for merchant applications using the SearchParamArray in Java. ```java SearchParamArray params = new SearchParamArray(); params.add(new SearchParam("State", "eq", "CA")); MerchantApplicationSearchResult result; result = client.searchMerchantApplications(restoken, params, true, BigInteger.ZERO, new BigInteger("100"), "MerchRefNum"); System.out.println("Found Merchant: " + result.getApplications().getMerchantApplications().get(1).getMerchantName()); ``` -------------------------------- ### Activate Gift Card Source: https://help.usaepay.info/developer/transaction-api Cards must be activated before use; an optional starting balance can be provided. ```text UMcommand=giftcard:activate ``` -------------------------------- ### Retrieve Invoices cURL Request Source: https://help.usaepay.info/developer/rest-api/invoices/get-invoices Example of a GET request to retrieve invoices with the @isSent filter applied. ```bash curl -X GET https://secure.usaepay.com/api/v2/invoices?filters=@isSent -H "Content-Type: application/json" -H "Authorization: Basic X1Y4N1F0YjUxM0NkM3ZhYk03UkMwVGJ0SldlU284cDc6czIvYWJjZGVmZ2hpamtsbW5vcC9iNzRjMmZhOTFmYjBhMDk3NTVlMzc3ZWU4ZTIwYWE4NmQyYjkyYzNkMmYyNzcyODBkYjU5NWY2MzZiYjE5MGU2" ``` -------------------------------- ### Create a product using VB.NET Source: https://help.usaepay.info/developer/soap-api/methods/addproduct Shows how to instantiate a Product object, configure inventory and price tiers, and submit the product to the gateway. ```vb Dim product As usaepay.Product = New usaepay.Product product.ProductID = "0-13-508011-8" product.SKU = "135080118" product.UPC = "9780135080115" product.Category = "Books:Math" Dim inventory(0 To 1) As usaepay.ProductInventory inventory(0) = New usaepay.ProductInventory() inventory(0).InventoryLocation = "Los angeles" inventory(0).QtyOnHand = "10" inventory(0).QtyOnOrder = "5" inventory(0).DateAvailable = "2010-08-20" product.Inventory = inventory Dim priceTier(0 To 1) As usaepay.PriceTier priceTier(0) = New usaepay.PriceTier() priceTier(0).Qty = "2" priceTier(0).Price = "100" product.PriceTiers = priceTier product.TaxClass = "your_tax_class" product.Enabled = True product.Name = "Elementary Differential Equations" product.Description = "Rainville, Bedient and Bedient (Eight Edition)" product.Weight = 1.0 product.ShipWeight = 1.1 product.Price = 112.0 product.ListPrice = 128.0 product.WholesalePrice = 100.0 product.DateAvailable = "2010-08-01" product.Manufacturer = "Prentice Hail" product.MinQuantity = "0" Dim refNum As String refNum = client.addProduct(token, product) MsgBox(refNum) ``` -------------------------------- ### cURL Request for Batch List Source: https://help.usaepay.info/developer/rest-api/transactions/batch/list Example of a GET request to retrieve merchant batches using Basic Authentication. ```bash curl -X GET https://sandbox.usaepay.com/api/v2/batches -H "Content-Type: application/json" -H "Authorization: Basic X1Y4N1F0YjUxM0NkM3ZhYk03UkMwVGJ0SldlU284cDc6czIvYWJjZGVmZ2hpamtsbW5vcC9iNzRjMmZhOTFmYjBhMDk3NTVlMzc3ZWU4ZTIwYWE4NmQyYjkyYzNkMmYyNzcyODBkYjU5NWY2MzZiYjE5MGU2" ``` -------------------------------- ### runQuickCredit VB.NET Example Source: https://help.usaepay.info/developer/soap-api/methods/runquickcredit Shows how to execute a quick credit transaction in VB.NET. Requires the usaepay service reference and proper token creation. ```vb Dim client As usaepay.usaepayService = New usaepay.usaepayService Dim token As usaepay.ueSecurityToken token = Me.CreateToken("714SSUxv1uohng2XkMJ7kLpETsu58G66", "1234") Dim refnum As Integer Dim details As usaepay.TransactionDetail = New usaepay.TransactionDetail refnum = "46990787" details.Amount = "1.00" details.AmountSpecified = True details.Description = "Example QuickCredit" details.Invoice = "123456" Dim response As usaepay.TransactionResponse response = client.runQuickCredit(token, refnum, details) If response.ResultCode = "A" Then MsgBox("Transaction Approved, Reference Number: " & response.RefNum) ElseIf response.ResultCode = "D" Then MsgBox("Transaction Declined, Reason: " & response.Error) Else MsgBox("Transaction Error, Reason: " & response.Error) End If ``` -------------------------------- ### Create a product using PHP Source: https://help.usaepay.info/developer/soap-api/methods/addproduct Demonstrates creating a product record using an associative array and handling potential SoapFault exceptions. ```php "0-13-508011-8", "SKU" =>"135080118", "UPC" => "9780135080115", "Category" => "Books:Math", "Enabled" => true, "Name" => "Elementary Differential Equations", "Description" => "Rainville, Bedient and Bedient (Eight Edition)", "Weight" => 1.0, "ShipWeight" => 1.1, "Price" => 112.00, "ListPrice" => 128.00, "WholesalePrice"=> 100.00, "DateAvailable" => "2009-12-01", "Manufacturer" => "Prentice Hall", "Type" => "Unknown", "MinQuantity" =>0, "ImageURL" => "http://acme.com/prodimg/123123.jpg", "URL" => "http:/acme.com/prod/123123.html" ); $ProductRefNum = $client->addProduct($token, $Product); print_r($res); } catch(SoapFault $e) { echo $e->getMessage(); } ?> ``` -------------------------------- ### runQuickCredit PHP Example Source: https://help.usaepay.info/developer/soap-api/methods/runquickcredit Demonstrates executing a quick credit transaction using the PHP SOAP client. Requires a pre-configured $client and $token. ```php 4.00, "Invoice"=>1234, "Description"=>"Test Transaction", "PONum"=>"", "OrderID"=>1234, "Tax"=>0, "Tip"=>0, "NonTax"=>false, "Shipping"=>0, "Discount"=>0, "Subtotal"=>4.00 ); print_r($client->runQuickCredit($token,$refnum, $details)); } catch(SoapFault $e) { echo $e->getMessage(); echo "\n\nRequest: " . $client->__getLastRequest(); echo "\n\nResponse: " . $client->__getLastResponse(); } ?> ``` -------------------------------- ### Initialize and Configure MerchantApplication in Java Source: https://help.usaepay.info/developer/soap-api/boarding/objects/merchantapplication Demonstrates how to instantiate the MerchantApplication object and populate its fields including billing, contact, and platform-specific data. ```java MerchantApplication merchantapp = new MerchantApplication(); merchantapp.setApplicationNotes("Application notes"); BillingInfo billing = new BillingInfo(); billing.setBankName("Example Bank"); billing.setRoutingNumber("123456789"); billing.setAccountNumber("910293112"); billing.setGatewayPackage("Silver Package"); merchantapp.setBillingInfo(billing); merchantapp.setCallInPassword("1234"); ContactInfo contactinfo = new ContactInfo(); contactinfo.setContact("John Doe"); contactinfo.setStreet("4929 Wilshire Blvd"); contactinfo.setStreet2("Suite 899"); contactinfo.setCity("Los Angeles"); contactinfo.setState("CA"); contactinfo.setZip("90010"); contactinfo.setCountry("US"); contactinfo.setEmail("merchant@tmcode.com"); contactinfo.setAltEmail("merchant@tmcode.com"); contactinfo.setPhone("222-333-4446"); contactinfo.setMobilePhone("222-333-4445"); contactinfo.setFax("222-333-4444"); contactinfo.setURL("http://www.acme.org"); merchantapp.setContactInfo(https://help.usaepay.info/developer/soap-api/boarding/objects/contactinfo/); merchantapp.setCreditCardIndustry("eCommerce"); merchantapp.setCreditCardPlatform("FDMS"); FieldValueArray platformdata = new FieldValueArray(); platformdata.add(new FieldValue("MerchantNum","2334566356345")); platformdata.add(new FieldValue("MerchantID","1231230")); platformdata.add(new FieldValue("TerminalID","1231239")); merchantapp.setCreditCardPlatformSetup(platformdata); merchantapp.setECheckPlatform("Vericheck"); FieldValueArray checkplatform = new FieldValueArray(); checkplatform.add(new FieldValue("DefaultSEC","TEL")); checkplatform.add(new FieldValue("TaxID","123456789")); checkplatform.add(new FieldValue("PIN","231")); checkplatform.add(new FieldValue("MID","11231")); checkplatform.add(new FieldValue("AcceptedSecCodes","TEL,PPD,CCD")); merchantapp.setECheckPlatformSetup(checkplatform); merchantapp.setEmailInstructionsTo("merchant@tmcode.com"); merchantapp.setEmailSourceKeyTo("merchant@tmcode.com"); merchantapp.setMerchantName("Example Company"); merchantapp.setResellerEmail("reselller@tmcode.com"); merchantapp.setSourceKeyName("ShoppingCart"); merchantapp.setSourceKeyPin("1234"); merchantapp.setUserName("jdoe23"); ``` -------------------------------- ### Java Implementation for createBatchUpload Source: https://help.usaepay.info/developer/soap-api/methods/createbatchupload Example using the USAePay Java library to perform a batch upload. Ensure the JAX-WS library is installed and the client/token objects are initialized before use. ```java try { // Create request object String FileName = "ExampleFile.csv"; String Format = "csv"; String Encoding = "base64"; StringArray Fields = new StringArray(); Fields.add("invoice"); Fields.add("cardholder"); Fields.add("avsstreet"); Fields.add("avszip"); Fields.add("ccnum"); Fields.add("ccexp"); Fields.add("amount"); String RawData = "12345,John Doe,1234 Test St,54321,4000100011112224,1012,1.23\n54321,Joe Test,4321 Example St,12345,4000100111112223,0313,12.34"; BASE64Encoder encoder = new BASE64Encoder(); String Data = encoder.encodeBuffer(RawData.getBytes()); boolean AutoStart = true; boolean OverrideDuplicates = true; // Create response object BatchUploadStatus response; response = client.createBatchUpload(token, FileName,AutoStart,Format,Encoding,Fields,Data,OverrideDuplicates); } catch (Exception e) { System.out.println("Soap Exception: " + e.getMessage()); } ``` -------------------------------- ### Execute Transaction in Java Source: https://help.usaepay.info/developer/soap-api/methods/runtransaction Utilizes the USAePay Java library to populate transaction objects and execute the request. Requires prior installation of the library and setup of token/client objects. ```java try { TransactionRequestObject params = new TransactionRequestObject(); // set card holder name params.setAccountHolder("Test Joe"); params.setCommand("Sale"); // populate transaction details TransactionDetail details = new TransactionDetail(); details.setAmount(22.34); details.setDescription("My Test Sale"); details.setInvoice("119891"); params.setDetails(details); // populate credit card data CreditCardData ccdata = new CreditCardData(); ccdata.setCardNumber("4444555566667779"); ccdata.setCardExpiration("0919"); ccdata.setCardCode("999"); params.setCreditCardData(ccdata); // Create request object RunTransaction request = new RunTransaction(); request.setToken(token); // Create response object TransactionResponse response; // run transaction response = client.runTransaction(token, params); System.out.println("Result: " + response.getResult()); } catch (Exception e) { System.out.println("Soap Exception: " + e.getMessage()); } ``` -------------------------------- ### runQuickSale C# Implementation Source: https://help.usaepay.info/developer/soap-api/methods/runquicksale Shows how to execute a quick sale in C# using the SOAP service reference. ```csharp usaepay.TransactionDetail details = new usaepay.TransactionDetail(); string refnum; bool authonly; refnum = "46973415"; authonly = false; details.Amount = 34.50; details.AmountSpecified = true; details.Description = "Example QuickSale"; details.Invoice = "123456"; usaepay.TransactionResponse response = new usaepay.TransactionResponse(); try { response = client.runQuickSale(token, refnum, details, authonly); if (response.ResultCode == "A") { MessageBox.Show(string.Concat("Transaction Approved, RefNum: ", response.RefNum)); } else { MessageBox.Show(string.Concat("Transaction Failed: ", response.Error)); } } catch (Exception err) { MessageBox.Show(err.Message); } ``` -------------------------------- ### emailTransactionReceiptByName .NET C# Example Source: https://help.usaepay.info/developer/soap-api/methods/emailtransactionreceiptbyname Sends a transaction receipt using the .NET SOAP client in C#. Requires prior setup of the WSDL link and client variables. ```csharp string refnum; refnum = "46973419"; Boolean result; try { result = client.emailTransactionReceiptByName(token, refnum, "recurring", "email@yourdomain.com"); if (result) { MessageBox.Show(string.Concat("Email is sent")); } else MessageBox.Show("Error"); } catch (Exception err) { MessageBox.Show(err.Message); } ``` -------------------------------- ### Run Check Credit in .NET C# Source: https://help.usaepay.info/developer/soap-api/methods/runcheckcredit Requires prior setup of WSDL link, token, and client variables as described in the C# .NET SOAP How-to guide. ```csharp usaepay.TransactionRequestObject tran = new usaepay.TransactionRequestObject(); tran.Details = new usaepay.TransactionDetail(); tran.Details.Amount = 1.00; tran.Details.AmountSpecified = true; tran.Details.Invoice = "1234"; tran.Details.Description = "Sample Check Credit"; tran.CheckData = new usaepay.CheckData(); tran.CheckData.Account = "1112223333"; tran.CheckData.Routing = "123456789"; tran.CheckData.DriversLicense = "D5555555"; tran.CheckData.DriversLicenseState = "CA"; tran.AccountHolder = "Test Guy"; usaepay.TransactionResponse response = new usaepay.TransactionResponse(); try { response = client.runCheckCredit(token, tran); if (response.ResultCode == "A") { MessageBox.Show(string.Concat("Transaction Approved, RefNum: ", response.RefNum)); } else { MessageBox.Show(string.Concat("Transaction Failed: ", response.Error)); } } catch (Exception err) { MessageBox.Show(err.Message); } ``` -------------------------------- ### Capture Transaction Java Implementation Source: https://help.usaepay.info/developer/soap-api/methods/capturetransaction Example using the USAePay Java library to capture a transaction. Ensure the library is installed and the client/token objects are initialized as per the JAX-WS Howto. ```java try { //Setting RefNum from the original transaction BigInteger RefNum = new BigInteger('12345678'); //Setting Amount to capture Double Amount = new Double(12.34); //Create Transaction Response TransactionResponse Response; Response = client.captureTransaction(token,RefNum,Amount); } catch (Exception e) { System.out.println("Soap Exception: " + e.getMessage()); } ``` -------------------------------- ### Initialize C SDK and Network Settings Source: https://help.usaepay.info/developer/sdks/c Configures SSL verification, non-blocking communication, logging callbacks, and network timeouts. ```c HTSSL_verifyDepth_set (2); //Be careful of the following init statement. If set to YES it could //initiate a blocking session. Currently it is set to NO to have a //non-blocking https communication. If you have problems receiving a //response from the server, you may want to try setting the value to YES. HTSSLhttps_init(NO); /* Need your own trace and print functions */ HTPrint_setCallback(printer); HTTrace_setCallback(tracer); /* Get trace messages, change the 0 to 1 to see more detailed trace message*/ #if 0 HTSetTraceMessageMask("sop"); #endif /* Add our own filter to update the history list */ HTNet_addAfter(terminate_handler, NULL, NULL, HT_ALL, HT_FILTER_LAST); /* Set the timeout to how long we will wait for a response */ HTHost_setEventTimeout(10000); ``` -------------------------------- ### Add Customer using .NET VB Source: https://help.usaepay.info/developer/soap-api/methods/addcustomer Demonstrates configuring a customer object and calling the addCustomer method in VB.NET. ```vbnet Dim customer As usaepay.CustomerObject = New usaepay.CustomerObject Dim address As usaepay.Address = New usaepay.Address address.FirstName = "John" address.LastName = "Doe" address.Company = "Acme" address.Street = "123 main st." address.City = "Hollywood" address.State = "ca" address.Zip = "91607" address.Country = "USA" customer.BillingAddress = address customer.Enabled = True customer.Amount = 5.0 customer.Next = "2010-08-15" customer.Schedule = "monthly" Dim payMethod(0) As usaepay.PaymentMethod payMethod(0) = New usaepay.PaymentMethod payMethod(0).CardExpiration = "1212" payMethod(0).CardNumber = "4444555566667779" payMethod(0).AvsStreet = "123 Main st." payMethod(0).AvsZip = "90046" payMethod(0).MethodName = "My Visa" customer.PaymentMethods = payMethod Dim response As String response = client.addCustomer(token, customer) MsgBox(String.Concat(response)) ``` -------------------------------- ### getMerchantSummary VB.NET Example Source: https://help.usaepay.info/developer/soap-api/boarding/methods/getmerchantsummary Retrieves merchant summary data using VB.NET. Requires prior setup of the token and client objects as described in the Visual Basic .Net Soap How-to. ```vbnet Dim MerchRefNum = 123456 Dim StartDate = "2011-05-01" Dim EndDate = "2011-05-31" Dim Summary As resellerapi.MerchantSummary Try Summary = client.getMerchantSummary(token, MerchRefNum, StartDate, EndDate) MsgBox("Sales Count: " & Summary.SalesCount) Catch ex As Exception MsgBox("Exception: " & ex.Message) End Try ``` -------------------------------- ### runTransactionAPI SOAP Response Example Source: https://help.usaepay.info/developer/soap-api/methods/runtransactionapi Example of a successful transaction response in XML format. ```xml 3.51 037497 Address: Match & 5 Digit Zip: Match YYY 1 9597 No Match N Visa Traditional A 0 0 840 0 Approved 0 false 100106558 Approved A Pending P ``` -------------------------------- ### searchProductsCount in .NET VB Source: https://help.usaepay.info/developer/soap-api/methods/searchproductscount Example demonstrating how to initialize search parameters and retrieve the product count using VB.NET. ```vbnet Dim MatchAll As Boolean MatchAll = False Dim searchParams(1) As usaepay.SearchParam searchParams(0) = New usaepay.SearchParam searchParams(0).Field = "Created" searchParams(0).Type = "gt" searchParams(0).Value = "2010-09-07" Dim SearchResults As usaepay.ProductSearchResult = New usaepay.ProductSearchResult SearchResults = client.searchProductsCount(token, searchParams, MatchAll, 0, 1000, "created") MsgBox(SearchResults.ProductsMatched) ``` -------------------------------- ### moveCustomer .NET C# Example Source: https://help.usaepay.info/developer/soap-api/methods/movecustomer Shows the implementation of moveCustomer in C# including token and hash generation. ```csharp usaepay.ueSecurityToken totoken = new usaepay.ueSecurityToken(); usaepay.ueHash hash = new usaepay.ueHash(); string sourcekey = "NEW SOURCE KEY"; string pin = "new pin"; totoken.SourceKey = sourcekey; hash.Type = "md5"; hash.Seed = Guid.NewGuid().ToString(); string prehashvalue = string.Concat(token.SourceKey, hash.Seed, pin); hash.HashValue = GenerateHash(prehashvalue); totoken.PinHash = hash; string CustNum = "89147"; string NewCust; try { NewCust = client.moveCustomer(token, CustNum, totoken); MessageBox.Show(string.Concat(NewCust)); } catch (Exception err) { MessageBox.Show(err.Message); } ``` -------------------------------- ### runQuickCredit implementation in C# Source: https://help.usaepay.info/developer/soap-api/methods/runquickcredit Demonstrates how to configure transaction details and handle the response from the runQuickCredit method. Requires pre-configured token and client variables. ```csharp usaepay.TransactionDetail details = new usaepay.TransactionDetail(); string refnum; refnum = "46973415"; details.Amount = 34.50; details.AmountSpecified = true; details.Description = "Example QuickCredit"; details.Invoice = "123456"; usaepay.TransactionResponse response = new usaepay.TransactionResponse(); try { response = client.runQuickCredit(token, refnum, details); if (response.ResultCode == "A") { MessageBox.Show(string.Concat("Transaction Approved, RefNum: ", response.RefNum)); } else { MessageBox.Show(string.Concat("Transaction Failed: ", response.Error)); } } catch (Exception err) { MessageBox.Show(err.Message); } ``` -------------------------------- ### Search Products in Coldfusion Source: https://help.usaepay.info/developer/soap-api/methods/searchproducts Example of invoking the SOAP web service in Coldfusion. Note that this example is provided as-is and is untested. ```coldfusion Start = 0; Limit = 10; MatchAll=1; Sort='created'; Search=ArrayNew(1); Search[1]=structnew(); Search[1].Field='created'; Search[1].Type='gt'; Search[1].Value='2006-09-01'; ws = createObject("webservice", "https://www.usaepay.com/soap/gate/3213EA2A/usaepay.wsdl"); Output = ws.searchTransactions(Token, Search, MatchAll, Start, Limit, Sort); ``` -------------------------------- ### Implement Basic ueForm Source: https://help.usaepay.info/developer/sdks/jquery Standard implementation using default input names for address, zip, ccnum, cvv2, and expdate. ```html
Address: Zip: Credit Card Number: cvv2: Exp Date:
```