API Reference

With this API you can create a new payment request without phone number.

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:

  • amount: This field has a value of 10, which presumably represents the amount of money for the transaction.
  • message: This field contains the message associated with the transaction, which is "Please send some money."

Sample Request

import requests
import json

# Define the API endpoint URL
url = "https://uat-businessapi.spenn.com/api/Partner/transaction/request"

# Define the headers, including the Authorization header with your actual token
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer eyJhbG...NrEQ41w"
}

# Define the request body as a Python dictionary
request_data = {
    "amount": 10,
    "message": "Please send some money"
}

# Convert the request data to JSON format
request_data_json = json.dumps(request_data)

# Make the POST request
response = requests.post(url, headers=headers, data=request_data_json)

# Check the response
if response.status_code == 200:
    print("Request was successful. Response:")
    print(response.json())
else:
    print(f"Request failed with status code {response.status_code}.")
    print("Response content:")
    print(response.text)

import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;

public class APICallExample {
    public static void main(String[] args) {
        // Define the API endpoint URL
        String url = "https://uat-businessapi.spenn.com/api/Partner/transaction/request";

        // Define the request headers
        String authorizationHeader = "Bearer eyJhbG...NrEQ41w";
        String contentType = "application/json";

        // Define the request body as a JSON string
        String requestJson = "{\"amount\": 10, \"message\": \"Please send some money\"}";

        try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
            // Create the HTTP POST request
            HttpPost request = new HttpPost(url);

            // Set the request headers
            request.addHeader("Content-Type", contentType);
            request.addHeader("Authorization", authorizationHeader);

            // Set the request body
            request.setEntity(new StringEntity(requestJson));

            // Execute the request
            HttpResponse response = httpClient.execute(request);

            // Check the response
            if (response.getStatusLine().getStatusCode() == 200) {
                System.out.println("Request was successful. Response:");
                // Process and print the response here if needed
            } else {
                System.out.println("Request failed with status code " + response.getStatusLine().getStatusCode() + ".");
                System.out.println("Response content:");
                // Print the response content here if needed
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

const fetch = require('node-fetch'); // Only required for Node.js

// Define the API endpoint URL
const url = "https://uat-businessapi.spenn.com/api/Partner/transaction/request";

// Define the request headers
const headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer eyJhbG...NrEQ41w', // Replace with your actual token
};

// Define the request body as a JavaScript object
const requestData = {
  amount: 10,
  message: 'Please send some money',
};

// Make the POST request
fetch(url, {
  method: 'POST',
  headers: headers,
  body: JSON.stringify(requestData),
})
  .then(response => {
    if (response.status === 200) {
      return response.json();
    } else {
      console.error(`Request failed with status code ${response.status}.`);
      return response.text();
    }
  })
  .then(data => {
    console.log('Response:', data);
  })
  .catch(error => {
    console.error('Error:', error);
  });

👍

Sample Response

{
	"$id": "1",
	"requestId": "1e6cc63a-2d0d-4885-9c51-f9a35f113811",
	"status": "Pending" 
}

NB:

External Reference (optional):
You can provide a string as the value of ‘externalReference’ parameter. This can be used as a reference to track the request later. This is an optional parameter.