updateReceipt

Parent Previous Next

updateReceipt

Update receipt template

 

Description

This method allows you to update an existing custom receipt template.

For more information about the template syntax and available fields, see the template documentation

For security reasons, the default templates can not be modified via this method.

If the receipt is updated successfully the ReceiptRefNum will be returned. If an error occurs, an exception will be thrown.

 

Syntax

integer updateReceipt ( ueSecurityToken, ReceiptRefNum, Receipt )

 

Arguments

 

Type

Name

Description

ueSecurityToken

Token

Merchant security token: used to identify merchant and retrieve the custom fields.

integer

ReceiptRefNum

Gateway assigned receipt ID

Receipt

Receipt

Receipt object containing receipt template data

 

Return Value

 

integer

Returns the gateway assigned ReceiptRefNum

 

Exceptions

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

Code

Message

Advice

20030

Requested receipt not found

ReceiptRefNum must match an existing receipt.

20031

Invalid content type

ContentType must be either Text, HTML or Both

20032

Invalid receipt target

Receipt Target must be either Email or Print

20033

Receipt name already used

Receipt template names must be unique

 

 

Examples

 

PHP

 

<?php

try {

 $ReceiptRefNum = 2;

 $Receipt = array(

   "Name" => "CartReceipt1",

   "Subject" => "Sample Cart Order # [Transaction.OrderID]",

   "TemplateHTML"=>base64_encode('Yippe skippy  [Transaction.Created]'),

   "TemplateText"=>base64_encode('Yippe skippy  [Transaction.Created]'),

   "ContentType" => 'both',

   "Target" => 'email',

   "FromEmail" => 'noreply@mysamplecart.com'

 );                

 $refnum = $client->updateReceipt($token, $ReceiptRefNum, $Receipt);

}

catch(SoapFault $e) {

 echo $e->getMessage();

}

?>

 

 

VB

 

Dim receiptNum As String

       receiptNum = "9"

       Dim receipt As eBizCharge.Receipt = New eBizCharge.Receipt

       receipt.Name = "test VB_receipt"

       receipt.Target = "email"

       receipt.Subject = "receipt"

       receipt.FromEmail = "devsupport@eBizCharge.com"

       receipt.ContentType = "text"

       Dim message As String

       message = "Yippy skippy"

       Dim toencode As Byte() = System.Text.ASCIIEncoding.ASCII.GetBytes(message)

       Dim returnValue As String

       returnValue = System.Convert.ToBase64String(toencode)

       receipt.TemplateText = returnValue

       Dim response As String

       response = client.updateReceipt(token, receiptNum, receipt)

       MsgBox(response)

 

 

.NET C#

 

           string receiptRefNum = "5";

           eBizCharge.Receipt receipt = new eBizCharge.Receipt();

           receipt.Name = "test two";

           receipt.FromEmail = "test@test.com";

           receipt.ContentType = "both";

           receipt.Target = "email";

           string message = "Yippy Skippy";

           byte[] toencodeAsBytes = System.Text.ASCIIEncoding.ASCII.GetBytes(message);

           string returnValue = System.Convert.ToBase64String(toencodeAsBytes);

           receipt.TemplateText = returnValue;

           string response;

           try

           {

               response = client.updateReceipt(token, receiptRefNum, receipt);

               MessageBox.Show(string.Concat(response));

           }

           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:eBizCharge" 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:updateReceipt>

 <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">11ac55b0a0b59f8f028dbf85bc32266fa973dd0e</HashValue>

<Seed xsi:type="xsd:string">12678150211876663375</Seed>

<Type xsi:type="xsd:string">sha1</Type>

</PinHash>

<SourceKey xsi:type="xsd:string">HB4P7C4K2w2ZCQQQXRqrxDj6agrS2NIT</SourceKey>

</Token>

 <ReceiptRefNum xsi:type="xsd:integer">73</ReceiptRefNum>

 <Receipt xsi:type="ns1:Receipt">

   <Name xsi:type="xsd:string">Example</Name>

   <Subject xsi:type="xsd:string">1561375697</Subject>

   <FromEmail xsi:type="xsd:string">test@test22.com</FromEmail>

   <Target xsi:type="xsd:string">email</Target>

   <ContentType xsi:type="xsd:string">both</ContentType>  

   <TemplateHTML xsi:type="xsd:string">WWlwcGUgc2tpcHB5ICBbVHJhbnNhY3Rpb24uQ3JlYXRlZF0=</TemplateHTML>

   <TemplateText xsi:type="xsd:string">WWlwcGUgc2tpcHB5ICBbVHJhbnNhY3Rpb24uQ3JlYXRlZF0=</TemplateText>

 </Receipt>

</ns1:updateReceipt>

</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:eBizCharge"

 xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"

 xmlns:xsd="http://www.w3.org/2001/XMLSchema"

 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

 SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

<SOAP-ENV:Body>

<ns1:updateReceiptResponse>

 <updateReceiptResponseReturn xsi:type="xsd:integer">32</updateReceiptResponseReturn>

</ns1:updateReceiptResponse>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

: