renderReceipt

Retrieve a receipt for a transaction

Description

This method allows you to render a receipt template for a given transaction.

RefNum refers to the gateway assigned transaction identifier. ReceiptRefNum refers to the gateway assigned ID for the receipt. ContentType refers to the type of receipt requested.

Returns base64 encode receipt. If an error occurs, an exception will be thrown.

See also renderReceiptByName

Syntax

string renderReceipt ( ueSecurityToken, RefNum, ReceiptRefNum, ContentType )

Arguments

Type Name Description
ueSecurityToken Token Merchant security token: used to identify merchant and retrieve the custom fields.
string RefNum Gateway assigned transaction ID
string ReceiptRefNum Gateway assigned receipt ID
string ContentType Format of receipt (HTML or Text)

Return Value

Type Description
string Returns base64 encoded receipt

Exceptions

The following exceptions (errors) are applicable to this method.

Code Message Advice
20001 Specified transactions was not found Specified RefNum does not match a transaction for this merchant.
20030 Requested receipt not found ReceiptRefNum must match an existing receipt.
20031 Invalid content type ContentType must be either Text, HTML or Both

Examples

PHP

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

    <?php

    try {
      $ReceiptRefNum = 2;
      $RefNum = 1102910;
      $receipt = $client->renderReceipt($token, $RefNum, $ReceiptRefNum, "HTML");
      $receipt = base64_decode($receipt);
    }

    catch(SoapFault $e) {

      echo $e->getMessage();

    }

    ?>

VB

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

    Dim receiptNum As String
            receiptNum = "6"
            Dim refNum As String
            refNum = "46981789"
            Dim contentType As String
            contentType = "text"
            Dim response As String
            response = client.renderReceipt(token, refNum, receiptNum, contentType)
            Dim todecode As Byte()
            todecode = Convert.FromBase64String(response)
            MsgBox(System.Text.Encoding.UTF8.GetString(todecode))

.NET C

For directions on how to set up the WSDL link and create the "token" and "client" variables, go to the C Sharp .Net Soap How-to.

                string refNum = "46981789";
                string receiptRefNum = "6";
                string ContentType = "text";
                string response;

                try
                {
                    response = client.renderReceipt(token, refNum, receiptRefNum, ContentType);
                    byte[] todecode = Convert.FromBase64String(response);
                    MessageBox.Show(string.Concat(System.Text.Encoding.UTF8.GetString(todecode)));

                }
                catch (Exception err)
                {
                    MessageBox.Show(err.Message);
                }

XML

Request:

    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:ns1="urn:newtek"
    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:renderReceipt>
    <Token xsi:type="ns1:ueSecurityToken">
    <ClientIP xsi:type="xsd:string">123.123.123.123</ClientIP>
    <PinHash xsi:type="ns1:ueHash">
    <HashValue xsi:type="xsd:string">166e37336e1c74e7e2ee9743d172b0e12c430e25</HashValue>
    <Seed xsi:type="xsd:string">11110502024-test</Seed>
    <Type xsi:type="xsd:string">sha1</Type>
    </PinHash>
    <SourceKey xsi:type="xsd:string">_B4P7C4K2w2ZCQQQXRqrxDj6agrS2NIT</SourceKey>
    </Token>
    <RefNum xsi:type="xsd:string">102303382</RefNum>
    <ReceiptRefNum xsi:type="xsd:string">4</ReceiptRefNum>
    <ContentType xsi:type="xsd:string">Text</ContentType>
    </ns1:renderReceipt>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

Response:

    <?xml version="1.0" encoding="utf-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:ns1="urn:newtek"
    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:renderReceiptResponse>
    <renderReceiptReturn xsi:type="xsd:string">VHJhbnNhY3Rpb24gUmVzdWx0DQotLS0tLS0t
    LS0tLS0tLS0tLS0tLS0tLQ0KRGF0ZTogICAgICAgICAgDQpSZXN1bHQ6ICAgICAgDQpSZWFzb246ICA
    gICAgICANCg0KDQpUcmFuc2FjdGlvbiBEZXRhaWxzDQotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KTW
    VyY2hhbnRzOiAgICBYTUwgZXhhbXBsZSBnZW5lcmF0b3INClR5cGU6ICAgICAgICBDcmVkaXQgQ2FyZ
    CBTYWxlDQpTb3VyY2U6ICAgICAgDQpJbnZvaWNlICM6ICAgDQpBbW91bnQ6ICAgICAgJA0KRGVzY3J
    pcHRpb246IA0KDQoNCkJpbGxpbmcgSW5mb3JtYXRpb24NCi0tLS0tLS0tLS0tLS0tLS0tLS0NCkN1c3
    RvbWVyIElEOiANCkZpcnN0IE5hbWU6IA0KTGFzdCBOYW1lOiAgDQpDb21wYW55OiAgICANClN0cmVld
    DogICAgIA0KU3RyZWV0MjogICAgDQpDaXR5OiAgICAgICANClN0YXRlOiAgICAgIA0KWmlwOiAgICAg
    ICAgDQpDb3VudHJ5OiAgICANClBob25lOiAgICAgIA0KRW1haWw6ICAgICAgDQoNClNoaXBwaW5nIEl
    uZm9ybWF0aW9uDQotLS0tLS0tLS0tLS0tLS0tLS0tLQ0KRmlyc3QgTmFtZTogDQpMYXN0IE5hbWU6IC
    ANCkNvbXBhbnk6ICAgIA0KU3RyZWV0OiAgICAgDQpTdHJlZXQyOiAgICANCkNpdHk6ICAgICAgIA0KU
    3RhdGU6ICAgICAgDQpaaXA6ICAgICAgICANCkNvdW50cnk6ICAgIA0KUGhvbmU6ICAgICAgDQoNCg0K
    DQoNCg0KDQp2OC4yLXVlLWctbQ==</renderReceiptReturn>
    </ns1:renderReceiptResponse>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

Change Log

Version Change
1.7 Changed ReceiptRefNum to type string