emailTransactionReceiptByName
Emails a new receipt for an existing transaction. Selects receipt by name.
Description
This method allows you to email a new receipt for a existing transaction. This requires a receipt reference name, a transaction reference number and a valid email address. Transaction reference numbers can be found in the transactionResponse or retrieved with searchTransactionsCustom. The receipt name is assigned by the user when a custom receipt is created. Here are the receipt names for the system default receipts:
vterm
-Virtual Terminal (Printed)vterm_merchant
-Virtual Terminal (Merchant Email)vterm_customer
-Virtual Terminal (Customer Email)saleform_merchant
-Sale Form (Merchant Email)saleform_customer
-Sale Form (Customer Email)tranapi
-Transaction API and Payment Form (Merchant)tranapi_customer
-Transaction API and Payment Form (Customer)
See also addReceipt, updateReceipt, getReceipt, emailTransactionReceipt
Syntax
boolean emailTransactionReceiptByName ( ueSecurityToken, TransactionRefNum, ReceiptName, EmailAddress)
Arguments
Type | Name | Description |
---|---|---|
ueSecurityToken | Token | Merchant security token: used to identify merchant and retrieve the custom fields. |
String | TrasnactionRefNum | Transaction reference number assigned by the gateway to every transaction. |
String | ReceiptName | Name of the receipt template you want to send, assigned by user when the template is created. |
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 | Receipt 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;
$sent = $this->client->emailTransactionReceiptByName($this->token, $RefNum, 'tranapi', 'email@address.com');;
}
catch(SoapFault $e) {
echo $e->getMessage();
}
?>
.NET VB
Dim refnum As String
refnum = "46973419"
Dim result As Boolean
result = client.emailTransactionReceiptByName(token, refnum, "recurring", "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";
Boolean result;
try
{
result = client.emailTransactionReceiptByName(token, refnum, "recurring", "email@yourdomain.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">a2cebc4ded4b4ef9f39176d99d0d5611b11b955b</HashValue>
<Seed xsi:type="xsd:string">11623995976-test</Seed>
<Type xsi:type="xsd:string">sha1</Type>
</PinHash>
<SourceKey xsi:type="xsd:string">_B4P7C4K2w2ZCQQQXRqrxDj6agrS2NIT</SourceKey>
</Token>
<RefNum xsi:type="xsd:string">102301396</RefNum>
<ReceiptName xsi:type="xsd:string">tranapi_customer</ReceiptName>
<Email xsi:type="xsd:string">email@address.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>