====== The Receipt... ====== ===== ...And All the Wonderful Things You Can Do With It ===== The FoxyCart receipt is much like [[.:checkout|the checkout]] in terms of how [[.:templates|it can be customized]], but obviously the function of the receipt is to //display// the information about the successful transaction that just took place on the checkout. While it might sound rather dull, the receipt is actually quite an exciting place to be, for a few reasons: * It means your store just made money! * Analytics and goal funnel tracking happens here. * Affiliate sales tracking happens here. * Advertising and campaign tracking happens here. * [[.:products:downloadables|Downloadable products]] are linked to from the receipt. While you may not need to ever touch the receipt, it is important to understand how it functions so that you can be prepared if you do need to track marketing activities in the future. ===== What's Included on the Receipt ===== The receipt will generally contain nearly all the information about a transaction, with a few exceptions. The information displayed is grouped into a few containers on the receipt. * Downloadables * Linked product names to download [[.:products:downloadables|downloadable products]] * General * Payment gateway or processor response * Your store's name (as configured in your store settings) * The date and time * Order * Order ID * Payment method, if paying by plastic (credit/debit/charge card), including the last 4 digits and the card type (ie. Visa, MasterCard, American Express, etc.) * Subtotal * Shipping total * Tax total * Order total * Billing Address * First name, last name, address, country * Email * Phone * Shipping Address (if different from the billing address) * First name, last name, address, country * Email * Phone * Shipping method (ie. "FedEx Home Delivery") * Custom Fields included on the checkout ===== What's Not Included on the Receipt ===== * [[.:checkout#sensitive_custom_checkout_fields|"Sensitive" custom checkout fields]] * [[.:session_variables|Session variables]] * Credit card details (card number, CSC, expiration, issue date, etc.) ===== Where the Receipt Fits Into the Order Flow ===== The receipt happens after the checkout, but it's worth noting that the datafeed happens //before// the receipt is loaded. So by the time the receipt is loaded, the datafeed has already been sent to your endpoint (if configured). - Your site - The [[.:cart|cart]] - The [[.:checkout|checkout]] - The [[.:transaction_xml_datafeed|transaction datafeed]] (if configured) - The receipt - Back to your site. Also worth noting is that you can configure the "continue" link that's displayed on the receipt in your store's "settings" page. If the continue link is not explicitly set in your store's settings it will use the most recent referring page (ie. the last page that the customer visited before the cart or checkout). Or you can [[:v:2.0:snippets:change_continue_category|set the ''href'' of that link dynamically]] ===== Specifying a custom transaction ID for your store ===== By default, FoxyCart store transactions are assigned a unique numerical global transaction ID, which means that transaction ID's will most probably not be sequential within your store. You can enable custom ID's though that will be sequential and can be customised to a specific start number, length and prefix/suffix. To enable custom ID's for your store, navigate to the ''Advanced'' settings page, and check the ''enable a custom receipt display id'' option. This will provide a few options to customise the ID: ; Start Value : **Description:** The starting number for the custom ID of the next transaction for your store. Setting this as ''1'' will cause the next transaction to have a custom display ID of ''1''. Once you start using a custom display ID, you can only change the start value to a higher number than the last custom display ID number used for a transaction on your store. : **Default:** ''1'' ; Minimum Length : **Description:** Used to set the minimum total length of the auto-incrementing part of the display ID you'd like to have. The display ID will be padded with leading zeros as needed. For example, if you'd like your first display ID to be "00000001" enter a length of 8. : **Default:** ''1'' ; Prefix : **Description:** A value to be appended to the start of the custom ID. For example, if you set the prefix to ''inv-'', your custom ID could look like ''inv-1'' ; Suffix : **Description:** A value to be appended to the end of the custom ID. For example, if you set the prefix to ''_2017'', your custom ID could look like ''1_2017'' \\ Note that enabling the custom display ID's will only apply to new transactions placed after it's enabled. Any transactions placed while this setting was not enabled will simply have the default global transaction ID. ==== Filtering by Custom ID in the Admin or API ==== To look for transactions when using a custom display ID, you can use the "Display Id" filter in the admin's transactions report, or filter using ''display_id'' in the API. ===== Revisiting the Receipt ===== The receipt can be revisited by your customers (or by store admins for viewing or printing orders) using the receipt's unique URL. Here's [[https://foxycart-demo.foxycart.com/receipt?id=59bbe56d7e638c2d7beb6f9f4a94e683d64d9f1f4aa7325ea1043ca3d0cccab8|a quick example]], showing a downloadable product in addition to non-downloadable products. The URL to the receipt is available via ''%%{{ receipt_url }}%%'' twig variable in your [[.:emails|email receipts]], and in the responses you'll get from [[.:api|the API]] and [[.:transaction_xml_datafeed|the datafeed]]. You can also get the URL from the "view" link in your FoxyCart admin's transaction history view, which may be the easiest way if you just want to view a past transaction. **A quick note about privacy:** In order to prevent accidental exposure of personally identifiable information held on a receipt, FoxyCart will transparently convert the receipt URLs to simply ''/receipt''. This ensures that a receipt on a public computer couldn't be revisited simply by hitting the browser's back button. That can make testing receipt customizations difficult during development, so we've added a flag to prevent this behavior. If you append ''&privacy_redirect=false'' to the original receipt URL, the URL will remain in the address bar. This can be helpful if you're testing template changes, as you'll simply be able to reload the page. (To get the URL, right-click on the "view" link in the admin's transactions view. Paste that into the browser's location bar, and paste the ''&privacy_redirect=false'' to the end. Then hit enter.) ===== Display Conditional Content ===== Using the sample code below, you can display custom html, javascript, etc. based on any criteria. For example, set parameter as false if specific product category is found: {% if context == 'receipt' %} {% set hasWholesale = false %} {% for item in items %} {% if item.category == 'WHOLESALE' %} {% set hasWholesale = true %} {% endif %} {% endfor %} {% if hasWholesale %}

Success!

{% endif %} {% endif %}{# context == receipt #}
===== Using Custom Tracking Code ===== To include a custom tracking code in your receipt, enclose the tracking code between the ''{% if first_receipt_display %}'' and its subsequent close tag, then paste it in your store admin's **custom footer** (Configuration > check **Add custom header and footer code to your templates**): {% if first_receipt_display %} {% endif %} ===== Receipt Placeholders ===== {{section>.:cheat_sheet#view_data&noheader&noeditbutton&permalink&footer&nodate}}