RenderReceipt

Description

The RenderReceipt method renders an HTML receipt template for a given transaction.

Syntax

string RenderReceipt(SecurityToken securityToken, string transactionRefNum, string receiptRefNum, string receiptName, string contentType)

Arguments

Type

Name

Req.

Description

SecurityToken

securityToken

R

A unique token that is used to identify a merchant and authenticate the API request.

string

transactionRefNum

R

Identifies the transaction to generate a receipt for.

Note: This is the RefNum value returned by runTransaction.

string

receiptRefNum

R

Identifies which receipt template use.

string

receiptName

O

Identifies which receipt template to use.

string

contentType

O

Not currently used.

Return Value

TypeDescription
stringOn success, returns an HTML base64-encoded receipt. Otherwise, a fault will be returned.

Example Request

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ebiz="http://eBizCharge.ServiceModel.SOAP">
   <soapenv:Header/>
   <soapenv:Body>
      <ebiz:RenderReceipt>
         <ebiz:securityToken>
            <ebiz:SecurityId>*************-4621-b899-************</ebiz:SecurityId>
            <ebiz:UserId/>
            <ebiz:Password/>
         </ebiz:securityToken>
         <ebiz:transactionRefNum>******6027</ebiz:transactionRefNum>
         <ebiz:receiptRefNum>115</ebiz:receiptRefNum>
         <ebiz:receiptName/>
      </ebiz:RenderReceipt>
   </soapenv:Body>
</soapenv:Envelope>
private static void RenderReceipt()
{
  IeBizService apiClient = new IeBizServiceClient();
  SecurityToken securityToken = new SecurityToken()
  {
    SecurityId = "*************-4970-ba92-************",
    UserId = "",
    Password = ""
    };
  string transactionRefNum = "*****1609";
  string receiptRefNum = "";
  string receiptName = "";
  string contentType = "";
  try
  {
    var receiptHtml = apiClient.RenderReceipt(securityToken, transactionRefNum, receiptRefNum, receiptName, contentType);
    Console.WriteLine(receiptHtml);
  }
  catch (Exception ex)
  {
    Console.WriteLine("An error occurred");
    Console.WriteLine($"Error message: {ex.Message}");
  }
}
// Initialize the SOAP client (replace with your actual endpoint URL)
$client = new SoapClient("https://ebizsoapapidev1.ebizcharge.net/eBizService.svc?singleWsdl");

// Define the merchant security token
$securityToken = array(
  'SecurityId' => '*************-4970-ba92-************' // Replace with your actual token
);

$transactionRefNum = "*****1609"; // Replace with actual transaction ref num
$receiptRefNum     = "";          
$receiptName       = "";          
$contentType       = "";          

$params = array(
  'securityToken'    => $securityToken,
  'transactionRefNum'=> $transactionRefNum,
  'receiptRefNum'    => $receiptRefNum,
  'receiptName'      => $receiptName,
  'contentType'      => $contentType,
);

try {
  $response = $client->RenderReceipt($params);

  // RenderReceipt typically returns a string (HTML or other content type)
  if (isset($response->RenderReceiptResult)) {
    $receiptHtml = $response->RenderReceiptResult;
  } else {
    // If the service returns just a plain string
    $receiptHtml = $response;
  }

  // Output HTML
  echo $receiptHtml . "\n";

} catch (SoapFault $e) {
  // Handle any SOAP errors
  echo "SOAP Error: " . $e->getMessage();
}

Example Response

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <RenderReceiptResponse xmlns="http://eBizCharge.ServiceModel.SOAP">
      <RenderReceiptResult>******************************sYW5nPSJlbiI+DQogICAgPGhlYWQ+DQogICAgICAgIDxtZXRhIGh0dHAtZXF1aXY9IkNvbnRlbnQtVHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PXV0Zi04IiAvPg0KICAgICAgICA8bWV0YSBuYW1lPSJ2aWV3cG9ydCINCiAgICA8L2JvZHk+DQo8L2h0bWw+</RenderReceiptResult>
    </RenderReceiptResponse>
  </s:Body>
</s:Envelope>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <s:Fault>
         <faultcode>s:Error</faultcode>
         <faultstring xml:lang="en-US">Error: Transaction not found</faultstring>
      </s:Fault>
   </s:Body>
</s:Envelope>