Use of the payment service occurs through POST requests
On the secure communication channel with the node:
https://api.briacoin.com/api/
All incoming and outgoing requests contain JSON strings.
Authorization of most requests occurs through the mechanism
Google 2FA ,
libraries for its use exist for such languages
programming like: PHP, Node.JS, Ruby, Python and others.
Account registration
Request to the server:
{
"method": "createaccount",
"backurl": "https://myshop.com/accept.php"
}
"Createaccount" is the method for registering a new account (user) in
payment system;
"Backurl" - the URL to which the merchant will report a successful payment
POST request *.
* Please note - your server should use
Only valid certificates!
Server Response:
{
"result": {
"status": "ok",
"userid": 1,
"secret": "qta3whcytmysb2tq",
"balance": 0.0,
"backurl": "https://myshop.com/accept.php",
"timestamp": 1493195829
}
}
"userid" - the assigned ID for the new account, will be used in
For authorization;
"secret" is a hash string for generating the Google 2FA key.
Account updates (changes)
Request to the server:
{
"method": "updateaccount",
"backurl": "https://newshop.net/payok/",
"userid": 1,
"key": "490321"
}
"updateaccount" is the method for registering a new account (user) in
payment system;
"Backurl" - the URL to which the merchant will report a successful payment
POST request;
"userid" - the account ID for which the data is changing;
"key" is the generated Google 2FA key.
Server Response:
{
"result": {
"status": "ok",
"userid": 1,
"backurl": "http://newshop.net/payok/",
"timestamp": 1493197926
}
}
"userid" - Account ID,
"Backurl" - the URL to which the merchant will report a successful payment
POST request.
Checking account balance
Request a server:
{
"method": "getaccountbalance",
"userid": 1,
"key": "832712"
}
"balance" - method of requesting account balance;
"Userid" - Account ID whose balance is requested;
"key" is the generated Google 2FA key.
Server Response:
{
"result": {
"status": "ok",
"userid": 1,
"balance": 0.0,
"timestamp": 1493198052
}
}
"Userid" - Account ID of the requested account;
"balance" is the current balance.
Create an order
Request a server:
{
"method": "createorder",
"amount": 12.50,
"userid": 1,
"key": "209843"
}
"Order" - the method of creating a new order;
"Amount" - the amount to be paid for this order;
"key" is the generated Google 2FA key.
Server Response:
{
"result": {
"status": "ok",
"userid": 1,
"orderid": 1,
"wallet": «Bdr6RFA2GXhjFAPDmV3WHP7za5BHPYMKjT",
"amount": 12.5,
"timestamp": 1493195900
}
}
"userid" - account ID (the owner of the order, payment on the order is received on
account balance)
"orderid" - ordinal order ID;
"wallet" - a coin purse for the transfer of coins for payment of an order;
"amount" is the amount to be paid for this order.
Check order status
Request a server:
{
"method": "getorderstatus",
"orderid": 1,
"userid": 1,
"key": "398402"
}
"Orderstatus" - the method of requesting the order status;
"Orderid" - the order number of the payment order;
"Userid" - the ID of your user from whom the order was placed;
"key" is the generated Google 2FA key.
Server Response:
{
"result": {
"status": "ok",
"userid": 1,
"orderid": 1,
"wallet": «Bdr6RFA2GXhjFAPDmV3WHP7za5BHPYMKjT",
"amount": 10.0,
"paid": 0.0,
"orderstatus": "new",
"timestamp": 1493200005
}
}
"Userid" - the ID of your user from whom the order was placed;
"Orderid" - the order number of the payment order;
"Wallet" - a purse for the transfer of coins (this is in case, if forgotten)
"Amount" - the amount to be paid for this order;
"Paid" - received coins for this order;
"orderstatus" - order status:
The order status can have three basic statuses:
"new" - new (unpaid);
"part" - Not fully paid (in part);
"close" - paid and closed (funds
transferred to the account balance).
Transfer of coins (inference)
Request a server:
{
"method": "transfertoaddress",
"userid": 1,
"wallet": «BN9VuoMSk3LfVdars9PUntmv8r5ckHKnUZ",
"amount": 3.234,
"key": "398402"
}
"Transfertoaddress" - method of transferring coins from the account balance;
"Userid" - account ID from the balance of which the funds are transferred;
"Wallet" - a coin for which coins will be withdrawn
"Amount" - the amount of transfer (output)
"key" is the generated Google 2FA key.
Server Response:
{
"result": {
"status": "ok",
"userid": 2,
"txid": "7b76bf262f89be0dc9d17cd5d28d8fc155a1a3de57023b2ba1eeaf4b1ac7faeb",
"timestamp": 1493225903
}
}
"Userid" - account ID from the balance of which the funds are transferred;
"txid" is the hash of the transaction.
POST request to successful payment URL
On the successful payment URL, the merchant sends the following data:
{
:userid => 1,
:orderid => 23,
:amount => 2.0,
:key => "022637",
:timestamp => 1493228072
}
": Userid" - Account ID in the merchant system;
": Orderid" - order ID in the merchant system;
": Amount" - the cost of the order, upon payment;
": Key" - the generated reverse key by the Google 2FA server.
Error processing
Example of a server response when an error occurs:
{
"result": {
"status": "error",
"data": "Authorization filed!",
"timestamp": 1493195969
}
}
"error" - error return method;
"data" - the error description.