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.

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

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

chike created an issue. See original summary.

chike’s picture

Issue summary: View changes
chike’s picture

Issue summary: View changes

chike’s picture

Status: Active » Needs review
i-trokhanenko’s picture

Status: Needs review » Reviewed & tested by the community
i-trokhanenko’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.