Jump to main content Jump to doc navigation

Hooks

This document provides information on the mhPayPal snippet hooks, its properties and some example usages. If looking for more information about the mhPayPal package in which the snippet is included, please visit ?mhPayPal instead. If you are looking for more information on the mhPayPal snippet itself, please visit ?mhPayPal.Snippet Usage.

Introduction

By means of the &preHooks, &postHooks and &postPaymentHooks, the mhPayPal snippet allows you to customize the flow and add functionality to the mhPayPal core, without having to wreck upgrade paths.

A hook is either included in mhPayPal or is a snippet installed in your MODX set up.

Built-in Hooks

email, email2

The email and email2 hooks do exactly the same, allowing you to send out two entirely different emails to different emailaddresses. They both support the same properties and its behavior is the same.

You assign the properties mentioned below to the mhPayPal snippet itself.

When using the email2 hook, make sure to append a "2" to the property, eg emailTo becomes emailTo2.

&property Description Default value Version
emailTpl [string] Name of a chunk to use for the email contents. mhPayPalEmail (file-based) 1.1.0
emailSubject [string] The subject of the email to send. Can include all properties included in the data returned. Thank you for your Donation! 1.1.0
emailTo [string] Comma separated list of emails to send the email to. Can use [[+email]] in this property, which will be replaced with the email as received from PayPal. The "emailsender" system setting 1.1.0
emailCC [string] Comma separated list of emails to CC the email to. 1.1.0
emailBCC [string] Comma separated list of emails to BCC the email to. 1.1.0
emailFrom [string] Email address to set up as "from" email. The "emailsender" system setting 1.1.0
emailFromName [string] The name to attach to the "from" email. The "site_name" system setting. 1.1.0

Redirect

The redirect hook can be used to redirect the user to a different page. You would most likely want to do this after the payment was completed, by sending the user to a different "Thank you" style page.

&property Description Default value Version
redirectTo [integer string] Either a resource ID or a full URL.
redirectParams [JSON string] A JSON style string with extra parameters you want to add to the URL. Only used if redirectTo is a resource ID. 1.1.0
redirectContext [string] The key of the context to use in building the URL if redirectTo is a resource ID. Current context 1.1.0
redirectScheme Any valid value for the modX::makeUrl scheme, indication what kind of url to build. link_tag_scheme setting or -1 1.1.0

Developing Custom Hooks

Custom hooks may not yet be fully implemented, but will be in a future release.

Simply call a snippet in one of the hooks properties, and it will be executed.

Available in the $scriptProperties and as $variables are all the data available at that point. Configuration properties. $mhpp class.

Examples

Nothing yet. Sorry!

More Documentation

Support the team building MODX with a monthly donation.

The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.

Backers

  • modmore
  • STERC
  • Digital Penguin
  • Jens Wittmann – Gestaltung & Entwicklung
  • Fabian Christen
  • Dannevang Digital
  • Sepia River Studios
  • CrewMark
  • Chris Fickling
  • deJaya
  • eydolan
  • Lefthandmedia
  • Murray Wood
  • Following Sea
  • Anton Tarasov
  • Stéphane Jäggi
  • Raffy
  • Snow Creative
  • A. Moreno
  • Nick Clark
  • JT Skaggs
  • Helen
  • YJ
  • krisznet
  • Richard
  • Yanni

Budget

$306 per month—let's make that $500!

Learn more