Authorize.net email receipt api

Authorize.net's Email Receipt API is a feature that allows you to send a receipt to your customers via email after a successful transaction. Here's an overview of how to use it:

Prerequisites

API Request

To send an email receipt, you'll need to make a POST request to the https://api.authorize.net/soap/v1/TransactionSearch endpoint. The request should include the following parameters:

Here's an example of what the request might look like in XML:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope/">
  <soap:Body>
    <TransactionSearchRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
      <merchantAuthentication>
        <name>YOUR_MERCHANT_ID</name>
        <transactionKey>YOUR_TRANSACTION_KEY</transactionKey>
      </merchantAuthentication>
      <searchType>TransactionSearch</searchType>
      <searchCriteria>
        <name>transactionId</name>
        <value>1234567890</value>
      </searchCriteria>
      <email>[email protected]</email>
      <receipt>
        <![CDATA[<receipt>
          <date>2023-02-20</date>
          <amount>19.99</amount>
          <items>
            <item>Item 1</item>
            <item>Item 2</item>
          </items>
        </receipt>]]>
      </receipt>
    </TransactionSearchRequest>
  </soap:Body>
</soap:Envelope>

Response

The API will respond with a TransactionSearchResponse object, which will include a transactionId and a receipt element. The receipt element will contain the receipt data in the same format as the request.

Here's an example of what the response might look like:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope/">
  <soap:Body>
    <TransactionSearchResponse xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
      <transactionId>1234567890</transactionId>
      <receipt>
        <![CDATA[<receipt>
          <date>2023-02-20</date>
          <amount>19.99</amount>
          <items>
            <item>Item 1</item>
            <item>Item 2</item>
          </items>
        </receipt>]]>
      </receipt>
    </TransactionSearchResponse>
  </soap:Body>
</soap:Envelope>

Tips and Considerations