Version 7.7.0

Version 7.7.0 changes how Payage tells applications about payments, so that each change reaches the application once and is retried if it fails. It also adds refunds through the payment gateway, a new Disputed status, and webhooks for PayPal Checkout. It comes with new versions of the gateway addons, which should be installed at the same time.

Refunds at the Gateway

A successful Stripe or PayPal Checkout payment can now be refunded from the payment's detail page with the new Refund at Gateway button. Payage asks for confirmation, has the gateway return the money to the payer, records the refund, and tells the application, just as when the refund is made in the gateway's own account.

The old Refund button is now called Mark as Refunded. It only changes the payment's status in Payage, for refunds that have been made some other way.

For Offline payments, Refund at Gateway records the refund, and the money must be returned to the payer by hand. PayPal Standard payments cannot be refunded from Payage: refund them in your PayPal account, and PayPal tells Payage about it.

Disputed Payments

When a payer disputes a payment with their bank or the gateway (a chargeback), the payment's status is now Disputed. If the dispute is decided in your favour the payment goes back to Success, and if it is lost the payment is Refunded. Stripe, PayPal Checkout and PayPal Standard all report disputes.

Applications that use the new payment handlers (see below) are told when a payment becomes Disputed, so they can withhold what was delivered. Older applications are not told about Disputed, but are told as before if the dispute ends in a refund.

Gateway Updates

Gateway Version Changes
Stripe 5.2.0 Reports disputes. Refunds through Stripe. Refund and dispute notifications are now checked with Stripe before they are used.
PayPal Checkout 3.1.0 Now uses webhooks, so payments are confirmed even if the payer's browser never returns to your site, and refunds and disputes made in PayPal are recorded. Payments that PayPal holds for review are recorded as Pending. Refunds through PayPal.
PayPal Standard 5.2.0 Reports disputes (PayPal "reversals"). Several bug fixes, listed below.
Offline 5.3.0 Refunds can be recorded with Refund at Gateway.

All four need Joomla 5 or later and PHP 8.2 or later. Stripe, PayPal Checkout and PayPal Standard also need Payage 7.7.0.

Application Delivery

Applications written for Payage 7.7.0 can register a payment handler, which Payage calls whenever one of the application's payments really changes. Payage records what each application has accepted, never tells it the same thing twice, ignores gateway messages that would move a payment backwards (such as a late "completed" after a refund), and tries again if the application fails. UserPoints 5.2.0 is the first application to use this.

For these payments the detail page shows the last status the application accepted, and any delivery error. A new Redeliver button tries again straight away. To retry automatically, create a Joomla Scheduled Task (see Upgrading below).

Existing applications keep working as before, with the one difference about Disputed noted above. Developers can find details of payment handlers, the new payment status display for return pages, and the new refund API in the Payage Developer Manual.

Security

  • Payage does not check the signatures on Stripe's webhook messages, and earlier versions believed refund messages as they arrived. Someone who knew a payment's Stripe charge ID and the account's webhook URL could send a false message that marked the payment Refunded and told the application. Payage now fetches the charge from Stripe and records only what Stripe says, and does the same for disputes.
  • PayPal Checkout webhook messages are checked with PayPal, and the payment is fetched from PayPal before it is used.

Bug Fixes

  • Stripe: unpublishing or deleting an account could delete the webhook of another Stripe account whose ID began with the same digits (for example, accounts 1 and 12).
  • PayPal Standard: a partial refund increased the payment's amount instead of reducing it.
  • PayPal Standard: a late or repeated IPN could change a payment back to an earlier status, for example a refunded payment back to Success.
  • PayPal Standard: a refund IPN that PayPal sent again was recorded twice.
  • PayPal Standard: an IPN with an empty amount field caused an error.
  • PayPal Standard: IPN verification could fail for messages containing some characters, because the message was not sent back to PayPal exactly as received.
  • PayPal Checkout: if the payer's browser did not come back to your site after paying, the payment stayed Unconfirmed and the application was not told.
  • Payage now uses one lock for all payment processing, with a fallback for servers without System V semaphores, so notifications are always processed one at a time.
  • Stripe: a refund of 95% or more made in the Stripe dashboard was treated as a full refund and marked the payment Refunded.

Upgrading

  1. Install Payage 7.7.0 over your existing version in the usual way. The new database columns are added automatically, and your payments, accounts and settings are not changed.
  2. Install the new versions of the gateway addons that you use.
  3. Open each Stripe and PayPal Checkout account and click Save. This updates the account's webhook at the gateway so that it includes the new events. PayPal only sends webhooks to sites using https; if your site uses http, Payage shows a warning and PayPal Checkout carries on without webhooks, as before.
  4. If any of your applications use payment handlers (UserPoints 5.2.0 or later), go to System → Scheduled Tasks, click New, choose Payage - Retry Application Delivery, and set it to run every 15 minutes. The "Task - Payage" plugin it needs is installed and enabled by Payage. Joomla runs scheduled tasks when the site has visitors, or you can run them from cron with php cli/joomla.php scheduler:run --all