emailTransactionReceipt
Emails a new receipt for an existing customer. Requires a custom receipt to be selected by id
Description
This method allows you to email a new receipt for a existing transaction. This requires a receipt reference number, a transaction reference number and a valid email address. Receipt reference numbers are returned by addReceipt, getReceipts and can be found in the merchant console on the receipts edit page. Transaction reference numbers can be found in the transactionResponse or retrieved with searchTransactionsCustom.
Default receipts cannot be sent with this method. To send a default receipt please use emailTransactionReceiptByName.
See also addReceipt, updateReceipt, getReceipt, emailTransactionReceiptByName
Syntax
boolean emailTransactionReceipt ueSecurityToken, TransactionRefNum, ReceiptRefNum, EmailAddress
Arguments
Type | Name | Description |
---|---|---|
ueSecurityToken | Token | Merchant security token: used to identify merchant and retrieve the custom fields. |
String | RefNum | Unique transaction reference number assigned by the gateway. You can also use TransKey in the RefNum field. |
String | ReceiptRefNum | Gateway assigned ID of Receipt. |
String | EmailAddress | The email address you want to send the receipt to. |
Return Value
Type | Description |
---|---|
boolean | Indicates if the receipt sent successfully |
Exceptions
The following exceptions (errors) are applicable to this method.
Code | Message | Advice |
---|---|---|
20001 | Specified transactions was not found. | TransactionRefNum did not match a Transaction in the merchants account. |
20030 | Requested receipt not found | ReceiptRefNum did not match any of the merchants receipts |
Examples
PHP
For directions on how to set up the WSDL link, create "$token" and "$client", go to PHP Soap How-to.
<?php
try {
$TransactionRefNum=123456789;
$ReceiptRefNum=12;
$sent = $this->client->emailTransactionReceipt($this->token, $TransactionRefNum, $ReceiptRefNum,'email@address.com');
}
catch(SoapFault $e) {
echo $e->getMessage();
}
?>
.NET VB
Dim refnum As String
refnum = "46973419"
Dim receipt As String
receipt = "2"
Dim result As Boolean
result = client.emailTransactionReceipt(token, refnum, receipt, "email@mycompany.com")
MsgBox(result)
.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;
refnum = "46973419";
string receipt = "2";
Boolean result;
try
{
result = client.emailTransactionReceipt(token, refnum, receipt, "email@mycompany.com");
if (result)
{
MessageBox.Show(string.Concat("Email is sent"));
}
else MessageBox.Show("Error");
}
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:emailTransactionReceiptByName>
<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">18c29d3187820add5a29f486986c890e26c42f2b</HashValue>
<Seed xsi:type="xsd:string">194943674-test</Seed>
<Type xsi:type="xsd:string">sha1</Type>
</PinHash>
<SourceKey xsi:type="xsd:string">_B4P7C4K2w2ZCQQQXRqrxDj6agrS2NIT</SourceKey>
</Token>
<RefNum xsi:type="xsd:string">102299266</RefNum>
<ReceiptName xsi:type="xsd:string">vterm</ReceiptName>
<Email xsi:type="xsd:string">bbb11@yahoo.com</Email>
</ns1:emailTransactionReceiptByName>
</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:emailTransactionReceiptByNameResponse>
<emailTransactionReceiptByNameReturn
xsi:type="xsd:boolean">true</emailTransactionReceiptByNameReturn>
</ns1:emailTransactionReceiptByNameResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Change History
Change Log
Version | Change |
---|---|
1.7 | Changed ReceiptRefNum to type string |