API Reference

As a partner, you will receive a withdrawal shortcode from the user after the user has created the withdrawal request in the app. The withdrawal shortcode is 6 characters long. Example code is ht9s85.

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 validate_withdrawal(token, data): # Endpoint URL url = "https://uat-businessapi.spenn.com/api/partner/transaction/withdraw/validation" # Headers with Content-Type and Authorization token headers = { 'Content-Type': 'application/json', 'Authorization': f'Bearer {token}' } # Sending the POST request try: response = requests.post(url, headers=headers, json=data) # Return the response data (or handle it as needed) return response.json() except requests.RequestException as e: print(f"Error: {e}") # Example usage token = 'your_bearer_token_here' # Replace with your actual bearer token data = { 'shortCode': 'ht9585', 'partnerReference': '', # Include other necessary fields as required by the API, e.g., 'amount': 100, 'customerGuid': 'some-guid', etc. } validation_response = validate_withdrawal(token, data) print(validation_response)
import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.nio.charset.StandardCharsets; public class WithdrawalValidation { public static void main(String[] args) { String token = "your_bearer_token_here"; // Replace with your actual bearer token String jsonInputString = "{\"shortCode\": \"ht9585\", \"partnerReference\": \"\", \"additionalField1\": \"value1\", \"additionalField2\": \"value2\"}"; // Replace with actual JSON data String response = validateWithdrawal(token, jsonInputString); System.out.println(response); } private static String validateWithdrawal(String token, String jsonInputString) { try { // Endpoint URL URL url = new URL("https://uat-businessapi.spenn.com/api/partner/transaction/withdraw/validation"); // Open a connection HttpURLConnection connection = (HttpURLConnection) url.openConnection(); // Set the request method and headers connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "application/json; utf-8"); connection.setRequestProperty("Authorization", "Bearer " + token); connection.setDoOutput(true); // Sending the request try (OutputStream os = connection.getOutputStream()) { byte[] input = jsonInputString.getBytes(StandardCharsets.UTF_8); os.write(input, 0, input.length); } // Reading the response StringBuilder response = new StringBuilder(); try (java.io.BufferedReader br = new java.io.BufferedReader( new java.io.InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) { String responseLine; while ((responseLine = br.readLine()) != null) { response.append(responseLine.trim()); } } // Disconnecting the connection connection.disconnect(); // Return the response content return response.toString(); } catch (Exception e) { e.printStackTrace(); return null; } } }
async function validateWithdrawal(token, data) { // Endpoint URL const url = 'https://uat-businessapi.spenn.com/api/partner/transaction/withdraw/validation'; // Setting up the request headers const headers = { 'Content-Type': 'application/json', 'Authorization': `Bearer ${token}` }; try { // Sending the POST request const response = await fetch(url, { method: 'POST', headers: headers, body: JSON.stringify(data) // Convert the JavaScript object to a JSON string }); // Parsing the JSON response const responseData = await response.json(); return responseData; } catch (error) { console.error('Error:', error); } } // Example usage const token = 'your_bearer_token_here'; // Replace with your actual bearer token const data = { // Add the necessary data for the withdrawal validation here, along with the new fields 'shortCode': 'ht9585', 'partnerReference': '', // Include other fields as required, e.g., 'amount': 100, 'customerGuid': 'some-guid', etc. }; validateWithdrawal(token, data) .then(responseData => console.log(responseData)) .catch(error => console.error('Error in withdrawal validation:', 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" }