View Action
POST {api-url}/viewAction?ns={community}
Use this call to fetch the true, trusted state of a transaction action by its ActionID. This is a critical step when receiving a webhook payload, allowing you to verify that the event actually occurred on the Celbux platform and to prevent spoofing.
The response returns an Action object containing all of the generated webhook payload variables for that specific event. Note that any variables not applicable to the transaction type will be returned with default zero-values (e.g., "" or 0).
Parameters
Section titled βParametersβ| Field | Type | Requirement | Description |
|---|---|---|---|
ActionID | Integer | Required | The Action_ID extracted from the incoming Webhook Payload Structure. |
Metadata | String | Optional | Any other detail that you wish to store with this event. |
Example Body
Section titled βExample Bodyβ{ "ActionID": 6145989311725568, "Metadata": ""}Parameters
Section titled βParametersβ| Field | Type | Description |
|---|---|---|
Action | Object | An object containing all the associated payload variables for this action. For a full description of all possible returned variables, see the Webhook Payload Structure list. |
Example Body
Section titled βExample Bodyβ{ "Action": { "Action_ID": 6145989311725568, "Action_TT": 4, "Action_Community": "celbux101", "Action_VoucherType": "Cash", "Voucher_Title": "Voucher Cash ZAR 1025.00 Number : 168-04085-22492", "Voucher_No": "168-04085-22492", "Voucher_Type": "Cash", "Voucher_DisplayName": "Cash", "Voucher_Amount": 102500, "Voucher_AmountStr": "R1,025.00", "Voucher_WithdrawFee": 1000, "Voucher_WithdrawFeeStr": "R10.00", "Audit_ID": 99381, "Audit_LastTransaction": 1696792732118, "Audit_Timestamp": 1696792731370, "Audit_Metadata": "{\"Amount\":\"1000\",\"datetime\":\"2023/10/08 19:18\"}", "Audit_FromBalance": 101500, "Audit_FromBalanceStr": "R1,015.00", "Audit_ToBalance": 5045000400, "Audit_Amount": 1000, "Audit_AmountStr": "R10.00", "Audit_TrxID": "3026-3110-2554", "Audit_Type": "Buy", "Audit_TT": 4, "From_LastTransaction": 1696792732118, "From_Balance": 210026, "From_BalanceStr": "R2,100.26", "From_Currency": "ZAR", "From_Username": "27717583600", "From_MSISDN": "27648503047", "From_DisplayName": "Matthew Williams", "From_IDNumber": "9927541665757", "From_Email": "matthew.williams@example.com", "From_Type": "S", "From_Verification": "Verified", "To_LastTransaction": 1696796724108, "To_Balance": 5045000400, "To_BalanceStr": "R50,450,004.00", "To_Currency": "ZAR", "To_Username": "celbux", "To_MSISDN": "27717583600", "To_DisplayName": "John Mercantile", "To_IDNumber": "8927541895536", "To_Email": "john.mercantile@example.com", "To_Type": "M", "To_Verification": "Verified", "Log_ID": 78219, "Log_Timestamp": 1696796723218, "Log_Username": "celbux", "Log_Action": "Process Payment", "Log_Status": "Success" }}curl -X POST '{api-url}/viewAction?ns={community}' \-H 'Authorization: bearer YOUR_TOKEN' \-H 'Content-Type: application/json' \-d '{"ActionID":6145989311725568,"Metadata":""}'using System;using System.Net.Http;using System.Text;using System.Threading.Tasks;
class Program{ static async Task Main(string[] args) { var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Post, "{api-url}/viewAction?ns={community}"); request.Headers.Add("Authorization", "bearer YOUR_TOKEN");
var jsonPayload = @"{ ""ActionID"": 6145989311725568, ""Metadata"": """"}"; request.Content = new StringContent(jsonPayload, Encoding.UTF8, "application/json");
var response = await client.SendAsync(request); response.EnsureSuccessStatusCode();
var responseBody = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseBody); }}package main
import ( "fmt" "io/ioutil" "net/http" "strings")
func main() { url := "{api-url}/viewAction?ns={community}" payload := strings.NewReader(`{"ActionID":6145989311725568,"Metadata":""}`)
req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "bearer YOUR_TOKEN") req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req) defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body) fmt.Println(string(body))}import java.net.URI;import java.net.http.HttpClient;import java.net.http.HttpRequest;import java.net.http.HttpResponse;
public class ApiRequest { public static void main(String[] args) throws Exception { var payload = """ { "ActionID": 6145989311725568, "Metadata": ""} """;
var request = HttpRequest.newBuilder() .uri(URI.create("{api-url}/viewAction?ns={community}")) .header("Authorization", "bearer YOUR_TOKEN") .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(payload)) .build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); }}// Requires Node.js v18+(async () => { const url = '{api-url}/viewAction?ns={community}'; const payload = { "ActionID": 6145989311725568, "Metadata": ""};
try { const response = await fetch(url, { method: 'POST', headers: { 'Authorization': 'bearer YOUR_TOKEN', 'Content-Type': 'application/json' }, body: JSON.stringify(payload) }); const data = await response.json(); console.log(data); } catch (error) { console.error('Error:', error); }})();<?php$curl = curl_init();
curl_setopt_array($curl, array( CURLOPT_URL => '{api-url}/viewAction?ns={community}', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => '{ "ActionID": 6145989311725568, "Metadata": ""}', CURLOPT_HTTPHEADER => array( 'Authorization: bearer YOUR_TOKEN', 'Content-Type: application/json' ),));
$response = curl_exec($curl);curl_close($curl);echo $response;import requestsimport json
url = "{api-url}/viewAction?ns={community}"payload = { "ActionID": 6145989311725568, "Metadata": ""}
headers = { "Authorization": "bearer YOUR_TOKEN", "Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)print(response.json())require 'uri'require 'net/http'require 'json'
url = URI("{api-url}/viewAction?ns={community}")
http = Net::HTTP.new(url.host, url.port)http.use_ssl = true
request = Net::HTTP::Post.new(url)request["Authorization"] = 'bearer YOUR_TOKEN'request["Content-Type"] = 'application/json'
request.body = JSON.dump({ "ActionID": 6145989311725568, "Metadata": ""})
response = http.request(request)puts response.read_body