developer:soap-1.1:methods:runsale

runSale

Run a new sale transaction.

Description

This method is equivalent to running the runTransaction method with the Command set to “Sale.”

It will run a transaction charging a customer's credit card or checking account for the desired amount. If a mistake is made or a refund must be given you can use either the voidTransaction or runCredit method.

If the sale is for a customer whose information has been stored, you may use the runQuickSale method to avoid having to reenter all of the customer's information.

See also runTransaction, runQuickSale, voidTransaction, runCredit, runAuthOnly

Syntax

Arguments

Type Name Description
ueSecurityToken Token Merchant security token: used to identify merchant and validate transaction.
TransactionRequestObject Params Transaction details from all fields of the transaction form, including reference number, transaction amount, customer ID, currency, authorization code, and any other information entered at the time of the transaction.

Return Value

TransactionResponse Returns a TransactionResponse object containing the results of the transaction and all relevant data.

Examples

PHP

For directions on how to set up the WSDL link, create “$token” and “$client”, go to SOAP PHP How-to.

<?php
 
try {
 
  $Request=array(
    'AccountHolder' => 'Tester Jones',
    'Details' => array(
      'Description' => 'Example Transaction',
      'Amount' => '4.00',
      'Invoice' => '44539'
      ),
    'CreditCardData' => array(
      'CardNumber' => '4444555566667779',
      'CardExpiration' => '0909',
      'AvsStreet' => '1234 Main Street',
      'AvsZip' => '99281',
      'CardCode' => '999'
      )
    );
 
  $res=$client->runSale($token, $Request);
 
}  
 
catch (SoapFault $e)  {
  echo $client->__getLastRequest();
  echo $client->__getLastResponse();
  die("QuickSale failed :" .$e->getMessage());
  }
 
?> 

VB.NET

For directions on how to set up the WSDL link, create “token” and “client”, go to Visual Basic .Net Soap How-to.

        Dim tran As usaepay.TransactionRequestObject = New usaepay.TransactionRequestObject
 
        tran.CreditCardData = New usaepay.CreditCardData
        tran.CreditCardData.CardNumber = "4444555566667779"
        tran.CreditCardData.CardExpiration = "0913"
        tran.CreditCardData.CardCode = "999"
 
        tran.Details = New usaepay.TransactionDetail
        tran.Details.Amount = 9.02
        tran.Details.AmountSpecified = True
        tran.Details.Invoice = "434534"
        tran.Details.Description = "Example transaction"
 
        Dim response As usaepay.TransactionResponse
 
        response = client.runSale(token, tran)
 
        If response.ResultCode = "A" Then
            MsgBox("Transaction Approved, Refernce Number: " & response.RefNum)
        ElseIf response.ResultCode = "D" Then
            MsgBox("Transaction Declined, Reason: " & response.Error)
        Else
            MsgBox("Transaction Error, Reason: " & response.Error)
        End If

.NET C#

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 = "Example Transaction";
 
            tran.CreditCardData = new usaepay.CreditCardData();
            tran.CreditCardData.CardPresent = true;
            tran.CreditCardData.MagStripe = "%B5102531111111118^FDCS/TEST CHECK CARD^10111011234567   440?;5102531111111118=10111011234567440?";
 
            usaepay.TransactionResponse response = new usaepay.TransactionResponse();
 
            try
            {
                response = client.runTransaction(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);
            }

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:runSale>
<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">0cdd25e0035987e3f1f468027d269db9be939a51</HashValue>
<Seed xsi:type="xsd:string">1193442346579637515</Seed>
<Type xsi:type="xsd:string">sha1</Type>
</PinHash>
<SourceKey xsi:type="xsd:string">HB4P7C4K2w2ZCQQQXRqrxDj6agrS2NIT</SourceKey>
</Token>
<Params 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">999</CardCode>
<CardExpiration xsi:type="xsd:string">0909</CardExpiration>
<CardNumber xsi:type="xsd:string">4444555566667779</CardNumber>
</CreditCardData>
<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>
</Params>
</ns1:runSale>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
developer/soap-1.1/methods/runsale.txt · Last modified: 2010/09/29 13:11 by irina

Page Tools