To deposit, the client needs to provide the recipient's customer guid which can be retrieved using any of the above steps. In response, a transaction id will be provided that can be used to check transaction status.
Description
- Method: This is a POST request, indicating that data is being sent to the server.
- URL: The URL for this request is https://uat-businessapi.spenn.com/api/partner/transaction/deposit/create
- HTTPS Version: The request is made using HTTPS.
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:
Parameter | Severity | Type | Description |
---|---|---|---|
customerGuid | Required | String | Must be a valid GUID |
amount | Required | Decimal (18, 2) | Not Null. Must be greater than 0. Precision: 18, Scale: 2. |
message | Required | String (100 Chars) | |
externalReferenceId | Required | String | must be a valid GUID. |
Sample Request:
import requests
import json
def create_deposit(customer_guid, amount, message, external_reference_id, token):
# URL for the API endpoint
url = "https://uat-businessapi.spenn.com/api/partner/transaction/deposit/create"
# JSON body of the request
data = {
"customerGuid": customer_guid,
"amount": amount,
"message": message,
"externalReferenceId": external_reference_id
}
# Headers including Content-Type and Authorization
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {token}'
}
# Sending the POST request
response = requests.post(url, headers=headers, data=json.dumps(data))
# Return the response data (or handle it as needed)
return response.json()
# Example usage
customer_guid = "3fa85f64-5717-4562-b3fc-2c963f66afa6"
amount = 10
message = "A message"
external_reference_id = "5502c8e4-4bd4-4918-9a26-55b186218f66"
token = "your_bearer_token_here" # Replace with your actual bearer token
deposit_response = create_deposit(customer_guid, amount, message, external_reference_id, token)
print(deposit_response)
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
public class DepositTransactionCreator {
public static void main(String[] args) {
String token = "your_bearer_token_here"; // Replace with your actual bearer token
String response = createDepositTransaction(token);
System.out.println(response);
}
private static String createDepositTransaction(String token) {
try {
// URL for the POST request
URL url = new URL("https://uat-businessapi.spenn.com/api/partner/transaction/deposit/create");
// JSON payload
String jsonInputString = "{\"customerGuid\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\", " +
"\"amount\": 10, " +
"\"message\": \"A message\", " +
"\"externalReferenceId\": \"5502c8e4-4bd4-4918-9a26-55b186218f66\"}";
// 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 createDepositTransaction(token) {
// URL for the POST request
const url = 'https://uat-businessapi.spenn.com/api/partner/transaction/deposit/create';
// JSON payload
const data = {
customerGuid: "3fa85f64-5717-4562-b3fc-2c963f66afa6",
amount: 10,
message: "A message",
externalReferenceId: "5502c8e4-4bd4-4918-9a26-55b186218f66"
};
// 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
createDepositTransaction(token)
.then(data => console.log(data))
.catch(error => console.error('Error in creating deposit transaction:', error));
Sample Response
{
"transactionId": "FFa85f64-5717-4562-b3fc-2c963f66aFF6"
}
NB: After Transaction is confirmed, The transaction status should be Accepted, And Amount will be locked at receiver’s side. Partner can either confirm or reverse the transaction only if the status is Accepted.