This API returns the details of a customer wallet based on the provided wallet ID and customer ID. It also accepts an optional query parameter for pagination.
Rehook Platform API provides resource oriented URLs to work with your business data. Our API uses JSON for request and response. API errors are returned using standard HTTP response codes.
Introduction
Get wallet transaction of a customer API will enable you to fetch the wallet transaction details of a given customer. you can call this API at applicable touch points on your application to show the wallet transactions on your application UI.
API details
API Endpoint: https://api.rehook.ai/wallets/customer/{source_id}/transactions/{wallet_id}
HTTP Method: GET
Prerequisites
- API Key and Secret Key for your application
- If you don't know the API key and secret key, please go to setting module on admin panel to view API details for your application. To know more about application settings, please visit Application setting
- API key and secret key are auto generated and cannot be changed.
- Custom wallet to be created for your application. To know more about how to create wallet, please visit Wallet setting
Authentication
You need to provide the API key and Secret of your application in every new request as Authorization. Rehook use Basic authentication method to authenticate the API calls.
Authorization | Value |
---|---|
Username | API Key of your application |
Password | Secret key of your application |
Parameters
Query parameter
Parameter | value | example |
---|---|---|
page | page number for pagination | 2 default value will be 1 |
Path URL
This API doesn't requires any body parameters. you have to provide the source_id as parameter in the path URL
Parameter | In | Definition | example |
---|---|---|---|
source_id | Path | required Rehook Id or source id of a customer | KMN@123 |
Sample request and response
Path: https://api.rehook.ai/wallets/customer/krishna123/transactions/waty_XbgBcerLwjoMhAGcmAHhZ
In above URL path, 'krishna123' is the source id and 'waty_XbgBcerLwjoMhAGcmAHhZ' is the wallet id
response
If source_id and wallet_id provided in path is valid, then rehook will return the wallet transaction details of that customer in the response body.
[
{
"transaction_id": "trhi_7fgEcRUnVZmqF9BVadOFh",
"type": "credit",
"points": 10,
"description": "Wallet updated for redemption of code: KBLGPN",
"created_at": "2023-09-13T10:27:37.839324Z",
"updated_at": "2023-09-13T10:27:37.839324Z"
},
{
"transaction_id": "trhi_maWlb7oQKjMF2wH6A27Mc",
"type": "credit",
"points": 10,
"description": "Wallet updated for redemption of code: KBLGPN",
"created_at": "2023-09-13T10:25:26.783454Z",
"updated_at": "2023-09-13T10:25:26.783454Z"
}
]
Below table shows the definition of response body
Field name | Definition | Example |
---|---|---|
transaction_id | transaction id assigned to a wallet transaction when it's credited or debited | 1234_kmn |
type | wallet transaction type - credit /debit | credit/debit |
points | wallet points debited/credited | 20 point |
description | description of the wallet transaction passed in credit/debit API | Wallet updated for redemption of code: KBLGPN" |
created_at | transaction created date | 2023-09-13T10:25:26.783454Z |
updated_at | transaction updated date | 2023-09-13T10:25:26.783454Z |
API Behaviour
- This API returns the transaction details of a customer and wallet in paginated way, hence you have to pass the page number as query parameter. API returns max of 20 transactions in one page.
- This API doesn't have any body parameter, you have to pass the source_id and wallet_id in the URL path
Error cases
If API call is failed, then Rehook will return the following HTTP success code with response body as given below:
HTTP Code | Message |
---|---|
400 | bad request |
error response body
field name | description | example |
---|---|---|
Code | Error code | 400 |
details | Error details | Given resource Id is wrong |
message | error message | Resource Id not found |
request_id | API request Id assigned by Rehook | abc_123 |
Sample error response
- When source_id in path is wrong
{
"code": 404,
"message": "resource not found",
"details": "customer not found",
"request_id": "9d06ea48-1b7e-984d-9557-9e69d24233af"
}
-
When wallet_id in path is wrong
You will get empty response
-
When parameter is missing
{
"code": 404,
"message": "resource not found",
"details": "customer not found",
"request_id": "a3389214-407e-94fe-ac62-6154edc0d337"
}