Transaction not Found - Check Transaction After 8s of CashIn - Laravel

Screenshot from 2022-08-11 19-26-32-1

A transaction can’t be committed unless we receive a confirmation of change in status from our providers. When we receive a confirmation that the transaction is either successful or failed we create a transaction record, that is why you get transaction not found when you try to find that transaction.

If you wish to find a transaction in short amount of time you could use the events method like this:

$paypackInstance->Events(['ref' => 'f34b7aa8-6b72-4894-bdd3-36f371b28a84']);

This will provide 2 events of this transaction, transaction:created is available after you initiate a transaction and transaction:processed available after we receive confirmation

A sample of your transaction event would look like this:

{
  "ref": "f34b7aa8-6b72-4894-bdd3-36f371b28a84",
  "limit": 100,
  "total": 2,
  "transactions": [
    {
      "event_id": "0065a864-1980-11ed-ac21-dead0062f58a",
      "event_kind": "transaction:processed",
      "created_at": "2022-08-11T14:15:07.149789Z",
      "data": {
        "ref": "f34b7aa8-6b72-4894-bdd3-36f371b28a84",
        "kind": "CASHIN",
        "client": "078xxxxx",     //hidden for privacy
        "amount": 600,
        "provider": "mtn",
        "status": "failed",
        "created_at": "2022-08-11T14:03:14.163307121Z",
        "processed_at": "2022-08-11T14:15:07.148961308Z"
      },
      "webhooks": []
    },
    {
      "event_id": "576ce82c-197e-11ed-a81a-dead0062f58a",
      "event_kind": "transaction:created",
      "created_at": "2022-08-11T14:03:14.164049Z",
      "data": {
        "ref": "f34b7aa8-6b72-4894-bdd3-36f371b28a84",
        "kind": "CASHIN",
        "client": "078xxxxx",  //hidden for privacy
        "amount": 600,
        "provider": "mtn",
        "status": "pending",
        "created_at": "2022-08-11T14:03:14.163307121Z"
      },
      "webhooks": []
    }
  ]
}

When do we use this ??

Whenever a transaction is processed that is when it can be found using this approach