With this API you can check the current status of a withdrawal request. Property withdrawRequestStatus will be populated with the request status.

Possible status:

  1. Confirmed
  2. Processing

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.

Sample Response

import requests

def get_withdrawal_status(transaction_id, token):
    # Endpoint URL with the transaction ID included in the path
    url = f"https://uat-businessapi.spenn.com/api/partner/transaction/withdraw/{transaction_id}/status"

    # Headers with the Authorization token
    headers = {
        'Authorization': f'Bearer {token}'
    }

    # Sending the GET request
    try:
        response = requests.get(url, headers=headers)
        # Return the response data (or handle it as needed)
        return response.json()
    except requests.RequestException as e:
        print(f"Error: {e}")

# Example usage
transaction_id = '3302...F7...8fe0'  # Replace with the actual transaction ID
token = 'eyJhbG...NrEQ41w'  # Replace with your actual bearer token
withdrawal_status = get_withdrawal_status(transaction_id, token)
print(withdrawal_status)

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

public class WithdrawalStatusFetcher {

    public static void main(String[] args) {
        String transactionId = "3302...F7...8fe0"; // Replace with the actual transaction ID
        String token = "eyJhbG...NrEQ41w"; // Replace with your actual bearer token
        String response = getWithdrawalStatus(transactionId, token);
        System.out.println(response);
    }

    private static String getWithdrawalStatus(String transactionId, String token) {
        try {
            // Endpoint URL with the transaction ID
            URL url = new URL("https://uat-businessapi.spenn.com/api/partner/transaction/withdraw/" + transactionId + "/status");

            // Open a connection
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();

            // Set the request method and headers
            connection.setRequestMethod("GET");
            connection.setRequestProperty("Authorization", "Bearer " + token);

            // Reading the response
            BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
            String inputLine;
            StringBuilder content = new StringBuilder();
            while ((inputLine = in.readLine()) != null) {
                content.append(inputLine);
            }
            in.close();
            connection.disconnect();

            // Return the response content
            return content.toString();

        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}

async function getWithdrawalStatus(transactionId, token) {
    // Endpoint URL with the transaction ID
    const url = `https://uat-businessapi.spenn.com/api/partner/transaction/withdraw/${transactionId}/status`;

    // Setting up the request headers
    const headers = {
        'Authorization': `Bearer ${token}`
    };

    try {
        // Sending the GET request
        const response = await fetch(url, { headers: headers });

        // Parsing the JSON response
        const responseData = await response.json();
        return responseData;
    } catch (error) {
        console.error('Error:', error);
    }
}

// Example usage
const transactionId = '3302...F7...8fe0'; // Replace with the actual transaction ID
const token = 'eyJhbG...NrEQ41w'; // Replace with your actual bearer token

getWithdrawalStatus(transactionId, token)
    .then(data => console.log(data))
    .catch(error => console.error('Error in fetching withdrawal status:', error));

👍

Sample Response

{
    "$id": "1",
    "withdrawRequestGuid": "5299a1aa-e604-40ef-9b14-e6ec23979091",
    "amount": 4.00,
    "fee": 0.50,
    "customerGuid": "7587cdad-4cda-417d-af59-9c9ef165d3ff", 
    "partnerCustomerGuid": "b584e88d-16f9-4c8f-90b8-084d7d373bdc", 
    "withdrawRequestShortCode": "ht9s85",
    "firstName": "SampleFirstName", 
    "middleName": "",
    "lastName": "SampleLastName",
    "phoneNumber": "+250783008884", 
    "withdrawRequestStatus": "InValidation", 
    "customerType": "string"
}