Deposit
Used for adding coins (TOP_UP), payment verification and payment cancel.
Add Coins
Performs a TOP_UP
operation and creates the corresponding PAYPAL transaction in pending
state.
URL : https://api.iotaap.io/v1/deposit/add-coins
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
- gateway
(string)
: payment gateway; currently onlypaypal
is supported - coins
(unsigned integer)
: TOP_UP coin amount - amount of coins being added to the platform (min 10
)
Success Response
Code : 200 OK
Response example
List of paypal
API links. The approve
link will redirect the user to the approval page on Paypal's website
{
"links": {
"href": "https://www.sandbox.paypal.com/checkoutnow?token=3D4006095X0709533",
"rel": "approve",
"method": "GET"
},
...
}
Error Responses
Code: 400 BAD REQUEST
// validation error
{
message: <error details>,
}
// unsupported vendor
{
message: `Unsupported vendor: <name>`,
}
Code: 404 NOT FOUND
// session User does not exist
{
message: 'User not found',
}
Code: 500 INTERNAL SERVER ERROR
// exchange rate is not stored in DB
{
message: 'Exchange rate not available',
}
// error saving transaction
{
message: `Error saving Transaction: <error details>`,
}
// request to PayPal API was not successful or had errors
{
message: 'Could not create paypal order',
}
// there was an issue updating payment_identified
{
message: `Error saving transaction payment_identifier: <error details>`,
}
// PayPal API request was successful but `approve` link was not provided
{
message: 'Missing paypal approve link',
}
Process PayPal
Accepts redirect from PAYPAL API to finish the processing a pending PayPal transaction.
Request to this API should contain token
param in the URL query. The token
should contain a valid PayPal payment token.
A successful response to this API will redirect the current User to /pages/wallet/details?callback=success
web page.
URL : https://api.iotaap.io/v1/deposit/process
Method : GET
Auth required : NO - this is a redirect url
Example
https://api.iotaap.io/v1/deposit/process?token=3D4006095X0709533
Error Responses
Code: 404 NOT FOUND
// session User does not exist
{
message: 'User not found',
}
{
message: 'Transaction not found',
}
Code: 500 INTERNAL SERVER ERROR
// exchange rate is not stored in DB
{
message: 'Exchange rate not available',
}
// error saving transaction
{
message: `Error saving Transaction: <error details>`,
}
// request to PayPal API was not successful or had errors
{
message: 'Paypal order execution failed: <error details>',
}
// there was an issue updating User state
{
message: `Error saving user data: <error details>`,
}
// PayPal API request got no response
{
message: 'Missing paypal response',
}
Cancel PayPal
Sets PayPal transaction to canceled
state.
Request to this API should contain token
param in the URL query. The token
should contain a valid PayPal payment token.
A successful response to this API will redirect the current User to /pages/wallet/details?callback=cancel
web page.
URL : https://api.iotaap.io/v1/deposit/cancel
Method : GET
Auth required : NO - this is a redirect url
Example
https://api.iotaap.io/v1/deposit/cancel?token=3D4006095X0709533
Error Responses
Code: 404 NOT FOUND
{
message: 'Transaction not found',
}
Code: 500 INTERNAL SERVER ERROR
// there was an issue updating Transaction status
{
message: `Error canceling transaction: <error details>`,
}