Demo Credit is a wallet service. This is needed as borrowers need a wallet to receive the loans they have been granted and also send the money for repayments.
Base URL: https://mohammed-lendsqr-be-test.struckchure.com
Default headers:
{
"Content-Type": "application/json",
"Accept": "application/json"
}
GET /api/v1/user/register
- Register a userSample Payload: All fields are required for registering a user.
{
"username": "username",
"password": "password"
}
Sample Response(201):
{
"data": {
"id": "<user_id>",
"username": "username",
"password": "password",
"token": "<token>",
"created_at": "2020-05-01T00:00:00Z",
"updated_at": "2020-05-01T00:00:00Z"
}
}
POST /api/v1/user/login
- Login a user / obtain a tokenSample Payload: All fields are required for logging in a user.
{
"username": "username",
"password": "password"
}
Sample Response (200):
{
"data": {
"id": "<user_id>",
"username": "username",
"token": "<token>",
"created_at": "2020-05-01T00:00:00Z",
"updated_at": "2020-05-01T00:00:00Z"
}
}
Authentication is required for all wallet endpoints. Tokens are obtained from the user endpoints. Default headers:
{
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": "Bearer <token>"
}
POST /api/v1/wallet
- Create a walletSample Payload: No payload is required for creating a wallet.
Sample Response (201):
{
"data": {
"id": "<wallet_id>",
"user": "<user_id>",
"balance": 0,
"created_at": "2020-05-01T00:00:00Z",
"updated_at": "2020-05-01T00:00:00Z"
}
}
GET /api/v1/wallet
- Get a user's walletSample Response(200):
{
"data": {
"id": "<wallet_id>",
"user": "<user_id>",
"balance": 0,
"created_at": "2020-05-01T00:00:00Z",
"updated_at": "2020-05-01T00:00:00Z"
}
}
POST /api/v1/wallet/fund
- Fund a walletSample Payload: All fields are required for funding a wallet.
{
"amount": 100
}
Sample Response(200):
{
"data": {
"id": "<wallet_id>",
"user": "<user_id>",
"balance": 100,
"created_at": "2020-05-01T00:00:00Z",
"updated_at": "2020-05-01T00:00:00Z"
}
}
POST /api/v1/wallet/withdraw
- Withdraw from a walletSample Payload: All fields are required for withdrawing from a wallet.
{
"amount": 100
}
Sample Response(200):
{
"data": {
"id": "<wallet_id>",
"user": "<user_id>",
"balance": 0,
"created_at": "2020-05-01T00:00:00Z",
"updated_at": "2020-05-01T00:00:00Z"
}
}
POST /api/v1/wallet/transfer
- Transfer money from one user to anotherSample Payload: All fields are required for transferring money from one user to another.
{
"amount": 100,
"username": "<username>"
}
Sample Response(200):
{
"data": {
"id": "<wallet_id>",
"user": "<user_id>",
"balance": 0,
"created_at": "2020-05-01T00:00:00Z",
"updated_at": "2020-05-01T00:00:00Z"
}
}