Transaction Endpoints (api/Transaction)
General Definitions
Parameter | Description |
baseurl |
Sandbox - https://test.xprizo.com/api |
apiversion | 1.0 |
apikey | API key For authentication |
To obtain the API key for authentication, click here to generate the API key.
Create Deposit Request Using a Card
Request
curl --location '{baseurl}/Transaction/CardDeposit' \
--header 'Accept: text/plain; x-api-version=1.0' \
--header 'Content-Type: application/json; x-api-version=1.0' \
--header 'x-api-version: {apiversion}' \
--header 'x-api-key: {apikey}' \
--data '{
"description": <purpose of deposit>,
"reference": <unique reference>,
"amount": <the deposit amount>,
"accountId": <merchants wallet id>,
"transferAccountId": <wallet id where deposit amount will be transferred>,
"customer": <unique name for the depositor>,
"creditCard": {
"name": <name on card>,
"number": <card number>,
"expiryMonth":<2 diget expiry month 01-12>,
"expiryYear": <2 diget expiry year>,
"cvv": <3 or 4 digets>
},
"routingCode": "string",
"redirect": "string"
}'
Response (200)
{
"key": <a unique identifier for the transaction>,
"statusCode": <The number equivalent of the Status>,
"status": <Active/Rejected/Pending/Redirect>,
"value": <billingcode/reason/url>
}
Parameter | Description |
key | a unique identifier for the transaction |
statusCode | The number equivalent of the Status |
status |
|
value |
|
Errors
- 400 (Bad Request) The transaction could not be completed. The reason is returned Check the error, contact Xprizo, or fix the problem and try again.
-
Message
Detail of Message Invalid routing codeYour account does not have the routing code configured. Please contact the Xprizo team to have this set up. Invalid routing code (No Mid Set)Your account does not have the MID configured. Please reach out to the Xprizo team to have this configured. A transaction with this reference already existsYou need to generate a new reference and try again A pending transaction with this reference already exists (Ref:652-1706532591287))The transaction is already available for this reference number with status pending, please check the status of this or try again with a new reference number
-
- 401 (Unauthorized) Invalid or expired token.
- 403 (Forbidden) You do not have the right to create or approve this transaction.
- 500 (Internal Server Error) A critical unexpected system error has occurred. Contact Xprizo and report the error.
Test Configuration For Routing Options
Routing Option | Routing Code Prefix | Configuration |
Option A | MAN |
Amount
|
Create a Deposit Request Using the Xprizo Wallet
Request
curl --location '{baseurl}/Transaction/RequestPayment' \
--header 'Accept: text/plain; x-api-version=1.0' \
--header 'Content-Type: application/json; x-api-version=1.0' \
--header 'x-api-version: {apiversion}' \
--header 'x-api-key: {apikey}' \
--data '{
"fromAccountId": <users_account_id>,
"toAccountId": <your_account_id>,
"description": <purpose of deposit>,
"amount": <requested amount>,
"reference":<unique reference>
}'
Parameter | Description |
fromAccountId | This is the ID of the payee's wallet - the user who is paying out the funds |
toAccountId | This is the ID of recipient's wallet - the user who will receive the funds |
description | (Optional) Text that can be used to describe the reason for the transaction |
amount | The amount of the transaction |
reference | A unique reference is created so that you can identify and link this transaction to your system |
Response (200)
{
"key":<a unique identifier for the transaction>,
"approveById": <id of the person to approve the transaction>,
"canCancel": <can be cancelled or not>,
"ttl": <time left in seconds>,
"expiryDate": <date/time when the transaction expires>,
"error": ""
}
Parameter | Description |
key | a unique identifier for the transaction |
approveById
|
<id of the person to approve the transaction> |
canCancel
|
<can be cancelled or not> |
expiryDate
|
<date/time when the transaction expires> |
ttl |
<time left in seconds> |
Errors
- 400 (Bad Request) The transaction could not be completed. The reason is returned Check the error, contact Xprizo, or fix the problem and try again.
- 401 (Unauthorized) Invalid or expired token.
- 403 (Forbidden) You do not have the right to create or approve this transaction.
- 500 (Internal Server Error) A critical unexpected system error has occurred. Contact Xprizo and report the error.
Create a Deposit Request Using Mpesa Wallet
Request
curl --location '{baseurl}/Transaction/MPesaDeposit' \
--header 'Accept: text/plain; x-api-version=1.0' \
--header 'Content-Type: application/json; x-api-version=1.0' \
--header 'x-api-version: {apiversion}' \
--header 'x-api-key: {apikey}' \
--data '{
"mobileNumber": <mpesa_mobile_number>,
"accountId": <your_account_id>,
"description": <purpose of deposit>,
"amount": <requested amount>,
"reference":<unique reference>
}'
Parameter | Description |
mobileNumber | Mpesa Mobile number to be used for transaction |
accountId | This is the ID of recipient's wallet - the user who will receive the funds. You can check your account id here |
description |
(Optional) Text that can be used to describe the reason for the transaction. In Test Mode. use:-
|
amount | The amount of the transaction |
reference | A unique reference is created so that you can identify and link this transaction to your system |
Response (200)
{
"key": <a unique identifier for the transaction>,
"statusCode": <The number equivalent of the Status>,
"status": <Active/Rejected/Pending>,
"value": <transaction description>
}
Parameter | Description |
key | a unique identifier for the transaction |
statusCode | The number equivalent of the Status |
status |
|
value |
|
Errors
- 400 (Bad Request) The transaction could not be completed. The reason is returned Check the error, contact Xprizo, or fix the problem and try again.
- 401 (Unauthorized) Invalid or expired token.
- 403 (Forbidden) You do not have the right to create or approve this transaction.
- 500 (Internal Server Error) A critical unexpected system error has occurred. Contact Xprizo and report the error.
Create a Withdrawal Request Using Mpesa
Request
curl --location '{baseurl}/Transaction/MPesaWidthdrawal' \
--header 'Accept: text/plain; x-api-version=1.0' \
--header 'Content-Type: application/json; x-api-version=1.0' \
--header 'x-api-version: {apiversion}' \
--header 'x-api-key: {apikey}' \
--data '{
"mobileNumber": <mpesa_mobile_number>,
"accountId": <your_account_id>,
"description": <purpose of deposit>,
"amount": <requested amount>,
"reference":<unique reference>
}'
Parameter | Description |
mobileNumber | Mpesa Mobile number to be used for transactions. Who will receive the funds. Sample +254706****73 |
accountId | This is the ID of your wallet - You can check your account ID here |
description |
(Optional) Text that can be used to describe the reason for the transaction. In Test Mode. use:-
|
amount | The amount of the transaction |
reference | A unique reference is created so that you can identify and link this transaction to your system |
Response (200)
{
"key": <a unique identifier for the transaction>,
"statusCode": <The number equivalent of the Status>,
"status": <Active/Rejected/Pending>,
"value": <transaction description>
}
Parameter | Description |
key | a unique identifier for the transaction |
statusCode | The number equivalent of the Status |
status |
|
value |
|
Errors
- 400 (Bad Request) The transaction could not be completed. The reason is returned Check the error, contact Xprizo, or fix the problem and try again.
- 401 (Unauthorized) Invalid or expired token.
- 403 (Forbidden) You do not have the right to create or approve this transaction.
- 500 (Internal Server Error) A critical unexpected system error has occurred. Contact Xprizo and report the error.
Create a Deposit Request Using UPI
Request
curl --location '{baseurl}/Transaction/UpiDeposit' \
--header 'Accept: text/plain; x-api-version=1.0' \
--header 'Content-Type: application/json; x-api-version=1.0' \
--header 'x-api-version: {apiversion}' \
--header 'x-api-key: {apikey}' \
--data '{
"accountId": <your_account_id>,
"description": <purpose of deposit>,
"amount": <requested amount>,
"reference":<unique reference>
}'
Parameter | Description |
accountId | This is the ID of the recipient's wallet - the user who will receive the funds. You can check your account ID here |
description |
(Optional) Text that can be used to describe the reason for the transaction. |
amount | The amount of the transaction |
reference | A unique reference is created so that you can identify and link this transaction to your system |
Response (200)
{
"key": <a unique identifier for the transaction>,
"statusCode": <The number equivalent of the Status>,
"status": <status>,
"description": <Content of QR Code>
"value": <Image date of QR code>
}
Parameter | Description |
key | a unique identifier for the transaction |
statusCode | The number equivalent of the Status |
status |
Pending – The transaction request is created and needs further action by the user. In Test Mode, You need to simulate the success case using the below-mentioned endpoint |
value |
Image data for QR code, you need to use this to display on User Interface. |
description |
Content of QR code |
When utilizing the UpiDeposit function, do not send anything in the redirect field to opt for the QrCode option. Omitting the redirect triggers the IFrame screen, but without it, you'll receive a response containing the UPI QrCode. Display this QrCode to the user for seamless integration.
Errors
- 400 (Bad Request) The transaction could not be completed. The reason is returned Check the error, contact Xprizo, or fix the problem and try again.
- 401 (Unauthorized) Invalid or expired token.
- 403 (Forbidden) You do not have the right to create or approve this transaction.
- 500 (Internal Server Error) A critical unexpected system error has occurred. Contact Xprizo and report the error.
Validate UPI Deposit
The UpiDepositResponse function is utilized by our Acquirer. They invoke this function once the user has processed the transaction or after approximately 30 minutes to cancel the QrCode if it remains unused.
Upon calling the UpiDeposit endpoint and receiving the QrCode, a new transaction is presented in the wallet with a "Pending" status. This status persists until our acquirer either validates or cancels the QrCode using the UpiDepositResponse function.
During testing, an option is provided to call this function by passing the Key of the request generated using UpiDeposit. In test mode, invoking this function automatically "Approves" the transaction, transitioning it to an active state.
Request
curl --location '{baseurl}/Transaction/UpiDepositResponse?key={key}' \
--header 'Accept: text/plain; x-api-version=1.0' \
--header 'x-api-version: {apiversion}' \
--header 'x-api-key: {apikey}'
Parameter | Description |
key | a unique identifier for the transaction |
Response (200)
{
"key": <a unique identifier for the transaction>,
"statusCode": <The number equivalent of the Status>,
"status": <Active/Pending/Cancelled>
}
Parameter | Description |
key | a unique identifier for the transaction |
statusCode | The number equivalent of the Status |
status |
Active/Pending/Cancelled |
Errors
- 400 (Bad Request) The transaction could not be completed. The reason is returned Check the error, contact Xprizo, or fix the problem and try again.
- 401 (Unauthorized) Invalid or expired token.
- 403 (Forbidden) You do not have the right to create or approve this transaction.
- 500 (Internal Server Error) A critical unexpected system error has occurred. Contact Xprizo and report the error.
Send Payment Using Xprizo Wallet
Request
curl --location '{baseurl}/Transaction/SendPayment?action=<action>&pin=<pin>' \
--header 'Accept: text/plain; x-api-version=1.0' \
--header 'Content-Type: application/json; x-api-version=1.0' \
--header 'x-api-version: {apiversion}' \
--header 'x-api-key: {apikey}' \
--data '{
"fromAccountId":<your_account_id>,
"toAccountId": <users_account_id>,
"reference": <unique reference>,
"amount": <requested amount>,
"description": <purpose of payment>
}'
Parameter | Description |
action |
0 or default (Transaction will go in approval mode and payee needs to approve the transaction) 1 (Transaction will be completed with any approval) 2 (Transaction will be on hold until Xprizo will receive HTTP code 200 on payment webhook) |
pin | Required if the user implemented "Approval Security" |
fromAccountId | This is the ID of the payee's wallet - the user who is paying out the funds |
toAccountId | This is the ID of the recipient's wallet - the user who will receive the funds |
description | (Optional) Text that can be used to describe the reason for the transaction |
amount | The amount of the transaction |
reference | A unique reference is created so that you can identify and link this transaction to your system |
Response (200) If action = 0 or Not provided in request
{
"key":<a unique identifier for the transaction>,
"approveById": <id of the person to approve the transaction>,
"canCancel": <can be cancelled or not>,
"ttl": <time left in seconds>,
"expiryDate": <date/time when the transaction expires>,
"error": ""
}
Parameter | Description |
key | a unique identifier for the transaction |
approveById
|
<id of the person to approve the transaction> |
canCancel
|
<can be cancelled or not> |
expiryDate
|
<date/time when the transaction expires> |
ttl |
<time left in seconds> |
Response (200) If action = 1 or 2
{
"id":<a unique identifier for the transaction>,
"description": "<The type of transaction processed (Payment)>"
}
Errors
- 400 (Bad Request) The transaction could not be completed. The reason is returned Check the error, contact Xprizo, or fix the problem and try again.
- 401 (Unauthorized) Invalid or expired token.
- 403 (Forbidden) You do not have the right to create or approve this transaction.
- 500 (Internal Server Error) A critical unexpected system error has occurred. Contact Xprizo and report the error.
Approve Payment Created Using Xprizo Wallet
Request
curl --location '{baseurl}/Transaction/ApprovalAccept?key=<key>&pin=<pin>&once=<true/false>' \
--header 'Accept: text/plain; x-api-version=1.0' \
--header 'Content-Type: application/json; x-api-version=1.0' \
--header 'x-api-version: {apiversion}' \
--header 'x-api-key: {apikey}'
Parameter | Description |
key |
A unique ID of the transaction you wish to approve |
pin | Required if the user implemented "Approval Security" |
once | Set this to true, if you want to automatically cancel this transaction if an error occurs when processing the transaction. |
Response (200)
{
"id":<a unique identifier for the transaction>,
"description": "<The type of transaction processed (Payment)>"
}
Cancel Payment Created Using Xprizo Wallet
Request
curl --location '{baseurl}/Transaction/ApprovalCancel?key=<key>' \
--header 'Accept: text/plain; x-api-version=1.0' \
--header 'Content-Type: application/json; x-api-version=1.0' \
--header 'x-api-version: {apiversion}' \
--header 'x-api-key: {apikey}'
Parameter | Description |
key |
A unique ID of the transaction you wish to approve |
Response (200) Transaction is canceled successfully
Transaction Status Check
This endpoint can be used to check the status of any type of transaction for example card deposit, Mpesa withdrawal etc.
Request
curl --location '{baseurl}/Transaction/Status/{accountId}/?reference={reference}' \
--header 'x-api-version: {apiversion}' \
--header 'x-api-key: {apikey}'
Parameter | Description |
accountId | This is the ID of the wallet that contains the transaction. When requesting a payment use the ID of the recipient's wallet. |
reference | The reference is the Merchants unique transaction identifier for this transaction |
Response (200)
{
"key" : <a unique identifier for the transaction>
"statusCode" : <0/3/1/-1/4/5/6>
"status" : <Active/Rejected/Pending/NotFound/Cancelled/Hold/Void >
"value" : <billingdescription/transaction description/Void reason>
}
# Pending Transaction
{
"key": "",
"statusCode": 1,
"status": "Pending",
"value": "Pass"
}
# Approved Transaction
{
"key": "3169",
"statusCode": 0,
"status": "Active",
"value": "testing.com Pass"
}
# Rejected Transaction
{
"key": "144",
"statusCode": 3,
"status": "Rejected",
"value": "Failed Test"
}
# Not Found Transaction
{
"key": "",
"statusCode": -1,
"status": "NotFound",
"value": ""
}
# Hold Transaction (Mpesa Withdrawal)
{
"key": "144",
"statusCode": 5,
"status": "Hold",
"value": "Mpesa Withdrawal +254342222222"
}
# Void Transaction (Mpesa Withdrawal)
{
"key": "144",
"statusCode": 6,
"status": "Void",
"value": "342222222 Voided: No Response Data"
}
Parameter | Description |
key |
This is the unique ID of the transaction.
|
status |
The status of the transaction - It can be one of the following:
|
value |
|