API Reference

You can check the status of a request with this API.

Description

Headers

  • Content-Type: The Content-Type header is set to application/json, indicating that the request body contains JSON data.
  • Authorization: The Authorization header is used with a bearer token for authentication. The actual token value should replace the placeholder Bearer eyJhbG...NrEQ41w.
import requests

base_url = "https://uat-businessapi.spenn.com/api/Partner/transaction/request/{requestId}/status"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer eyJhbG...NrEQ41w"
}

request_id = "1e6cc63a-2d0d-4885-9c51-f9a35f113811"

# Format the URL with the dynamic requestId
url = base_url.format(requestId=request_id)

payload = {
    "requestMoneyGuid": request_id
}

# Make the GET request
response = requests.get(url, headers=headers, json=payload)

# Check the response status
if response.status_code == 200:
    # Successful response
    print("Request was successful. Response JSON:")
    print(response.json())
else:
    # Handle the error
    print(f"Error: {response.status_code}\n{response.text}")

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiRequestExample {

    public static void main(String[] args) {
        try {
            String baseUrl = "https://uat-businessapi.spenn.com/api/Partner/transaction/request/{requestId}/status";
            String authorizationHeader = "Bearer eyJhbG...NrEQ41w";
            String requestMoneyGuid = "1e6cc63a-2d0d-4885-9c51-f9a35f113811";

            // Format the URL with the dynamic requestId
            String url = baseUrl.replace("{requestId}", requestMoneyGuid);

            URL apiUrl = new URL(url);
            HttpURLConnection connection = (HttpURLConnection) apiUrl.openConnection();

            // Set the request method to GET
            connection.setRequestMethod("GET");

            // Set request headers
            connection.setRequestProperty("Content-Type", "application/json");
            connection.setRequestProperty("Authorization", authorizationHeader);

            // Read the response
            BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
            StringBuilder response = new StringBuilder();
            String line;

            while ((line = reader.readLine()) != null) {
                response.append(line);
            }

            reader.close();

            // Print the response
            System.out.println("Request was successful. Response JSON: " + response.toString());

            // Close the connection
            connection.disconnect();

        } catch (Exception e) {
            // Handle exceptions
            e.printStackTrace();
        }
    }
}

const baseUrl = "https://uat-businessapi.spenn.com/api/Partner/transaction/request/{requestId}/status";
const authorizationHeader = "Bearer eyJhbG...NrEQ41w";
const requestMoneyGuid = "1e6cc63a-2d0d-4885-9c51-f9a35f113811";

// Format the URL with the dynamic requestId
const url = baseUrl.replace("{requestId}", requestMoneyGuid);

const headers = {
  "Content-Type": "application/json",
  "Authorization": authorizationHeader
};

const payload = {
  requestMoneyGuid: requestMoneyGuid
};

// Make the GET request
fetch(url, {
  method: 'GET',
  headers: headers,
  body: JSON.stringify(payload)
})
  .then(response => {
    if (!response.ok) {
      throw new Error(`HTTP error! Status: ${response.status}`);
    }
    return response.json();
  })
  .then(data => {
    console.log("Request was successful. Response JSON:", data);
  })
  .catch(error => {
    console.error('Error:', error);
  });

❗️

Sample Response of a Cancelled Request:

{
	"$id": "1",
	"requestGuid": "1e6cc63a-2d0d-4885-9c51-f9a35f113811", 
	"requestStatus": "Cancelled",
	"timestampCreated": "2020-10-12T19:32:55.47",
	"phoneNumber": "+250783008884",
	"message": "Please send some money", 
	"amount": 10.00,
	“externalReference”: “sasd23xfhaxfasdfa2342”,
	"transactionStatus": null
}

🚧

Sample response of approved request, but transaction is pending:

{
	"$id": "1",
	"requestGuid": "1e6cc63a-2d0d-4885-9c51-f9a35f113811", 
	"requestStatus": "Pending",
	"timestampCreated": "2020-10-12T19:32:55.47",
	"phoneNumber": "+250783008884",
	"message": "Please send some money", 
	"amount": 10.00,
	“externalReference”: “sasd23xfhaxfasdfa2342”,
	"transactionStatus": "TransactionPending"
}

👍

Sample response of approved request and transaction OK:

{
	"$id": "1",
	"requestGuid": "1e6cc63a-2d0d-4885-9c51-f9a35f113811", 
	"requestStatus": "Approved",
	"timestampCreated": "2020-10-12T19:32:55.47",
	"phoneNumber": "+250783008884",
	"message": "Please send some money", 
	"amount": 10.00,
	“externalReference”: “sasd23xfhaxfasdfa2342”,
	"transactionStatus": "TransactionVerified"
}