# Transaction Endpoints (api/Transaction) ### **General Definitions**
**Parameter****Description**
baseurlSandbox - [https://test.xprizo.com/api](https://test.xprizo.com/api) Live- [https://wallet.xprizo.com/api](https://wallet.xprizo.com/api)
apiversion1.0
apikeyAPI key For authentication
To obtain the API key for authentication, click [here](https://books.xprizo.com/link/51#bkmrk-click-on-%22create-api) to generate the API key. ### **Create Deposit Request Using a Card**

**Request**

```text 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": , "reference": , "amount": , "accountId": , "transferAccountId": , "customer": , "creditCard": { "name": , "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](https://books.xprizo.com/link/13#bkmrk-know-your-account-id)
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.
routingCodeUse 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](https://books.xprizo.com/books/user-manual/page/card-routing-codes).**
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)**

```text { "key": , "statusCode": , "status": , "value": } ```
**Parameter****Description**
keya unique identifier for the transaction
statusCodeThe 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 AMAN**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**

```text 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": , "toAccountId": , "description": , "amount": , "reference": }' ```
**Parameter****Description**
fromAccountIdThis is the ID of the payee's wallet - the user who is paying out the funds
toAccountIdThis 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
amountThe amount of the transaction
referenceA unique reference is created so that you can identify and link this transaction to your system

**Response (200)**

```text { "key":
, "approveById": , "canCancel": , "ttl": , "statusCode": , "status": , "value": } ```
**Parameter****Description**
keya unique identifier for the transaction
statusCodeThe 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**

```text 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": , "accountId": , "description": , "amount": , "reference": }' ```
**Parameter****Description**
mobileNumberMpesa Mobile number to be used for transactions. Who will receive the funds. Sample +254706\*\*\*\*73
accountIdThis is the ID of your wallet - You can check your account ID [here](https://books.xprizo.com/link/13#bkmrk-know-your-account-id)
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.
amountThe amount of the transaction
referenceA unique reference is created so that you can identify and link this transaction to your system

**Response (200)**

```text { "key":
, "statusCode": , "status": , "value": } ```
**Parameter****Description**
keya unique identifier for the transaction
statusCodeThe 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**

```text 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": , "description": , "amount": , "reference": }' ```
**Parameter****Description**
accountIdThis is the ID of the recipient's wallet - the user who will receive the funds. You can check your account ID [here](https://books.xprizo.com/link/13#bkmrk-know-your-account-id)
description(Optional) Text that can be used to describe the reason for the transaction.
amountThe amount of the transaction
referenceA unique reference is created so that you can identify and link this transaction to your system

**Response (200)**

```text { "key":
, "statusCode": , "status": , "description": "value": } ```
**Parameter****Description**
keya unique identifier for the transaction
statusCodeThe number equivalent of the Status
statusPending – 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
valueImage data for QR code, you need to use this to display on User Interface.
descriptionContent 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**

```text 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**
keya unique identifier for the transaction

**Response (200)**

```text { "key":
, "statusCode": , "status": } ```
**Parameter****Description**
keya unique identifier for the transaction
statusCodeThe number equivalent of the Status
statusActive/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

```bash curl --location '{baseurl}/Transaction/SendPayment?action=&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":, "toAccountId": , "reference": , "amount": , "description": }' ```
**Parameter****Description**
action0 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)
pinRequired if the user implemented "Approval Security"
fromAccountIdThis is the ID of the payee's wallet - the user who is paying out the funds
toAccountIdThis 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
amountThe amount of the transaction
referenceA 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**

```text { "key":
, "approveById": , "canCancel": , "ttl": , "description": "" } ```

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

```bash curl --location '{baseurl}/Transaction/ApprovalAccept?key=&pin=&once=' \ --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**
keyA unique ID of the transaction you wish to approve
pinRequired if the user implemented "Approval Security"
onceSet this to true, if you want to automatically cancel this transaction if an error occurs when processing the transaction.

**Response (200)**

```text { "id":
, "description": "" } ```
### **Cancel Payment Created Using Xprizo Wallet**

Request

```bash curl --location '{baseurl}/Transaction/ApprovalCancel?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**
keyA 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**

```bash curl --location '{baseurl}/Transaction/Status/{accountId}/?reference={reference}' \ --header 'x-api-version: {apiversion}' \ --header 'x-api-key: {apikey}' ```
**Parameter****Description**
accountIdThis is the ID of the wallet that contains the transaction. When requesting a payment use the ID of the recipient's wallet.
referenceThe reference is the Merchants unique transaction identifier for this transaction

**Response (200)**

```bash { "key" :
"statusCode" : <0/3/1/-1/4/5/6> "status" : "value" : } # 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**
keyThis 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