Generate unique transaction reference for each payment attempt to prevent duplicate errors

Created on 2 August 2025, 21 days ago

Problem/Motivation

Currently, the module uses the same transaction reference for multiple payment attempts on the same order. This causes Paystack to reject subsequent attempts with a "Duplicate Transaction Reference" error if the first payment is declined or abandoned.

One of my clients reported this issue some months ago when the website was showing the error,

We encountered an unexpected error processing your payment. Please try again later.

A customer tried paying for a product and for some reasons the payment wasn't successful so they returned later to pay for the order and the website kept showing the error and there was no way for them to pay for the order. I couldn't provide a fix for them at the time so they took the payment manually from the customer.

This evening I encountered the error again while testing on a different project and then I looked closely to track down the issue.

Steps to reproduce

  1. Attempt to pay for an order via Paystack.
  2. Decline or abandon the payment.
  3. Try to pay for the same order again.
  4. You will see the error: Paystack Request failed with response: 'Duplicate Transaction Reference', and Paystack won't load up anymore for that order.

Proposed resolution

Update the module to generate a unique transaction reference for each payment attempt by appending the current timestamp to the order UUID. This ensures every attempt is accepted by Paystack.

Remaining tasks

This patch resolves the issue and allows users to retry payments without errors.

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇳🇬Nigeria chike Nigeria

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024