Skip to content

Withdrawal

Used for creating new requests and getting information about User withdrawal history.

Get all withdrawals

Returns all withdrawal records for active user.

URL : https://api.iotaap.io/v1/withdrawal/list

Method : GET

Auth required : YES - auth middleware is used with this endpoint - the currently active user will be extracted from the active session - transactions are guarded so Users can only access their own transactions

URL Params

  • offset (integer): basic pagination; default -1
  • limit (integer): basic pagination limit; default 10
  • order (string: asc|desc): basic ordering parameter; default desc

Success Response

Code : 200 OK

Response example

{
    "withdrawals": [
        {
            "_id": "6097b56921021800616297f6",
            "created_at": "2021-05-09T10:11:53.963Z",
            "amount": 10,
            "method": "BANK",
            "owner": "6083df8c82478a001b18c9d7",
            "completed": false,
            "__v": 0,
            "status": "pending"
        },
        {
            "_id": "60a93e8006c1cd027bf4061c",
            "owner": "6083df8c82478a001b18c9d7",
            "created_at": "2021-05-22T17:25:20.296Z",
            "amount": 10,
            "method": "BANK",
            "completed": false,
            "status": "canceled",
            "bank": "BEST BANK EVER",
            "iban": "HR21331323153406342304",
            "swift": "PDDGH2xx",
            "__v": 0
        },
        {
            "_id": "60a942ecb0aa4904e5903bda",
            "owner": "6083df8c82478a001b18c9d7",
            "created_at": "2021-05-22T17:44:12.384Z",
            "amount": 10,
            "method": "BANK",
            "completed": false,
            "status": "pending",
            "bank": "BEST BANK EVER",
            "iban": "HR21331323153406342304",
            "swift": "PDDGH2xx",
            "__v": 0
        },
        {
            "_id": "60a94321b0aa4904e5903bdb",
            "owner": "6083df8c82478a001b18c9d7",
            "created_at": "2021-05-22T17:45:05.164Z",
            "amount": 10,
            "method": "BANK",
            "completed": false,
            "status": "pending",
            "bank": "BEST BANK EVER",
            "iban": "HR21331323153406342304",
            "swift": "PDDGH2xx",
            "__v": 0
        },
        {
            "_id": "60a94365b0aa4904e5903bdc",
            "owner": "6083df8c82478a001b18c9d7",
            "created_at": "2021-05-22T17:46:13.454Z",
            "amount": 200,
            "method": "BANK",
            "completed": false,
            "status": "pending",
            "bank": "BEST BANK EVER",
            "iban": "HR21331323153406342304",
            "swift": "PDDGH2xx",
            "__v": 0
        },
        {
            "_id": "60aa19fd67fe2400391e88b9",
            "owner": "6083df8c82478a001b18c9d7",
            "created_at": "2021-05-23T09:01:49.963Z",
            "amount": 100,
            "method": "BANK",
            "completed": false,
            "status": "canceled",
            "bank": "BEST BANK EVER",
            "iban": "HR21331323153406342304",
            "swift": "PDDGH2xx",
            "__v": 0
        }
    ],
    "recordsTotal": 6,
    "recordsFiltered": 6
}
Response Params

  • withdrawals (array): list of withdrawals (paginated using offset/limit)
  • recordsTotal (number): total number of records
  • recordsFiltered (number): number of filtered records (will be the same as recordsTotal)
  • draw (string): draw string from request

Withdrawal Status

Status is limited to one of the following: - pending - request was submitted and is not fully processed, coins are captured (removed) from User wallet until Withdrawal is processed or cancelled - processed - request was processed in full, coins removed from User wallet and refunded - canceled - request was canceled; captured coins are returned to the User's wallet

Error Response

Condition : If case of runtime errors the API responds with the following.

Code : 500 Internal Error

Content :

{
    "message": "Error getting Withdrawals",
    "error": "<Error information>"
}

Code : 404 Not Found

Content :

{
    "message": "No suwh withdrawa.",
}

Get single withdrawas

Get details of a single withdrasal.

URL : https://api.iotaap.io/v1/withdrawal/:id

Method : GET

Auth required : YES

Success Response

Code : 200 OK

Response example

{
    "_id": "60aa19fd67fe2400391e88b9",
    "owner": "6083df8c82478a001b18c9d7",
    "created_at": "2021-05-23T09:01:49.963Z",
    "amount": 100,
    "method": "BANK",
    "completed": false,
    "status": "canceled",
    "bank": "BEST BANK EVER",
    "iban": "HR21331323153406342304",
    "swift": "PDDGH2xx",
    "__v": 0
}

Create withdrawal

URL : https://api.iotaap.io/v1/withdrawal/

Method : POST

Auth required : YES - auth middleware is used with this endpoint - the currently active user will be extracted from the active session - transactions are guarded so Users can only access their own transactions

JSON body

  • method (string: PAYPAL|BANK) - withdrawal method
  • amount (unsigned integer) - withdrawal amount
  • paypal_id (string) - used when creating PayPal withdrawal requests
  • bank (string) - used when creating Bank transfer withdrawal requests
  • iban (string) - used when creating Bank transfer withdrawal requests
  • swift (string) - used when creating Bank transfer withdrawal requests

BANK example

https://api.iotaap.io/v1/withdrawal/

{
    "amount": 10,
    "method": "BANK",
    "bank": "BEST BANK EVER",
    "swift": "PDDGH2xx",
    "iban": "HR21331323153406342304"
}

PAYPAL example

https://api.iotaap.io/v1/withdrawal/

{
    "amount": 10,
    "method": "PAYPAL",
    "paypal_id": "testing@example.com"
}

Success Response

Code : 200 OK

{
    "_id": "60b505715163580021e5dc40",
    "created_at": "2021-05-31T15:49:05.286Z",
    "amount": 10,
    "method": "PAYPAL",
    "owner": "6083df8c82478a001b18c9d7",
    "completed": false,
    "status": "pending",
    "paypal_id": "testing@example.com",
}

Error Response

Condition : There was an issue verifying and fetching the active User session

Code : 500 INTERNAL SERVER ERROR

Content :

{
    "message": "Error getting user"
}

Condition : The request was made for non existing User

Code : 404 NOT FOUND

Content :

{
    "message": "User not found"
}

Condition : General server error

Code : 500 INTERNAL SERVER ERROR

Content :

{
    "message": "Error creating withdrawal"
}

Condition : Missing paypal_id for paypal withdrawal

Code : 400 BAD REQUEST

Content :

{
    "message": "Method PAYPAL must provide paypal_id"
}

Condition : Missing bank data for bank transfer withdrawal

Code : 400 BAD REQUEST

Content :

{
    "message": "Method BANK must provide bank, swift and iban"
}

Condition : Unsupported method

Code : 400 BAD REQUEST

Content :

{
    "message": "Invalid method"
}

Condition : Insufficient funds

Code : 400 BAD REQUEST

Content :

{
    "message": "Provided amount is larger than current wallet balance"
}