Transaction endpoint
After getting a response from Pay endpoint you can use this endpoint to fetch informations about the transaction such as status, transaction id , total amount paid, ETC...
URL
testing server:
GET https://staging.xpay.app/api/v1/communities/{community_id}/transactions/{transaction_uuid}/
production(Live) server:
GET https://community.xpay.app/api/v1/communities/{community_id}/transactions/{transaction_uuid}/
Authentication
Supply your API key in the request header
"x-api-key" : string
Parameters
Path parameters
Required Properties
Property name | Value | Description | Notes |
---|---|---|---|
community_id | string | ID that references prefrences to your community | value that your community recieved from XPay |
transaction_uuid | string | UUID of the transaction to be fetched | you usually have this value from the response of PAY endpoint |
Request body
Do not supply a request body.
Response body
If successful, this method returns a response body with the following structure:
{
"status": {
"code": integer,
"message": string,
"errors": []
},
"data": {
"created": string,
"id": integer,
"uuid": string,
"member_id": string, // in case the payment is connected to a membership id
"total_amount": string,
"total_amount_currency": string,
"payment_for": string, // ex: "API_PAYMENT", "EVENT", "BILL", etc..
"payment_for": number, // in case the payment was for event, service, product or training.
"status": string,
"custom_fields_json": object,
"total_amount_piasters": number
},
"count": integer,
"next": string,
"previous": string
}
Example
The following example uses Axios which is a Promise based HTTP client for the browser and node.js
Axios Github repoinstalling
Using npm:
$ npm install axios
Using jsDelivr CDN:
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
- Request Body
- Response Body
axios({
method: "get",
url:
"https://staging.xpay.app/api/v1/communities/JZ40KjN/transactions/2e1b68de-53f3-4228-a509-53560477a860/",
headers: {
"x-api-key": "fVmOK4Y6.gHjL48wKy47MoIUwIBGCht8M8kSg7QCP",
},
})
.then((response) => {
console.log(response.data.data);
})
.catch((e) => {
console.log(e.response.data.status);
});
{
"created": "2020-02-25T23:43:20.505541+02:00",
"custom_fields_json": null,
"id": 1760,
"member_id": "13333",
"payment_for": "BILL",
"quantity": null,
"status": "SUCCESSFUL",
"total_amount": "12.50",
"total_amount_currency": "EGP",
"total_amount_piasters": 1250,
"uuid": "2e1b68de-53f3-4228-a509-53560477a860"
}