To deposit Reverse, the client needs to provide the transactionId which can be retrieved from deposit create response. Deposit can be reversed only if the status of transaction is Accepted.

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.

Request Body

The request body is in JSON format and contains the following fields:

ParameterSeverityTypeDescription
transactionIdRequiredStringMust be a valid GUID

Sample Request:

import requests

def reverse_deposit_transaction(transaction_id, token):
    # Updated URL with the transaction ID included in the query parameters
    url = f"https://uat-businessapi.spenn.com/api/partner/transaction/deposit/reverse?transactionId={transaction_id}"

    # Headers with the 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)
        # 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 = 'FFa85f64-5717-4562-b3fc-2c963f66aFF6'  # Replace with the actual transaction ID
token = 'your_bearer_token_here'  # Replace with your actual bearer token
reverse_response = reverse_deposit_transaction(transaction_id, token)
print(reverse_response)

import java.net.HttpURLConnection;
import java.net.URL;

public class DepositTransactionReverser {

    public static void main(String[] args) {
        String transactionId = "FFa85f64-5717-4562-b3fc-2c963f66aFF6"; // Replace with the actual transaction ID
        String token = "your_bearer_token_here"; // Replace with your actual bearer token
        String response = reverseDepositTransaction(transactionId, token);
        System.out.println(response);
    }

    private static String reverseDepositTransaction(String transactionId, String token) {
        try {
            // Updated URL with the transaction ID included in the query parameters
            URL url = new URL("https://uat-businessapi.spenn.com/api/partner/transaction/deposit/reverse?transactionId=" + transactionId);

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

            // Set the request method and headers
            connection.setRequestMethod("POST");
            connection.setRequestProperty("Content-Type", "application/json");
            connection.setRequestProperty("Authorization", "Bearer " + token);

            // Check the response code
            int responseCode = connection.getResponseCode();
            String responseMessage = connection.getResponseMessage();

            // Disconnect the connection
            connection.disconnect();

            // Return the response code and message
            return "Response Code: " + responseCode + ", Response Message: " + responseMessage;

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

async function reverseDepositTransaction(transactionId, token) {
    // Updated URL with the transaction ID included in the query parameters
    const url = `https://uat-businessapi.spenn.com/api/partner/transaction/deposit/reverse?transactionId=${transactionId}`;

    // 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
        });

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

// Example usage
const transactionId = 'FFa85f64-5717-4562-b3fc-2c963f66aFF6'; // Replace with the actual transaction ID
const token = 'your_bearer_token_here'; // Replace with your actual bearer token

reverseDepositTransaction(transactionId, token)
    .then(data => console.log(data))
    .catch(error => console.error('Error in reversing deposit transaction:', error));

👍

Sample Response

{
	
}

NB: Deposit Reverse will transfer money back to the Business Account and will set transaction status to OK.