getReceiptByName

Retrieve a receipt template identified by Name.

Description

This method allows you to retrieve the receipt template identified by Name. This method will return the merchant's receipt template if it exists. Otherwise, if a system default template exists for "Name" it will be returned. If a system default is returned, the ReceiptRefNum in the resulting object will be "0".

If successful this method will return a Receipt object. If receipt is not found and exception will be thrown.

See also addReceipt, updateReceipt and getReceipt

Syntax

Receipt getReceiptByName ( ueSecurityToken, Name)

Arguments

Type Name Description
ueSecurityToken Token Merchant security token: used to identify merchant and retrieve the custom fields.
string Name Name of receipt

Return Value

Name Description
Receipt Returns a Receipt object for the requested receipt.

Exceptions

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

Code Message Advice
20030 Requested receipt not found No receipts were matched using Name.

Examples

PHP

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

    <?php

    try {

      $Name = 'vterm';
      $res = $client->getReceiptByName($token, $Name);

      echo base64_decode($res->TemplateText);
    }

    catch(SoapFault $e) {

      echo $e->getMessage();

    }

    ?>

VB

For directions on how to set up the web reference and create "token" and "client" variables, go to the VB Soap How-to.


     Dim receipt As usaepay.Receipt
            Dim receiptName As String
            receiptName = "recurring"
            receipt = client.getReceiptByName(token, receiptName)
            MsgBox(receipt.ReceiptRefNum)

.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 name = "test receipt";

                try
                {
                    usaepay.Receipt receipt = client.getReceiptByName(token, name);
                    MessageBox.Show(string.Concat(receipt.ReceiptRefNum));

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

XML (RPC/Encoded)

Request:

    <?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:getReceiptByName>
    <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">49f57933fafb0b9724c501973a864fb65c46c312</HashValue>
    <Seed xsi:type="xsd:string">11888875680-test</Seed>
    <Type xsi:type="xsd:string">sha1</Type>
    </PinHash>
    <SourceKey xsi:type="xsd:string">_B4P7C4K2w2ZCQQQXRqrxDj6agrS2NIT</SourceKey>
    </Token>
    <Name xsi:type="xsd:string">ExampleReceipt</Name>
    </ns1:getReceiptByName>
    </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: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:getReceiptByNameResponse>
    <getReceiptByNameReturn xsi:type="ns1:Receipt">
    <ReceiptRefNum xsi:type="xsd:string">16</ReceiptRefNum>
    <Name xsi:type="xsd:string">ExampleReceipt</Name>
    <Subject xsi:type="xsd:string">Sample Cart Order # [Transaction.OrderID]</Subject>
    <FromEmail xsi:type="xsd:string">noreply@mysamplecart.com</FromEmail>
    <Target xsi:type="xsd:string">email</Target>
    <ContentType xsi:type="xsd:string">both</ContentType>
    <TemplateHTML xsi:type="xsd:string">ZXhhbXBsZSByZWNlaXB0ICBbVHJhbnNhY3Rpb24uQ3JlYXRlZF0=</TemplateHTML>
    <TemplateText xsi:type="xsd:string">cmVjZWlwdCBleGFtcGxlICBbVHJhbnNhY3Rpb24uQ3JlYXRlZF0=</TemplateText>
    </getReceiptByNameReturn>
    </ns1:getReceiptByNameResponse>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

Change History

Version Change
1.3 Method added in this release