Skip to main content

Transaction Endpoints (api/Transaction)

General Definitions

Parameter Description
baseurl

Sandbox - https://test.xprizo.com/api

Live- https://wallet.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"
}'
Parameter Description
accountId (Required) This is the ID of the recipient's wallet - the wallet into which the funds will be deposited. You can check your account id here
transferAccountId

(Optional) This is the ID of the recipient's wallet - the wallet where the funds should be transferred after a deposit has been made to the main wallet.

**Note: This is required when you want to deposit money in a wallet of currency that is not supported by the acquirer. For this, we will do an internal transfer and at the time of the transfer currency conversion charges will be applicable.

reference (Required) The reference is the unique transaction identifier for this transaction. This will be generated by processor user and will be used in status checks and callbacks.
customer (Required) A unique identifier of the person making the deposit. If this customer is not found in the system, they will be added to recipient's the address book. You can pass email id of that user.
amount (Required) The deposit amount, with 2 decimal places, using dot as the decimal.
description (Optional) Text that can be used to describe the reason for the deposit. In Test Mode. use:-
  • Pass, Success - the transaction will be created as approved.
  • Reject, Fail, Cancel - the transaction will be created and then rejected.
routingCode Use one of the routing codes that have been set on your account (routing codes are used for different currencies and limits). This will be configured by the Xprizo Team and you can find these here.
redirect (Required for 3DS) If the card is processed using 3ds then you will need to open a confirmation screen (the redirect URL for the confirmation screen is returned in the response to this request).  This redirect is the URL that the user will be returned to after the confirmation screen has been closed.

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
  • Active – The transaction was completed successfully
  • Pending – The transaction was unable to be completed and needs further action
  • Rejected - The transaction was rejected
  • Redirect – (3DS) the user needs to be redirected to another URL to complete the transaction
value
  • Active – the value will show the description
  • Pending - the value will show the description
  • Rejected - the value will show the reason
  • Redirect - the value will show the URL to redirect to


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 code
      Your 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 exists
      You 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

  • $1.00  or $2.00  -    Active( 2DS Success)
  • $3.00  or $4.00  -    Rejected
  • $5.00  or $6.00  -    Rdirect (3DS Redirect URL)
  • $7.00  or greater  - Rejected Case In 3DS






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:-

  • Pass, Success - the transaction will be created as approved.
  • Reject, Fail, Cancel - the transaction will be created and then rejected.
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
  • Active – The transaction was completed successfully
  • Pending – The transaction was unable to be completed and needs further action
  • Rejected - The transaction was rejected
value
  • Active – the value will show the description
  • Pending - the value will show the description
  • Rejected - the value will show the reason

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:-

  • Pass, Success - the transaction will be created as approved.
  • Reject, Fail, Cancel - the transaction will be created and then rejected.
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
  • Active – The transaction was completed successfully
  • Pending – The transaction was unable to be completed and needs further action
  • Rejected - The transaction was rejected
value
  • Active – the value will show the description
  • Pending - the value will show the description
  • Rejected - the value will show the reason

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.

  • When Active or Hold or Void this will contain the transaction ID
  • When Rejected or Cancelled, it will be the ID given in the log file for the entry.
  • When pending or NotFound, it will be blank.
status

 The status of the transaction - It can be one of the following:

  • Active - The transaction is a valid active transaction
  • Pending - The transaction is awaiting approval (or rejection).
  • NotFound - A transaction on this wallet, with this reference does not exist. 
  • Rejected - the transaction has been rejected by the acquirer.
  • Cancelled - If Xprizo cancels the transaction due to technical error or invalid calls.
  • Hold - This is applicable for Mpesa withdrawal 
value
  • When Active this will contain the billing description For card deposit & transaction description for other transactions.
  • When Hold this will contain the withdrawal description
  • When Void this will contain the void reason
  • When Rejected or Cancelled, it will contain the reason.
  • When pending or NotFound, it will be blank