This is the documentation for LemonStand V1, which has been discontinued. You can learn more and upgrade your store here.

LemonStand Version 1 Has Been Discontinued

This documentation is for LemonStand Version 1. LemonStand is now offered as a cloud-based eCommerce platform.
You can try the new LemonStand and learn about upgrading here.

Creating a Payment Receipt Page

The Payment Receipt page is displayed after a successful payment. For each payment method you select choose a Receipt page in the payment method configuration form. You can create a single page and use it for all payment methods, or create separate pages for each payment method.

The Payment Receipt page displays the order details and confirms a successful payment. Also, LemonStand outputs on this page the Google Analytics e-commerce tracking code, if Google Analytics is enabled.

To create the Payment Receipt page, create a new page and assign it a name, for example “Thank you!” and URL, for example /thankyou. The page name and URL can be anything. Go to the Action tab and select the shop:payment_receipt action in the drop-down menu. The shop:payment_receipt action loads an order object into the $order variable and order items into the $items variable which contains a list of order items (objects of the Shop_OrderItem class).

A value of the $order variable can be NULL in case if the requested order was not found. Always check a value of the variable before displaying the receipt page content. Also, the shop:payment_receipt action creates the $payment_processed variable which value if TRUE if the order was paid. You need to check a value of this variable before displaying the receipt page.

The following code snippet outputs the typical content of the Receipt page.

<? if (!$order): ?>
  <h2>Order not found.</h2>
<? elseif (!$payment_processed): ?>
  <h2>This order is not paid.</h2>
<? else: ?>
  <h2>Thank you!</h2>
  <p>Order # <?= $order->id ?><br/>Order Date: <?= h($order->order_datetime->format('%x')) ?></p>
  <table>
    <tr>
      <th>Items</th>
      <th>Price</th>
      <th>Discount</th>
      <th>Quantity</th>
      <th>Total</th>
    </tr>
    <? foreach ($items as $item): ?>
      <tr>
        <td><?= $item->output_product_name() ?></td>
        <td><?= format_currency($item->single_price) ?></td>
        <td><?= format_currency($item->discount) ?></td>
        <td><?= $item->quantity ?></td>
        <th><?= format_currency($item->subtotal) ?></th>
      </tr>
    <? endforeach ?>
  </table>
  <p>Subtotal: <?= format_currency($order->subtotal) ?><br/>
    Discount: <?= format_currency($order->discount) ?><br/>
  
    <? foreach ($order->list_item_taxes() as $tax): ?>
        <?= ($tax->name) ?>: <?= format_currency($tax->total) ?><br/>
    <? endforeach ?>
  
    Shipping: <?= format_currency($order->shipping_quote) ?><br/>
  
    <? foreach ($order->list_shipping_taxes() as $tax): ?>
       Shipping tax (<?= ($tax->name) ?>): <?= format_currency($tax->total) ?><br/>
    <? endforeach ?>  
  </p>
  <p>Total: <?= format_currency($order->total) ?></p>
<? endif ?>
{% if not order %}
  <h2>Order not found.</h2>
{% elseif not payment_processed %}
  <h2>This order is not paid.</h2>
{% else %}
  <h2>Thank you!</h2>
  <p>Order # {{ order.id }}<br/>Order Date: {{ order.order_datetime.format('%x') }}</p>
  <table>
    <tr>
      <th>Items</th>
      <th>Price</th>
      <th>Discount</th>
      <th>Quantity</th>
      <th>Total</th>
    </tr>
    {% for item in items %}
      <tr>
        <td>{{ item.output_product_name()|unescape }}</td>
        <td>{{ field(item, 'single_price')|currency }}</td>
        <td>{{ item.discount|currency }}</td>
        <td>{{ item.quantity }}</td>
        <th>{{ field(item, 'subtotal')|currency }}</th>
      </tr>
    {% endfor %}
  </table>
  <p>Subtotal: {{ order.subtotal|currency }}<br/>
    Discount: {{ order.discount|currency }}<br/>
  
    {% for tax in order.list_item_taxes() %}
      {{ tax.name }}: {{ tax.total|currency }}<br/>
    {% endfor %}
  
    Shipping: {{ order.shipping_quote|currency }}<br/>
  
    {% for tax in order.list_shipping_taxes() %}
      Shipping tax ({{ tax.name }}): {{ tax.total|currency }}<br/>
  {% endfor %}  
  
  <p>Total: {{ order.total|currency }}</p>
{% endif %}

The code outputs the order number and order create date. Then the code iterates over the list of product items, fetching them from the $items variable. For each order item the table row with item detail is displayed. Finally, the code outputs the order subtotal, tax information, shipping quota and order total.

See also

Next: Payment Receipt for Inclusive Tax Environments
Previous: Creating a Payment Page
Return to Payment