Last updated: Jul 20, 2018

Order - Return Url

Let's get the Order in our templates once the payment is charged and the user back to the Return Url.

The first step is to set the Return URL field in our PayPal button. We can pass any property of the Order model in the URL, let's pass the "number" property so we can use that number to fetch the Order in our templates. For example: "/order?number={number}"

Set Return Url

Let's get the Order in our template using the "number" parameter:

{% set number ='number') %}
{% set order = craft.paypalButton.getOrderByNumber(number) %}

<h1>Order #{{ order.number }}</h1>

<div class="row">
    <div class="four columns">

        <strong>{{ "Customer"|t }}:</strong> {{ }}<br>
        <strong>{{ "Total"|t }}:</strong> {{ order.totalPrice|commerceCurrency(order.currency) }}<br>
        <strong>{{ "Date"|t }}:</strong> {{ order.dateOrdered|date('D jS M Y') }}<br>
    <div class="four columns order-address">
        <h4>Shipping Address</h4>

        {{ order.getShippingAddress()|raw}}