Getting Charges

Just like craft.entries, you can access the recorded charges with a twig tag. It's exactly the same:

Parameters

craft.charge.charges accepts the following parameters :

customerName
Only get charges with a specific customerName
customerEmail
Only get charges with a specific customerEmail
hash
Only get charges with a specific hash
userId
Only fetch charges from a specific userId
timestamp
Only fetch charges for a specific time period
sourceUrl
Only get charges with a specific sourceUlr
planCurrency
Only get charges for a specific currency (defined by the 3 letter currency code - usd/eur/gbp etc..)
planType
Only get charges of a specific type - either charge or recurring

For example :

{% set charges = craft.charge.charges.customerEmail('example@customer.com').find() %}

Will set charges to be all the charges recorded with the customerEmail of 'example@customer.com'.

More likely you'll want to just show a single charge, relating to a specific purchase. For example, if on the payment form, we set the following value as our redirect :

<input type="hidden" name="redirect" value="payment/thanks/{hash}"/>

The user would be directed to a url like : http://site.url/payment/thanks/xxxxxx-xxxxx-xxxxx on success. On that page, we'll already have the relevant charge object defined, but if they revisit that page later, you can get the charge object back like so :

{% set hash = craft.request.getSegment(3) %}
{% if charge is not defined %}
    {% set charge = craft.charge.hash(hash).first() %}
{% endif %}

{% if charge is defined %}
    Thanks for your payment of {{ charge.formatPlanAmount() }}
{% endif %}

You could also use this method build retrievable receipts.