Preference Endpoints (api/Preference)
General Definitions
| Parameter | Description |
| baseurl |
Sandbox - https://test.xprizo.com/api |
| apiversion | 1.0 |
| apikey | API key For authentication |
Update Approval Webhook
Approval Webhook is triggered when a new pending transaction is created or when this pending transaction is approved, canceled, or rejected.
Request
curl --location --request PUT '{baseurl}/Preference/SetApprovalWebhook?url={url}' \
--header 'Accept: text/plain; x-api-version=1.0' \
--header 'x-api-version: {apiversion}' \
--header 'x-api-key: {apikey}'
| Parameter | Description |
| url | Url to receive callbacks |
Response (200)
Your callback URL must respond with JSON object {'status': 'success' } and HTTP code 200 to Xprizo.
Test Approval Webhook
You can test your callback URL's response by using this endpoint
Request
curl --location --request GET '{baseurl}/Preference/TestApprovalWebhook' \
--header 'Accept: text/plain; x-api-version=1.0' \
--header 'x-api-version: {apiversion}' \
--header 'x-api-key: {apikey}'
Response (200)
Your callback URL must respond with JSON object {'status': 'success' } and HTTP code 200 to Xprizo.
Approval Webhook Responses
Created Transaction & Approved Transaction Response on Webhook (Sample)
# Created Transaction
{
"statusType": 1,
"status": "New",
"description": null,
"actionedById": 724,
"affectedContactIds": [
723,
2
],
"transaction": {
"id": 0,
"createdById": 724,
"type": "UCD",
"date": "2024-02-07T03:41:59.823195+00:00",
"reference": "652-1706532591283",
"currencyCode": "USD",
"amount": 5
}
}
# Approved Transaction
{
"statusType": 2,
"status": "Accepted",
"description": null,
"affectedContactIds": [
723,
2
],
"transaction": {
"id": 3169,
"createdById": 724,
"type": "UCD",
"date": "2024-02-07T03:43:50.9186754+00:00",
"reference": "652-1706532591283",
"currencyCode": "USD",
"amount": 5
}
}
| Parameter |
Id of the person who creates the transaction
type The type of transaction (UCD = Card Deposit) date The date of the transaction reference Recipient's unique transaction identifier for this transaction currencyCode The currency of this transaction amount The amount of this transactionRejected Transaction Response on Webhook (Sample)
{
"statusType":3,
"status":"Rejected",
"description":"Reason for rejection",
"actionedById":1,
"affectedContactIds":[]
"transaction": {
"id":0,
"createdById":2,
"type":"UCD",
"date":"2021-04-20T20:34:00.7606173+02:00",
"reference":234234234,
"currencyCode":"USD",
"amount":100.00
}
}
The following is a list of approval status codes that could be returned
- 0 = None - Used for testing
Update Payment Webhook
Payment Webhook is triggered when a payment transaction with an action set to 2 (callback) is created.
Callbacks are only sent to the profile that created the transaction.
Callbacks will keep sending requests to the platform for 24 hours or until it gets a response.
If a 200 (success) response is received then the transaction will be processed.
If any other response (except a timeout) is received then the transaction will be voided.
Request
curl --location --request PUT '{baseurl}/Preference/SetPaymentWebhook?url={url}' \
--header 'Accept: text/plain; x-api-version=1.0' \
--header 'x-api-version: {apiversion}' \
--header 'x-api-key: {apikey}'
| Parameter | Description |
| url | Url to receive callbacks |
Response (200)