Skip to main content

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 nameValueDescriptionNotes
community_idstringID that references prefrences to your communityvalue that your community recieved from XPay
transaction_uuidstringUUID of the transaction to be fetchedyou 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 repo

installing

Using npm:

$ npm install axios

Using jsDelivr CDN:

<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
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);
});