Skip to content

Commit 59f13ed

Browse files
committed
Fix paystack charge back issue
1 parent a180eab commit 59f13ed

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Webhooks/Paystack/ChargeSuccess.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,12 @@ public function isHandlerFor(Request $webhookRequest): bool
2525

2626
public function handle(Request $webhookRequest): Payment
2727
{
28-
$payment = Payment::withTrashed()->where('transaction_reference', $webhookRequest->input('data.reference'))
29-
->orWhere('transaction_reference', $webhookRequest->input('data.metadata.reference'))
28+
$paystackReference = $webhookRequest->input('data.reference');
29+
$appReference = $webhookRequest->input('data.metadata.reference');
30+
31+
$payment = Payment::withTrashed()
32+
->where('processor_transaction_reference', $paystackReference)
33+
->when($appReference, fn ($query) => $query->orWhere('transaction_reference', $appReference))
3034
->first();
3135

3236
if (!$payment) {

0 commit comments

Comments
 (0)