# Transaction Endpoints (api/Transaction)

<p class="callout success">Tip: Use the page navigation section on the left to navigate quickly from one endpoint to another.</p>

### **General Definitions**

<table border="1" id="bkmrk-parameter-descriptio" style="border-collapse: collapse; width: 87.1605%; height: 148.42px;"><tbody><tr style="height: 29.8785px;"><td style="width: 50%; height: 29.8785px;">**Parameter**</td><td style="width: 50%; height: 29.8785px;">**Description**</td></tr><tr style="height: 58.7847px;"><td style="width: 50%; height: 58.7847px;">baseurl</td><td style="width: 50%; height: 58.7847px;">Sandbox - [https://test.xprizo.com/api](https://test.xprizo.com/api)

Live- [https://wallet.xprizo.com/api](https://wallet.xprizo.com/api)

</td></tr><tr style="height: 29.8785px;"><td style="width: 50%; height: 29.8785px;">apiversion</td><td style="width: 50%; height: 29.8785px;">1.0</td></tr><tr style="height: 29.8785px;"><td style="width: 50%; height: 29.8785px;">apikey</td><td style="width: 50%; height: 29.8785px;">API key For authentication</td></tr></tbody></table>

To obtain the API key for authentication, click <span style="color: #3598db;">[here](https://books.xprizo.com/link/51#bkmrk-click-on-%22create-api)</span> to generate the API key.

### **Deposit With Card**

<p class="callout info">**Request**</p>

```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": "<Description/narrative for the deposit/payment>",
 "reference": "<Unique reference>",
 "amount": <Deposit/payment amount, 2 decimal places, dot as decimal>,
 "accountId": <ID of the wallet into which the amount will be deposited - NOT profile ID>,
 "transferAccountId": <ID of the wallet to which the amount will be transferred after depositing, typically used for currency conversion - SEE NOTES BELOW>,
 "customerData": {
 "name": "<Full name of the user/customer>",
 "email": "<Email address of the user/customer>",
 "mobile": "<Mobile phone number of the user/customer>",
 "birthDate": "<Date of birth of the user/customer. String with format 'YYYY-MM-DD'>",
 "gender": "<Gender of the user/customer. 'M', 'F', or 'X'>",
 "address": {
 "address": "<Building number/name, unit/apt number/letter, etc>",
 "street": "<Name of street, roadway, thoroughfare, etc>",
 "city": "<Name of town, city, etc>",
 "zipPostalCode": "<Alphanumeric depending on country>",
 "stateProvinceRegion": "<Administrative sub-division, such as state, province, or territory>",
 "countryCode": "<Two-letter string using uppercase characters, e.g., 'KE', 'AE'>"
 },
 "IpAddress": "<Customer's IP address in string format, IPv4 or IPv6>"
 },
 "creditCard": {
 "name": "<Name on card>",
 "number": "<Card number>",
 "expiryMonth": <2 digit expiry month, 01-12>,
 "expiryYear": <4 digit expiry year>,
 "cvv": "<3 or 4 digits>"
 },
 "routingCode": "string",
 "redirect": "string"
}'
```

Please note that if a parameter is indicated as REQUIRED, providing that parameter is MANDATORY. **The transaction will be rejected if any mandatory parameter is missing.**

**DO NOT** use the same card details, or the same customerData information, for multiple users/customers - it will be detected and your transactions **rejected**.

If you manage to process transactions with any of the mandatory fields missing, **we provide no guarantee that you will be able to continue doing so, and will provide no advance notice when enforcing of such mandatory fields is implemented and deployed**.

<div class="codeBlockContainer_Ckt0 theme-code-block" id="bkmrk--6"><div class="codeBlockContent_biex"><div class="buttonGroup__atx"><div class="theme-admonition theme-admonition-info alert alert--info admonition_LlT9" id="bkmrk-parameter-descriptio-17" style="outline-color: var(--color-primary); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Oxygen, Ubuntu, Roboto, Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;"><div class="theme-admonition theme-admonition-info alert alert--info admonition_LlT9" style="outline-color: var(--color-primary);"><div class="admonitionHeading_tbUL" style="outline-color: var(--color-primary);">  
<table border="1" style="outline-color: var(--color-primary); height: 245.969px; width: 703px;"><tbody style="outline-color: var(--color-primary);"><tr style="outline-color: var(--color-primary); height: 29.7969px;"><td style="outline-color: var(--color-primary); width: 351px; height: 29.7969px;">**Parameter**</td><td style="outline-color: var(--color-primary); width: 351px; height: 29.7969px;">**Description**</td></tr><tr style="outline-color: var(--color-primary); height: 46.5938px;"><td style="outline-color: var(--color-primary); width: 351px; height: 46.5938px;">accountId</td><td style="outline-color: var(--color-primary); width: 351px; height: 46.5938px;">(**REQUIRED**) This is the ID of the wallet into which the amount will be deposited.

Do NOT use profile ID here.

The Wallet ID can be seen in the 'Wallets' screen of your Xprizo console/dashboard, column 'Account'.

</td></tr><tr><td style="outline-color: var(--color-primary); width: 351px;">transferAccountId</td><td style="outline-color: var(--color-primary); width: 351px;">(Optional) This is the ID of the wallet to which the amount will be transferred after depositing.

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

</td></tr><tr style="outline-color: var(--color-primary); height: 46.5938px;"><td style="outline-color: var(--color-primary); width: 351px; height: 46.5938px;">reference</td><td style="outline-color: var(--color-primary); width: 351px; height: 46.5938px;">(**REQUIRED**) A unique, alphanumeric string used to identify and track this specific transaction within your own system.

If you're a merchant, you can use your own order ID here, as long as it is unique.

</td></tr><tr style="outline-color: var(--color-primary); height: 63.3906px;"><td style="outline-color: var(--color-primary); width: 351px; height: 63.3906px;">customer</td><td style="outline-color: var(--color-primary); width: 351px; height: 63.3906px;">(Deprecated) Please provide "customerData" object with user/customer details.</td></tr><tr><td style="outline-color: var(--color-primary); width: 351px;">name</td><td style="outline-color: var(--color-primary); width: 351px;">(**REQUIRED**) The full name of the user/customer. MUST match name on card.</td></tr><tr><td style="outline-color: var(--color-primary); width: 351px;">email</td><td style="outline-color: var(--color-primary); width: 351px;">(**REQUIRED**) Email address of the user/customer. DO NOT use one email address for multiple users/customers.</td></tr><tr><td style="outline-color: var(--color-primary); width: 351px;">mobile</td><td style="outline-color: var(--color-primary); width: 351px;">(**REQUIRED**) Mobile phone number of the user/customer. Must be provided in E.164 format, which consists of a leading + symbol followed by the country code and the full subscriber number (including area code) without any spaces, dashes, or leading zeros (e.g., "+25412345678"). DO NOT use one mobile phone number for multiple users/customers.</td></tr><tr><td style="outline-color: var(--color-primary); width: 351px;">birthDate</td><td style="outline-color: var(--color-primary); width: 351px;"><div><div>(**REQUIRED**) The date of birth of the user/customer. String with format "YYYY-MM-DD".</div></div></td></tr><tr><td style="outline-color: var(--color-primary); width: 351px;">gender</td><td style="outline-color: var(--color-primary); width: 351px;">(**REQUIRED**) The gender of the user/customer. Must be 'M', 'F', or 'X'.</td></tr><tr><td style="outline-color: var(--color-primary); width: 351px;">address</td><td style="outline-color: var(--color-primary); width: 351px;">(**REQUIRED**) Building number/name, unit/apt number/letter, etc, of the user/customer's postal address.</td></tr><tr><td style="outline-color: var(--color-primary); width: 351px;">street</td><td style="outline-color: var(--color-primary); width: 351px;">(**REQUIRED**) Name of street, roadway, thoroughfare, etc, of the user/customer's postal address.</td></tr><tr><td style="outline-color: var(--color-primary); width: 351px;">city</td><td style="outline-color: var(--color-primary); width: 351px;">(**REQUIRED**) Name of town, city, etc, of the user/customer's postal address.</td></tr><tr><td style="outline-color: var(--color-primary); width: 351px;">zipPostalCode</td><td style="outline-color: var(--color-primary); width: 351px;">(**REQUIRED**) Zip/post code of the user/customer's postal address. Alphanumeric depending on country.</td></tr><tr><td style="outline-color: var(--color-primary); width: 351px;">stateProvinceRegion</td><td style="outline-color: var(--color-primary); width: 351px;">(Optional) Administrative sub-division, such as state, province, or territory, of the user/customer's postal address.</td></tr><tr><td style="outline-color: var(--color-primary); width: 351px;">countryCode</td><td style="outline-color: var(--color-primary); width: 351px;">(**REQUIRED**) Country of the user/customer's postal address. The country code must be provided as a two-letter string following the ISO 3166-1 alpha-2 standard, using uppercase characters (e.g., "KE", "AE").</td></tr><tr><td style="outline-color: var(--color-primary); width: 351px;">ipAddress</td><td style="outline-color: var(--color-primary); width: 351px;">(**REQUIRED**) Customer's IP address in string format, IPv4 or IPv6.</td></tr><tr><td style="outline-color: var(--color-primary); width: 351px;">amount</td><td style="outline-color: var(--color-primary); width: 351px;">(**REQUIRED**) The deposit amount, with 2 decimal places, using dot as the decimal.</td></tr><tr style="outline-color: var(--color-primary); height: 29.7969px;"><td style="outline-color: var(--color-primary); width: 351px; height: 29.7969px;">description</td><td style="outline-color: var(--color-primary); width: 351px; height: 29.7969px;">(**REQUIRED**) Description/narrative for the deposit/payment.</td></tr><tr style="outline-color: var(--color-primary);"><td style="outline-color: var(--color-primary); width: 351px;">routingCode</td><td style="outline-color: var(--color-primary); width: 351px;">Use one of the routing codes that have been set on your account (routing codes are used for different currencies and limits).

**These will be configured by the Xprizo Team and you can find them <span style="color: #3598db;">[here](https://books.xprizo.com/books/user-manual/page/card-routing-codes)</span>.**

</td></tr><tr style="outline-color: var(--color-primary);"><td style="outline-color: var(--color-primary); width: 351px;">redirect</td><td style="outline-color: var(--color-primary); width: 351px;">(**REQUIRED**) The card is processed using 3DS, so 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.

</td></tr></tbody></table>

</div></div></div></div></div></div>#####   


<p class="callout info">**Response (200)**</p>

```text
{
    "key": <a unique identifier for the transaction>,
    "statusCode": <The number equivalent of the Status>,
    "status": <Active/Rejected/Pending/Redirect>,
    "value": <billingcode/reason/url>
}
```

<div class="admonitionHeading_tbUL" id="bkmrk-parameter-descriptio-0"><table border="1" style="border-collapse: collapse; width: 86.9136%;"><tbody><tr><td style="width: 50.0618%;">**Parameter**</td><td style="width: 50.0618%;">**Description**</td></tr><tr><td style="width: 50.0618%;">key</td><td style="width: 50.0618%;">a unique identifier for the transaction</td></tr><tr><td style="width: 50.0618%;">statusCode</td><td style="width: 50.0618%;">The number equivalent of the Status</td></tr><tr><td style="width: 50.0618%;">status</td><td style="width: 50.0618%;">- 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

</td></tr><tr><td style="width: 50.0618%;">value</td><td style="width: 50.0618%;">- 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

</td></tr></tbody></table>

</div><p class="callout danger">Errors</p>

- **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. 
    - <table border="1" style="border-collapse: collapse; width: 100%; height: 93.1876px;"><tbody><tr><td style="width: 31.9706%;"><div><div>**Message**</div></div></td><td style="width: 68.1636%;">**Detail of Message**</td></tr><tr style="height: 46.5938px;"><td style="width: 31.9706%; height: 46.5938px;"><div><div>Invalid routing code</div></div></td><td style="width: 68.1636%; height: 46.5938px;">Your account does not have the routing code configured. Please contact the Xprizo team to have this set up. </td></tr><tr style="height: 46.5938px;"><td style="width: 31.9706%; height: 46.5938px;"><div><div>Invalid routing code (No Mid Set)</div></div></td><td style="width: 68.1636%; height: 46.5938px;">Your account does not have the MID configured. Please reach out to the Xprizo team to have this configured.</td></tr><tr><td style="width: 31.9706%;"><div><div><div><div>A transaction with this reference already exists</div></div></div></div></td><td style="width: 68.1636%;">You need to generate a new reference and try again</td></tr><tr><td style="width: 31.9706%;"><div><div><div><div><div><div>A pending transaction with this reference already exists (Ref:652-1706532591287))</div></div></div></div></div></div></td><td style="width: 68.1636%;">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 </td></tr></tbody></table>
- **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.

<p class="callout info">Test Configuration For Routing Options</p>

<table border="1" id="bkmrk-routing-option%C2%A0-rout" style="border-collapse: collapse; width: 88.642%;"><tbody><tr><td style="width: 15.4512%;">**Routing Option** </td><td style="width: 20.5192%;">**Routing Code Prefix** </td><td style="width: 64.0297%;">**Configuration**</td></tr><tr><td style="width: 15.4512%;">Option A</td><td style="width: 20.5192%;">MAN</td><td style="width: 64.0297%;">**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

</td></tr><tr><td style="width: 15.4512%;">  
</td><td style="width: 20.5192%;">  
</td><td style="width: 64.0297%;">  
</td></tr><tr><td style="width: 15.4512%;">  
</td><td style="width: 20.5192%;">  
</td><td style="width: 64.0297%;">  
</td></tr></tbody></table>

### **Deposit With Xprizo Wallet**

<p class="callout info">**Request**</p>

```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": <users_account_id>,
    "toAccountId": <your_account_id>,
    "description": <purpose of deposit>,
    "amount": <requested amount>,
    "reference":<unique reference>
}'
```

<table border="1" id="bkmrk-parameter-descriptio-1" style="border-collapse: collapse; width: 100%; height: 178.781px;"><tbody><tr style="height: 29.7969px;"><td style="width: 49.9383%; height: 29.7969px;">**Parameter**</td><td style="width: 49.9383%; height: 29.7969px;">**Description**</td></tr><tr style="height: 29.7969px;"><td style="width: 49.9383%; height: 29.7969px;">fromAccountId</td><td style="width: 49.9383%; height: 29.7969px;">This is the ID of the payee's wallet - the user who is paying out the funds</td></tr><tr style="height: 29.7969px;"><td style="width: 49.9383%; height: 29.7969px;">toAccountId</td><td style="width: 49.9383%; height: 29.7969px;">This is the ID of recipient's wallet - the user who will receive the funds</td></tr><tr style="height: 29.7969px;"><td style="width: 49.9383%; height: 29.7969px;">description</td><td style="width: 49.9383%; height: 29.7969px;">(Optional) Text that can be used to describe the reason for the transaction</td></tr><tr style="height: 29.7969px;"><td style="width: 49.9383%; height: 29.7969px;">amount</td><td style="width: 49.9383%; height: 29.7969px;">The amount of the transaction</td></tr><tr style="height: 29.7969px;"><td style="width: 49.9383%; height: 29.7969px;">reference</td><td style="width: 49.9383%; height: 29.7969px;">A unique reference is created so that you can identify and link this transaction to your system</td></tr></tbody></table>

<p class="callout info">**Response (200)**</p>

```text
{
    "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": ""
}
```

<div class="admonitionHeading_tbUL" id="bkmrk-parameter-descriptio-2"><table border="1" style="border-collapse: collapse; width: 86.9136%;"><tbody><tr><td style="width: 50.0618%;">**Parameter**</td><td style="width: 50.0618%;">**Description**</td></tr><tr><td style="width: 50.0618%;">key</td><td style="width: 50.0618%;">a unique identifier for the transaction</td></tr><tr><td style="width: 50.0618%;"><div><div>approveById</div></div></td><td style="width: 50.0618%;">&lt;id of the person to approve the transaction&gt;</td></tr><tr><td style="width: 50.0618%;"><div><div>canCancel</div></div></td><td style="width: 50.0618%;">&lt;can be cancelled or not&gt;

</td></tr><tr><td style="width: 50.0618%;"><div><div>expiryDate</div></div></td><td style="width: 50.0618%;">&lt;date/time when the transaction expires&gt;</td></tr><tr><td style="width: 50.0618%;">ttl</td><td style="width: 50.0618%;">&lt;time left in seconds&gt;

</td></tr></tbody></table>

</div><p class="callout danger">Errors</p>

- **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.


### **Deposit With MPESA**

<p class="callout info">**Request**</p>

```text
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>
}'
```

<table border="1" id="bkmrk-parameter-descriptio-3" style="border-collapse: collapse; width: 100%; height: 229.172px;"><tbody><tr style="height: 29.7969px;"><td style="width: 49.9383%; height: 29.7969px;">**Parameter**</td><td style="width: 49.9383%; height: 29.7969px;">**Description**</td></tr><tr style="height: 29.7969px;"><td style="width: 49.9383%; height: 29.7969px;">mobileNumber</td><td style="width: 49.9383%; height: 29.7969px;">Mpesa Mobile number to be used for transaction</td></tr><tr style="height: 46.5938px;"><td style="width: 49.9383%; height: 46.5938px;">accountId</td><td style="width: 49.9383%; height: 46.5938px;">This is the ID of recipient's wallet - the user who will receive the funds. You can check your account id [<span style="color: #3598db;">here</span>](https://books.xprizo.com/link/13#bkmrk-know-your-account-id)</td></tr><tr style="height: 46.5938px;"><td style="width: 49.9383%; height: 46.5938px;">description</td><td style="width: 49.9383%; height: 46.5938px;">(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.

</td></tr><tr style="height: 29.7969px;"><td style="width: 49.9383%; height: 29.7969px;">amount</td><td style="width: 49.9383%; height: 29.7969px;">The amount of the transaction</td></tr><tr style="height: 46.5938px;"><td style="width: 49.9383%; height: 46.5938px;">reference</td><td style="width: 49.9383%; height: 46.5938px;">A unique reference is created so that you can identify and link this transaction to your system</td></tr></tbody></table>

<p class="callout info">**Response (200)**</p>

```text
{
    "key": <a unique identifier for the transaction>,
    "statusCode": <The number equivalent of the Status>,
    "status": <Active/Rejected/Pending>,
    "value": <transaction description>
}
```

<div class="admonitionHeading_tbUL" id="bkmrk--3"></div><table border="1" id="bkmrk-parameter-descriptio-4" style="border-collapse: collapse; width: 86.9136%;"><tbody><tr><td style="width: 50.0618%;">**Parameter**</td><td style="width: 50.0618%;">**Description**</td></tr><tr><td style="width: 50.0618%;">key</td><td style="width: 50.0618%;">a unique identifier for the transaction</td></tr><tr><td style="width: 50.0618%;">statusCode</td><td style="width: 50.0618%;">The number equivalent of the Status</td></tr><tr><td style="width: 50.0618%;">status</td><td style="width: 50.0618%;">- Active – The transaction was completed successfully
- Pending – The transaction was unable to be completed and needs further action
- Rejected - The transaction was rejected

</td></tr><tr><td style="width: 50.0618%;">value</td><td style="width: 50.0618%;">- Active – the value will show the description
- Pending - the value will show the description
- Rejected - the value will show the reason

</td></tr></tbody></table>

<p class="callout danger">Errors</p>

- **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.

### **Withdrawal With MPESA**

<p class="callout info">**Request**</p>

```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": <mpesa_mobile_number>,
    "accountId": <your_account_id>,
    "description": <purpose of deposit>,
    "amount": <requested amount>,
    "reference":<unique reference>
}'
```

<table border="1" id="bkmrk-parameter-descriptio-5" style="border-collapse: collapse; width: 100%; height: 229.172px;"><tbody><tr style="height: 29.7969px;"><td style="width: 49.9383%; height: 29.7969px;">**Parameter**</td><td style="width: 49.9383%; height: 29.7969px;">**Description**</td></tr><tr style="height: 29.7969px;"><td style="width: 49.9383%; height: 29.7969px;">mobileNumber</td><td style="width: 49.9383%; height: 29.7969px;">Mpesa Mobile number to be used for transactions. Who will receive the funds. Sample +254706\*\*\*\*73</td></tr><tr style="height: 46.5938px;"><td style="width: 49.9383%; height: 46.5938px;">accountId</td><td style="width: 49.9383%; height: 46.5938px;">This is the ID of your wallet - You can check your account ID [<span style="color: #3598db;">here</span>](https://books.xprizo.com/link/13#bkmrk-know-your-account-id)</td></tr><tr style="height: 46.5938px;"><td style="width: 49.9383%; height: 46.5938px;">description</td><td style="width: 49.9383%; height: 46.5938px;">(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.

</td></tr><tr style="height: 29.7969px;"><td style="width: 49.9383%; height: 29.7969px;">amount</td><td style="width: 49.9383%; height: 29.7969px;">The amount of the transaction</td></tr><tr style="height: 46.5938px;"><td style="width: 49.9383%; height: 46.5938px;">reference</td><td style="width: 49.9383%; height: 46.5938px;">A unique reference is created so that you can identify and link this transaction to your system</td></tr></tbody></table>

<p class="callout info">**Response (200)**</p>

```text
{
    "key": <a unique identifier for the transaction>,
    "statusCode": <The number equivalent of the Status>,
    "status": <Active/Rejected/Pending>,
    "value": <transaction description>
}
```

<div class="admonitionHeading_tbUL" id="bkmrk--4"></div><table border="1" id="bkmrk-parameter-descriptio-6" style="border-collapse: collapse; width: 86.9136%;"><tbody><tr><td style="width: 50.0618%;">**Parameter**</td><td style="width: 50.0618%;">**Description**</td></tr><tr><td style="width: 50.0618%;">key</td><td style="width: 50.0618%;">a unique identifier for the transaction</td></tr><tr><td style="width: 50.0618%;">statusCode</td><td style="width: 50.0618%;">The number equivalent of the Status</td></tr><tr><td style="width: 50.0618%;">status</td><td style="width: 50.0618%;">- Active – The transaction was completed successfully
- Pending – The transaction was unable to be completed and needs further action
- Rejected - The transaction was rejected

</td></tr><tr><td style="width: 50.0618%;">value</td><td style="width: 50.0618%;">- Active – the value will show the description
- Pending - the value will show the description
- Rejected - the value will show the reason

</td></tr></tbody></table>

<p class="callout danger">Errors</p>

- **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.



### **Deposit With UPI**

<p class="callout info">**Request**</p>

```text
curl --location '{baseurl}/Transaction/UpiDeposit?useApprovalProcess=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}' \
--data-raw '{
  "description": <description of the transaction>,
  "reference": <unique ID or reference supplied from your end>,
  "amount": <amount to be deposited>,
  "currencyCode": <currency of the transaction, must be INR>,
  "type": <transaction type, must be 1>,
  "accountId": <account ID for the account into which funds will be deposited>,
  "customer": <alternative end user name>,
  "customerData": {
    "name": <the name of the end user>,
    "email": <end user's email address>,
    "address": {
      "address": <deprecated, use address fields below>,
      "street": <address street>,
      "city": <address city>,
      "stateProvinceRegion": <address state, province, or region>,
      "zipPostalCode": <address postcode>,
      "countryCode": <country code, must be IN>
    }
  },  
  "redirect": <URL to which your end user will be directed after approving the transaction>
}'
```

<table border="1" id="bkmrk-parameter-descriptio-7" style="border-collapse: collapse; width: 100%; height: 578.516px;"><tbody><tr style="height: 29.7969px;"><td style="width: 50.0618%; height: 29.7969px;">**Parameter**</td><td style="width: 50.0618%; height: 29.7969px;">**Description**</td></tr><tr style="height: 23.3906px;"><td style="width: 50.0618%; height: 23.3906px;">description</td><td style="width: 50.0618%; height: 23.3906px;">(Optional) Description of the transaction.

</td></tr><tr style="height: 46.5938px;"><td style="width: 50.0618%; height: 46.5938px;">reference</td><td style="width: 50.0618%; height: 46.5938px;">(Required) A unique ID or reference supplied from your end, which you can use to identify and link this transaction to your system.

</td></tr><tr style="height: 29.7969px;"><td style="width: 50.0618%; height: 29.7969px;">amount</td><td style="width: 50.0618%; height: 29.7969px;">(Required) The amount of the transaction.</td></tr><tr style="height: 46.5938px;"><td style="width: 50.0618%; height: 46.5938px;">currencyCode</td><td style="width: 50.0618%; height: 46.5938px;">(Required) Currency code for the transaction currency, must be "INR".</td></tr><tr style="height: 29.7969px;"><td style="width: 50.0618%; height: 29.7969px;">type</td><td style="width: 50.0618%; height: 29.7969px;">(Required) Transaction type, must be 1.</td></tr><tr style="height: 57.7812px;"><td style="width: 50.0618%; height: 57.7812px;">accountId</td><td style="width: 50.0618%; height: 57.7812px;">(Required) Account ID for the account into which funds will be deposited. See [<span style="color: #3598db;">here</span>](https://books.xprizo.com/link/13#bkmrk-know-your-account-id) how to check for your account ID.

</td></tr><tr style="height: 29.7969px;"><td style="width: 50.0618%; height: 29.7969px;">customer</td><td style="width: 50.0618%; height: 29.7969px;">(Optional, see notes below) The name of the end user (alternative).</td></tr><tr style="height: 29.7969px;"><td style="width: 50.0618%; height: 29.7969px;">customerData.name</td><td style="width: 50.0618%; height: 29.7969px;">(Optional, see notes below) The name of the end user.</td></tr><tr style="height: 29.7969px;"><td style="width: 50.0618%; height: 29.7969px;">customerData.email</td><td style="width: 50.0618%; height: 29.7969px;">(Optional) End user's email address.</td></tr><tr style="height: 29.7969px;"><td style="width: 50.0618%; height: 29.7969px;">customerData.address.address</td><td style="width: 50.0618%; height: 29.7969px;">Deprecated, use address fields below.</td></tr><tr style="height: 29.7969px;"><td style="width: 50.0618%; height: 29.7969px;">customerData.address.street</td><td style="width: 50.0618%; height: 29.7969px;">(Optional) Address street.</td></tr><tr style="height: 29.7969px;"><td style="width: 50.0618%; height: 29.7969px;">customerData.address.city</td><td style="width: 50.0618%; height: 29.7969px;">(Optional) Address city.</td></tr><tr style="height: 29.7969px;"><td style="width: 50.0618%; height: 29.7969px;">customerData.address.stateProvinceRegion</td><td style="width: 50.0618%; height: 29.7969px;">(Optional) Address state, province, or region.</td></tr><tr style="height: 29.7969px;"><td style="width: 50.0618%; height: 29.7969px;">customerData.address.zipPostalCode</td><td style="width: 50.0618%; height: 29.7969px;">(Optional) Address postcode.</td></tr><tr style="height: 29.7969px;"><td style="width: 50.0618%; height: 29.7969px;">customerData.address.countryCode</td><td style="width: 50.0618%; height: 29.7969px;">(Required) Country code, must be "IN".</td></tr><tr style="height: 46.5938px;"><td style="width: 50.0618%; height: 46.5938px;">redirect</td><td style="width: 50.0618%; height: 46.5938px;">(Required) URL to which your end user will be directed after approving the transaction.</td></tr></tbody></table>

<p class="callout warning">**Important Notes**</p>

- If customerData.name is present, it will be used as the end user's name.
- If customer is present, and customerData.name is not present, customer will be used as the end user's name.
- If customerData.name and customer are both not present, details from your Xprizo profile will be used: 
    - If your profile is of 'Individual' type, first and last name from your profile will be used.
    - If your profile is of 'Legal Entity' type, trading name from your profile will be used if present, otherwise registered name from your profile will be used.
- The following query parameters will be added to the specified redirect URL when the user is redirected on completion of the transaction: 
    - key: System unique ID for the transaction.
    - status: Transaction status.
    - reference: The unique ID or reference supplied from your end.

<p class="callout info">**Response (200)**</p>

```text
{
    
    "key": <System unique ID for the transaction>,
    "statusCode": <Numeric code for transaction status>,
    "status": <Transaction status>,
    "description": <Currently empty/unused>,
    "value": <URL to which you need to redirect your end user to approve the transaction>,
    "reference": <Unique ID or reference supplied from your end>
    
}
```

<div class="admonitionHeading_tbUL" id="bkmrk--8"></div><table border="1" id="bkmrk-parameter-descriptio-8" style="border-collapse: collapse; width: 86.9136%;"><tbody><tr><td style="width: 50.0618%;">**Parameter**</td><td style="width: 50.0618%;">**Description**</td></tr><tr><td style="width: 50.0618%;">key</td><td style="width: 50.0618%;">System unique ID for the transaction.</td></tr><tr><td style="width: 50.0618%;">statusCode</td><td style="width: 50.0618%;">A numeric code for the status of the transaction.</td></tr><tr><td style="width: 50.0618%;">status</td><td style="width: 50.0618%;">The status of the transaction.

</td></tr><tr><td style="width: 50.0618%;">value</td><td style="width: 50.0618%;">The URL to which you need to redirect your end user to approve the transaction.

</td></tr><tr><td style="width: 50.0618%;">description</td><td style="width: 50.0618%;">Currently empty/unused.

</td></tr><tr><td style="width: 50.0618%;">reference</td><td style="width: 50.0618%;">Unique ID or reference supplied from your end, which you can use to identify and link this transaction to your system.

</td></tr></tbody></table>

<p class="callout danger">Errors</p>

- **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 (Xprizo Wallet)**

<p class="callout info">Request</p>

```bash
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>
}'
```

<table border="1" id="bkmrk-parameter-descriptio-11" style="border-collapse: collapse; width: 100%; height: 400.758px;"><tbody><tr style="height: 29.7969px;"><td style="width: 49.9383%; height: 29.7969px;">**Parameter**</td><td style="width: 49.9383%; height: 29.7969px;">**Description**</td></tr><tr style="height: 124.992px;"><td style="width: 49.9383%; height: 124.992px;">action</td><td style="width: 49.9383%; height: 124.992px;">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)

</td></tr><tr style="height: 29.7969px;"><td style="width: 49.9383%; height: 29.7969px;">pin</td><td style="width: 49.9383%; height: 29.7969px;">Required if the user implemented "Approval Security"</td></tr><tr style="height: 46.5938px;"><td style="width: 49.9383%; height: 46.5938px;">fromAccountId</td><td style="width: 49.9383%; height: 46.5938px;">This is the ID of the payee's wallet - the user who is paying out the funds</td></tr><tr style="height: 46.5938px;"><td style="width: 49.9383%; height: 46.5938px;">toAccountId</td><td style="width: 49.9383%; height: 46.5938px;">This is the ID of the recipient's wallet - the user who will receive the funds</td></tr><tr style="height: 46.5938px;"><td style="width: 49.9383%; height: 46.5938px;">description</td><td style="width: 49.9383%; height: 46.5938px;">(Optional) Text that can be used to describe the reason for the transaction</td></tr><tr style="height: 29.7969px;"><td style="width: 49.9383%; height: 29.7969px;">amount</td><td style="width: 49.9383%; height: 29.7969px;">The amount of the transaction</td></tr><tr style="height: 46.5938px;"><td style="width: 49.9383%; height: 46.5938px;">reference</td><td style="width: 49.9383%; height: 46.5938px;">A unique reference is created so that you can identify and link this transaction to your system</td></tr></tbody></table>

<p class="callout info">**Response (200) If action = 0 or Not provided in request**</p>

```text
{
    "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": ""
}
```

<div class="admonitionHeading_tbUL" id="bkmrk-parameter-descriptio-12"><div class="admonitionHeading_tbUL"><table border="1" style="border-collapse: collapse; width: 86.9136%;"><tbody><tr><td style="width: 50.0618%;">**Parameter**</td><td style="width: 50.0618%;">**Description**</td></tr><tr><td style="width: 50.0618%;">key</td><td style="width: 50.0618%;">a unique identifier for the transaction</td></tr><tr><td style="width: 50.0618%;"><div><div>approveById</div></div></td><td style="width: 50.0618%;">&lt;id of the person to approve the transaction&gt;</td></tr><tr><td style="width: 50.0618%;"><div><div>canCancel</div></div></td><td style="width: 50.0618%;">&lt;can be cancelled or not&gt;

</td></tr><tr><td style="width: 50.0618%;"><div><div>expiryDate</div></div></td><td style="width: 50.0618%;">&lt;date/time when the transaction expires&gt;</td></tr><tr><td style="width: 50.0618%;">ttl</td><td style="width: 50.0618%;">&lt;time left in seconds&gt;

</td></tr></tbody></table>

</div></div><p class="callout info">**Response (200) If action = 1 or 2**</p>

```text
{
    "id":<a unique identifier for the transaction>,
    "description": "<The type of transaction processed (Payment)>"
}
```

<div class="admonitionHeading_tbUL" id="bkmrk--11"></div><div class="admonitionHeading_tbUL" id="bkmrk--12"></div><p class="callout danger">Errors</p>

- **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 (Xprizo Wallet)**

<p class="callout info">Request</p>

```bash
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}' 
```

<table border="1" id="bkmrk-parameter-descriptio-13" style="border-collapse: collapse; width: 100%; height: 314.75px;"><tbody><tr style="height: 29.7969px;"><td style="width: 49.9383%; height: 29.7969px;">**Parameter**</td><td style="width: 49.9383%; height: 29.7969px;">**Description**</td></tr><tr style="height: 38.984px;"><td style="width: 49.9383%; height: 38.984px;">key</td><td style="width: 49.9383%; height: 38.984px;">A unique ID of the transaction you wish to approve

</td></tr><tr style="height: 29.7969px;"><td style="width: 49.9383%; height: 29.7969px;">pin</td><td style="width: 49.9383%; height: 29.7969px;">Required if the user implemented "Approval Security"</td></tr><tr style="height: 46.5938px;"><td style="width: 49.9383%; height: 46.5938px;">once</td><td style="width: 49.9383%; height: 46.5938px;">Set this to true, if you want to automatically cancel this transaction if an error occurs when processing the transaction.</td></tr></tbody></table>

<p class="callout info">**Response (200)**</p>

```text
{
    "id":<a unique identifier for the transaction>,
    "description": "<The type of transaction processed (Payment)>"
}
```

<div class="admonitionHeading_tbUL" id="bkmrk--14"></div><div class="admonitionHeading_tbUL" id="bkmrk--15"></div>### **Cancel Payment (Xprizo Wallet)**

<p class="callout info">Request</p>

```bash
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}' 
```

<div class="admonitionHeading_tbUL" id="bkmrk-parameter-descriptio-14"><div class="admonitionHeading_tbUL"><table border="1" id="bkmrk-parameter-descriptio-18" style="border-collapse: collapse; width: 100%; height: 314.75px;"><tbody><tr style="height: 29.7969px;"><td style="width: 49.9383%; height: 29.7969px;">**Parameter**</td><td style="width: 49.9383%; height: 29.7969px;">**Description**</td></tr><tr style="height: 38.984px;"><td style="width: 49.9383%; height: 38.984px;">key</td><td style="width: 49.9383%; height: 38.984px;">A unique ID of the transaction you wish to approve

</td></tr></tbody></table>

</div></div><p class="callout info">**Response (200) Transaction is canceled successfully**</p>

<div class="admonitionHeading_tbUL" id="bkmrk--16"><div class="admonitionHeading_tbUL">  
</div></div>### **Check Transaction Status**

This endpoint can be used to check the status of any type of transaction for example card deposit, Mpesa withdrawal etc.

<p class="callout info">**Request**</p>

```bash
curl --location '{baseurl}/Transaction/Status/{accountId}/?reference={reference}' \
--header 'x-api-version: {apiversion}' \
--header 'x-api-key: {apikey}'
```

<table border="1" id="bkmrk-parameter-descriptio-15" style="border-collapse: collapse; width: 100%;"><tbody><tr><td style="width: 49.9383%;">**Parameter**</td><td style="width: 49.9383%;">**Description**</td></tr><tr><td style="width: 49.9383%;">accountId</td><td style="width: 49.9383%;">This is the ID of the wallet that contains the transaction. When requesting a payment use the ID of the recipient's wallet.</td></tr><tr><td style="width: 49.9383%;">reference</td><td style="width: 49.9383%;">The reference is the Merchants unique transaction identifier for this transaction</td></tr></tbody></table>

<p class="callout success">**Response (200)**</p>

```bash
{
    "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"
}

```

<table border="1" id="bkmrk-parameter-descriptio-16" style="border-collapse: collapse; width: 100%;"><tbody><tr><td style="width: 49.9383%;">**Parameter**</td><td style="width: 49.9383%;">**Description**</td></tr><tr><td style="width: 49.9383%;">key</td><td style="width: 49.9383%;">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.

</td></tr><tr><td style="width: 49.9383%;">status</td><td style="width: 49.9383%;"> 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

</td></tr><tr><td style="width: 49.9383%;">value</td><td style="width: 49.9383%;">- When Active this will contain the billing description For card deposit &amp; 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

</td></tr></tbody></table>