Apple Pay provides a secure and easy method to accept and process payments directly from customers using the new Apple devices with the new built-in NFC technology. USAePay enables merchants and developers with the proper tools and documentation to accept payments made from Apple Pay.
USAePay’s developer-friendly libraries, SDK’s, and API’s are ready today to support transactions using Apple Pay. Businesses can now process transactions from Apple devices supporting Apple Pay using their existing USAePay Payment Gateway account. Get the full API (available in multiple languages) and test it. Once you have added the code, you are ready to accept payments on all devices through Apple Pay.
Note: Merchants will only be able to view the device account number and not the credit card number
For help in implementing java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javaproject1.pkg6;
import com.usaepay.api.jaxws.*;
/**
*
* @author ysamoilovski
*/
public class RunSale {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
try {
//Set server timeout in milliseconds
int timeOut = 20000;
// instantiate client connection object, select www.usaepay.com
// as the endpoint. Use sandbox.usaepay.com if connecting to
// the sandbox server.
//UeSoapServerPortType client = usaepay.getClient("sandbox.usaepay.com");
UeSoapServerPortType client = usaepay.getClient("sandbox.usaepay.com", timeOut);
// Instantiate security token object (need by all soap methods)
UeSecurityToken token = usaepay.getToken(
"4vGyuxiNP986b2P8P5M6HG45PDBHUP5P", // source key
"JFZsLg", // source pin (if assigned by merchant)
"192.169.21.22" // IP address of end client (if applicable)
);
// instantiate TransactionRequestObject
TransactionRequestObject params = new TransactionRequestObject();
// set card holder name
params.setAccountHolder("Test Joe");
params.setClientIP("123.123.22.22");
// instantiate and populate transaction details
TransactionDetail details = new TransactionDetail();
details.setAmount(22.34);
details.setDescription("My Test Sale");
details.setInvoice("119891");
params.setDetails(details);
// instantiate and populate credit card data
CreditCardData ccdata = new CreditCardData();
ccdata.setCardNumber("");
ccdata.setCardExpiration("");
ccdata.setCardPresent(Boolean.TRUE);
ccdata.setMagStripe("B5261********6569^ /^1805201000296377928000000000004?;5261********6569=18052010002981179284?gY");
ccdata.setSignature("iVBORw0KGgoAAAANSUhEUgAAAPoAAACMCAYAAABVl7ThAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACfSURBVHhe7cExAQAAAMKg9U9tBn8gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4FADI4oAAaMDlAUAAAAASUVORK5CYII");
ccdata.setTermType("POS");
params.setCreditCardData(ccdata);
FieldValueArray FieldArray = new FieldValueArray();
FieldValue field1 = new FieldValue();
field1.setField("UMcontactless");
field1.setValue("yes");
FieldArray.getFieldValue().add(field1);
params.setCustomFields(FieldArray);
// instantiate and populate LineItem
LineItemArray itemArray = new LineItemArray();
LineItem item1 = new LineItem();
item1.setProductName("test");
item1.setDescription("testdesc");
item1.setSKU("4214124");
item1.setUnitPrice("2");
item1.setQty("5");
itemArray.getItem().add(item1);
LineItem item2 = new LineItem();
item2.setProductName("test2");
item2.setDescription("testdesc2");
item2.setSKU("5326236");
item2.setUnitPrice("3");
item2.setQty("5");
itemArray.getItem().add(item2);
params.setLineItems(itemArray);
// Create response object
TransactionResponse response;
// run sale
response = client.runSale(token, params);
// Display response
System.out.println("Response: " + response.getResult() + " RefNum: " + response.getRefNum() + " Error: " + response.getError() + "code:" + response.getErrorCode());
} catch (Exception e) {
System.out.println("Soap Exception: " + e.getMessage());
}
}
}
To install using Php
// Creating a ueSecurityToken
// generate random seed value
$seed=mktime() . rand();
// make hash value using sha1 function
$clear= "4vGyuxiNP986b2P8P5M6HG45PDBHUP5P" . $seed . "JFZsLg";
$hash=sha1($clear);
// assembly ueSecurityToken as an array (php5 will correct the type for us)
$token=array(
'SourceKey'=>"4vGyuxiNP986b2P8P5M6HG45PDBHUP5P", // Live test soruce key
'PinHash'=>array(
'Type'=>'sha1',
'Seed'=>$seed,
'HashValue'=>$hash
),
'ClientIP'=>'192.168.0.1'
);
$wsdl='https://sandbox.usaepay.com/soap/gate/DB5D75B8/usaepay.wsdl';//Sandbox Server
//$wsdl='https://www.usaepay.com/soap/gate/DB5D75B8/usaepay.wsdl';//Live Server
$client= new SoapClient($wsdl, array("trace"=>1,"exceptions"=>1));
try {
$Request=array(
'AccountHolder' => 'Tester Jones',
'Details' => array(
'Description' => 'Example Transaction',
'Amount' => '4.00',
'Invoice' => '44539'
),
'CreditCardData' => array(
'CardNumber' => '',
'CardExpiration' => '',
'MagStripe' => 'B5261********6569^ /^1805201000296377928000000000004?;5261********6569=18052010002981179284?gY',
'CardPresent' => 'true',
'Signature' => 'iVBORw0KGgoAAAANSUhEUgAAAPoAAACMCAYAAABVl7ThAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACfSURBVHhe7cExAQAAAMKg9U9tBn8gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4FADI4oAAaMDlAUAAAAASUVORK5CYII',
"TermType" => "POS",
'AvsStreet' => '1234 Main Street',
'AvsZip' => '99281',
'CardCode' => ''
),
'CustomFields' =>array(
array('Field'=>'UMcontactless', 'Value'=>'yes'),
)
);
$res=$client->runTransaction($token, $Request);
print_r($res);
}
catch (SoapFault $e){
echo $client->__getLastRequest();
echo $client->__getLastResponse();
die("runTransaction failed :" .$e->getMessage());
}
For help in implementing php
<?php
include ("./usaepay.php"); // Change this path to the location you have save usaepay.php
$tran=new umTransaction;
$tran->key="4vGyuxiNP986b2P8P5M6HG45PDBHUP5P"; // Your Source Key
$tran->pin="JFZsLg"; // Source Key Pin
$tran->usesandbox=true; // Sandbox true/false
/*$tran->key="3oN38wSFUfE8BbrsJXLDF0NbxLCBAebJ"; // Your Source Key
$tran->pin="115271"; // Source Key Pin
$tran->usesandbox=false; // Sandbox true/false*/
$tran->ip=$REMOTE_ADDR; // This allows fraud blocking on the customers ip address
$tran->testmode=0; // Change this to 0 for the transaction to process
$tran->command="cc:sale"; // Command to run; Possible values are: cc:sale, cc:authonly, cc:capture, cc:credit, cc:postauth, check:sale, check:credit, void, refund and creditvoid Default is cc:sale.
$tran->card=""; // card number, no dashes, no spaces
$tran->exp=""; // expiration date 4 digits no
$tran->contactless="yes"; //Set “UMcontactless” to “yes”, whenever we are doing apple pay transaction
$tran->magstripe="B5261********6569^ /^1805201000296377928000000000004?;5261********6569=18052010002981179284?gY"; // Assign apple pay's raw data values to “UMmagstripe” field without the “enc:/ /”
$tran->cardpresent="true"; // Set UMcardpresent=true to enable card present mode. If UMmagstripe is sent, UMcardpresent will be automatically set to true.
$tran->termtype="POS"; // The type of terminal being used: POS (cash register), contactless, StandAlone (self service terminal), Unattended (ie gas pump) Unkown (defaults to Unknown)
$tran->signature="iVBORw0KGgoAAAANSUhEUgAAAPoAAACMCAYAAABVl7ThAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACfSURBVHhe7cExAQAAAMKg9U9tBn8gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4FADI4oAAaMDlAUAAAAASUVORK5CYII"; // Cardholder signature captured by pos device. Base64 encoded.
$tran->amount="1.00"; // charge amount in dollars
$tran->invoice="1234"; // invoice number. must be unique.
$tran->cardholder="Test T Jones"; // name of card holder
$tran->street="1234 Main Street"; // street address
$tran->zip="05673"; // zip code
$tran->description="Online Order"; // description of charge
$tran->cvv2="123"; // cvv2 code
$tran->website="test.com";
echo "<h1>Please wait one moment while we process your card...<br>n";
flush();
if($tran->Process())
{
echo "<b>Card Approved</b><br>";
echo "<b>Authcode:</b> " . $tran->authcode . "<br>";
echo "<b>CardRef:</b> " . $tran->refnum . "<br>";
echo "<b>AVS Result:</b> " . $tran->avs_result . "<br>";
echo "<b>Cvv2 Result:</b> " . $tran->cvv2_result . "<br>";
} else {
echo "<b>Card Declined</b> (" . $tran->result . ")<br>";
echo "<b>Reason:</b> " . $tran->error . "<br>";
if(@$tran->curlerror) echo "<b>Curl Error:</b> " . $tran->curlerror . "<br>";
}
?>
For help in implementing using xml
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:usaepay" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:runTransaction>
<Token xsi:type="ns1:ueSecurityToken">
<ClientIP xsi:type="xsd:string">192.168.0.1</ClientIP>
<PinHash xsi:type="ns1:ueHash">
<HashValue xsi:type="xsd:string">dee72ceadc13e68951122730ac3b43713a010cd9</HashValue>
<Seed xsi:type="xsd:string">1435082194864672641</Seed>
<Type xsi:type="xsd:string">sha1</Type>
</PinHash>
<SourceKey xsi:type="xsd:string">4vGyuxiNP986b2P8P5M6HG45PDBHUP5P</SourceKey>
</Token>
<Parameters xsi:type="ns1:TransactionRequestObject">
<AccountHolder xsi:type="xsd:string">Tester Jones</AccountHolder>
<CreditCardData xsi:type="ns1:CreditCardData">
<AvsStreet xsi:type="xsd:string">1234 Main Street</AvsStreet>
<AvsZip xsi:type="xsd:string">99281</AvsZip>
<CardCode xsi:type="xsd:string"></CardCode>
<CardExpiration xsi:type="xsd:string"></CardExpiration>
<CardNumber xsi:type="xsd:string"></CardNumber>
<CardPresent xsi:type="xsd:boolean">true</CardPresent>
<MagStripe xsi:type="xsd:string">B5261********6569^ /^1805201000296377928000000000004?;5261********6569=18052010002981179284?gY</MagStripe>
<Signature xsi:type="xsd:string">iVBORw0KGgoAAAANSUhEUgAAAPoAAACMCAYAAABVl7ThAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACfSURBVHhe7cExAQAAAMKg9U9tBn8gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4FADI4oAAaMDlAUAAAAASUVORK5CYII</Signature>
<TermType xsi:type="xsd:string">POS</TermType>
</CreditCardData>
<CustomFields SOAP-ENC:arrayType="ns1:FieldValue[1]" xsi:type="ns1:FieldValueArray">
<item xsi:type="ns1:FieldValue">
<Field xsi:type="xsd:string">UMcontactless</Field>
<Value xsi:type="xsd:string">yes</Value>
</item>
</CustomFields>
<Details xsi:type="ns1:TransactionDetail">
<Amount xsi:type="xsd:double">4</Amount>
<Description xsi:type="xsd:string">Example Transaction</Description>
<Invoice xsi:type="xsd:string">44539</Invoice>
</Details>
</Parameters>
</ns1:runTransaction>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>