API Reference

The final status is usually available within 10 seconds after submitting the transaction. If checking status you get status pending, wait a few seconds and check again.

Possible status:

  1. Ok
  2. Pending
  3. Failed
  4. Accepted
  5. Reversed
  6. PendingForReverse

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 Request:

import requests

def get_transaction_status(transaction_id, token):
    # URL with the transaction ID included in the path
    url = f"https://uat-businessapi.spenn.com/api/partner/transaction/{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 = 'your_transaction_id_here'  # Replace with the actual transaction ID
token = 'your_bearer_token_here'  # Replace with your actual bearer token
transaction_status = get_transaction_status(transaction_id, token)
print(transaction_status)

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

public class TransactionStatusFetcher {

    public static void main(String[] args) {
        String transactionId = "your_transaction_id_here"; // Replace with the actual transaction ID
        String token = "your_bearer_token_here"; // Replace with your actual bearer token
        String response = getTransactionStatus(transactionId, token);
        System.out.println(response);
    }

    private static String getTransactionStatus(String transactionId, String token) {
        try {
            // URL with the transaction ID included in the path
            URL url = new URL("https://uat-businessapi.spenn.com/api/partner/transaction/" + 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 getTransactionStatus(transactionId, token) {
    // URL with the transaction ID included in the path
    const url = `https://uat-businessapi.spenn.com/api/partner/transaction/${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 = 'your_transaction_id_here'; // Replace with the actual transaction ID
const token = 'your_bearer_token_here'; // Replace with your actual bearer token

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

👍

Sample Response - Successful

{
  "status": "Pending", 
  "reason": null
}

❗️

Sample Response - Failed

{
  "status": "Failed",
	"reason": "NotVerifiedReceiverKyc"
}