Events

Events, as the name implies, are states that a transaction must pass through in order to complete the payment flow. A completed transaction has two events that are distinguished by their states: transaction:created and transaction:processed.

transaction:created

This event state determines a transaction that is still in process and is awaiting a response from the customer to confirm or cancel the transaction. A transaction typically has a status of pending during this state.

transaction:processed

When a customer confirms or cancels a transaction, a new event with the state 'transaction:processed' is created. During this state, a transaction's status is typically success or failed.

List of events

List events with multiple optional filters passed in as query parameters.

Path:

${BASE_URL}/events/transactions

Headers

FieldTypeDescription
Content-Typestringapplication/json
Acceptstringapplication/json
AuthorizationstringBearer JWT token obtained from authentication.

Query Parameters

FieldTypeDescription
statusstringThe status of the transaction.
clientstringThe phone number of the customer.
refstringThe reference number of the transaction.
kindstringThe kind of transaction (CASHIN or CASHOUT).

Example

cURL
curl --location --request GET 'https://payments.paypack.rw/api/events/transactions?ref=d0bb2807-1d52-4795-b373-3feaf63dceb1&kind=CASHIN&client=078xxxxxx&status=pending' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {token}'
Go
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://payments.paypack.rw/api/events/transactions?ref=d0bb2807-1d52-4795-b373-3feaf63dceb1&kind=CASHIN&client=078xxxxxx&status=pending"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Accept", "application/json")
  req.Header.Add("Authorization", "Bearer {token}")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
JavaScript
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://payments.paypack.rw/api/events/transactions?ref=d0bb2807-1d52-4795-b373-3feaf63dceb1&kind=CASHIN&client=078xxxxxx&status=pending',
  'headers': {
    'Accept': 'application/json',
    'Authorization': 'Bearer {token}'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
PHP
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => 'https://payments.paypack.rw/api/events/transactions?ref=d0bb2807-1d52-4795-b373-3feaf63dceb1&kind=CASHIN&client=078xxxxxx&status=pending',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer {token}'
),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
Python
import requests

url = "https://payments.paypack.rw/api/events/transactions?ref=d0bb2807-1d52-4795-b373-3feaf63dceb1&kind=CASHIN&client=078xxxxxx&status=pending"

payload={}
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {token}'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Response

{
  "amount": 1000,
  "client": "078xxxxxxx",
  "event-kind": "transaction:created",
  "kind": "CASHIN",
  "limit": 20,
  "offset": 0,
  "ref": "d0bb2807-1d52-4795-b373-3feaf63dceb1",
  "status": "failed",
  "total": 250,
  "transactions": [
    {
      "event_id": "bf76c3a8-cafe-11ec-9478-dead2ba023b5",
      "event_kind": "transaction:processed",
      "created_at": "2022-05-03T16:33:22.434606Z",
      "data": {
        "ref": "ajsfh44w3j-4h4r-28438-efnef-e9f44a5b4c2d",
        "kind": "CASHIN",
        "fee": 2.3,
        "merchant": "XXXXX",
        "client": "078xxxxxxx",
        "amount": 100,
        "status": "successful",
        "created_at": "2022-05-03T16:27:01.292808134Z",
        "processed_at": "2022-05-03T16:33:22.434351492Z"
      }
    }
  ]
}