Getting started
Setup and usage

Setup and usage

The Web API supplies a collection of HTTP methods that underpin the majority of GRWV.APP functionality. To start using the Web API follow the tutorial below.

Usage

Make a POST call to the https://admin.grwv.app/api.php link. You can use the following PHP function to make the calls:


                                        function api($query) {
                                            $ch = curl_init('https://admin.grwv.app/api.php');
                                            $parameters = [
                                                    CURLOPT_RETURNTRANSFER => true,
                                                    CURLOPT_SSL_VERIFYPEER => false,
                                                    CURLOPT_POST => true,
                                                    CURLOPT_CONNECTTIMEOUT => 5,
                                                    CURLOPT_POSTFIELDS => http_build_query(array_merge(['api-key' => 'YOUR-API-KEY'], $query))
                                            ];
                                            curl_setopt_array($ch, $parameters); 
                                            $response = curl_exec($ch);
                                            curl_close($ch);
                                            return $response, true;
                                        }
                                    

Usage example: api(['function' => 'get-user', 'user_id' => 123]).


Since client-side JavaScript files are accessible by anyone, your API key is also accessible by anyone and therefore this method is not secure.
                                        $.post('https://admin.grwv.app/api.php', {
                                            api-key: 'YOUR-API-KEY',
                                            function: 'FUNCTION-NAME',
                                        }, function (response) {
                                            response = JSON.parse(response);
                                            if (response.success) {
                                                 
                                            }
                                        });
                                    

The variable $response will contains the JSON response. You can add new arguments in the query array: ['api-key' => '', 'function' => '', 'argument-name' => 'value', ...].


Replace the following strings with the correct values:

  • Replace YOUR-API-KEY with the your API key, get it from GRWV.APP > Account > API key. Your API key must be kept always secret.
  • Replace FUNCTION-NAME with the name of the API function you want to use. Get them from the methods listed below.
  • Example

    
    function api($query) {
        $ch = curl_init('https://admin.grwv.app/api.php');
        $parameters = [
                CURLOPT_RETURNTRANSFER => true,
                CURLOPT_SSL_VERIFYPEER => false,
                CURLOPT_POST => true,
                CURLOPT_CONNECTTIMEOUT => 5,
                CURLOPT_POSTFIELDS => http_build_query(array_merge(['api-key' => 'YOUR-API-KEY-HERE'], $query))
        ];
        curl_setopt_array($ch, $parameters); 
        $response = curl_exec($ch);
        curl_close($ch);
        return json_decode($response, true);
    }
    // Example usage to get transactions
    $transactions = api([
        'function' => 'vat',
    	'amount' => '10',
    ]);
    // Print out the transactions
    print_r($transactions);
                                        

    Return

    
    Array ( 
    	[success] => 1 
    	[response] => Array ( 
    		[0] => 12.1 
    		[1] => 2.1 
    		[2] => NL 
    		[3] => Netherlands 
    		[4] => Including 2.1 for VAT in Netherlands 
    		[5] => 21 
    		) 
    	)
                                        

REST API
Transactions

Transactions


get-transactions

Returns all GRWV.APP transactions.


Arguments

api-key
Your API key.
function
Enter get-transactions.
pagination
Set the pagination number from 0 to N. Returns only 100 results per page. Set it to -1 to get all results. Default: 0.
search
Returns only the transactions matching the specified search terms. Default: false.
status
Returns only the transactions with the given status. Accepted values: C(completed), P(pending), R(refunded), X(underpayment). Default: false.
cryptocurrency
Returns only the transactions in the given cryptocurrency. Default: false.
date_range
Returns only the transactions within the date range. Syntax: ['yyyy-mm-dd', 'yyyy-mm-dd']. Example: ['2024-06-02', '2024-06-03'].

Response

[
    {
	    "id": "433",
	    "title": "",
	    "description": "",
	    "from": "",
	    "to": "0x078303fEf888Eadd849312d8b73ca82933e5d00A",
	    "hash": "",
	    "amount": "56430.00032102",
	    "amount_fiat": "10",
	    "cryptocurrency": "grwv",
	    "currency": "usd",
	    "external_reference": "",
	    "creation_time": "2024-05-30 15:57:51",
	    "status": "P",
	    "webhook": "0"
    },
    ...
]  

get-transaction

Returns a GRWV.APP transaction.


Arguments

api-key
Your API key.
function
Enter get-transaction.
transaction_id
Set transaction ID.

Response

{
	"id": "433",
	"title": "",
	"description": "",
	"from": "",
	"to": "0x078303fEf888Eadd849312d8b73ca82933e5d00A",
	"hash": "",
	"amount": "56430.00032102",
	"amount_fiat": "10",
	"cryptocurrency": "grwv",
	"currency": "usd",
	"external_reference": "",
	"creation_time": "2024-05-30 15:57:51",
	"status": "P",
	"webhook": "0"
}                               

create-transaction

Create a new transaction ready to be paid by the user.


Arguments

api-key
Your API key.
function
Enter create-transaction.
amount
The transaction amount in FIAT, e.g. 123.
cryptocurrency_code
The cryptocurrency code, e.g. btc.
currency_code
The currency code, e.g. usd. Default: Settings > Currency.
external_reference
Enter the string you want, it will be sent via webhook and as a redirect URL parameter.
title
Enter the string you want, it will be shown in the the admin area.
note
Enter the string you want, it will be shown in the the admin area.
billing
A JSON string containing billing details. Default empty string.
vat
A JSON string containing billing details. Default empty string.
checkout_id
The checkout ID linked to the transaction. Default false.
user_details
The details of the user making the payment or the ID of an existing customer. Example : [first_name: "", last_name: "", email: ""] or 123. If the user does not exists, it will be created. This attribute is supported only if the shop app is installed. Default false.
discount_code
The discount code. This attribute is supported only if the shop app is installed. Default false.

Response

[111, '564300.00032102', '0x078303fEf888Eadd849312d8b73ca82933e5d00A', 3, 'afe3444afg6j']                                 

[transaction ID, cryptocurrency amount to pay, payment address, minimum confirmations, encrypted transaction]


update-transaction

Update a transaction.


Arguments

api-key
Your API key.
function
Enter update-transaction.
transaction_id
The transaction ID.
values
Array in JSON format, with the values to update. Syntax: ['key' => 'value', 'key' => 'value', ...]. Example: ['status' => 'C', 'title' => 'Example']. Allowed keys: title, description, from, to, hash, amount, amount_fiat, cryptocurrency, currency, external_reference, creation_time(2022-04-14 10:00:00), status (C for completed, P for pending, R for refunded, X for underpayment), billing, vat, vat_details (JSON array).

Response

true

check-transactions

Check the latest Blockchain transactions of the payment address and returns the Blockchain transaction details if the payment is detected.


Arguments

api-key
Your API key.
function
Enter check-transactions.
transaction_id
The transaction ID.

Response

Returns false if the payment is not found, or an encrypted string if the payment is detected. The encrypted string can be used as the value of the transaction attribute of the function check-transaction.


check-transaction

Returns the details of a Blockchain transaction.


Arguments

api-key
Your API key.
function
Enter check-transaction.
transaction
Enter the encrypted string returned by the function check-transactions.

Response

{
    "confirmed" => true,
    "confirmations" => 1155,
    "minimum_confirmations" => 3,
    "hash" => "8f50833a701b122698d56a4412d7c92bd56af97..."
}

invoice

Generate an invoice and return the URL to the invoice file.


Arguments

api-key
Your API key.
function
Enter invoice.
transaction_id
The transaction ID.

Response

https://admin.grwv.app/invoice

REST API
Checkout

Checkout


get-checkouts

Returns the checkouts list, or a single checkout.


Arguments

api-key
Your API key.
function
Enter get-checkouts.
checkout_id
The checkout ID. Leave it empty to get all checkouts.

Response

[{
    "id": "1",
    "title": "Custom Token Listing",
    "description": "List your custom token",
    "price": "199",
    "currency": "USD",
    "type": "I",
    "redirect": "https://t.me/grwv_ruben",
    "external_reference": "",
    "creation_time": "2024-04-06 10:32:17"
}, {
    "id": "2",
    "title": "Test,
    "description": "",
    "price": "1.5",
    "currency": "EUR",
    "type": "P",
    "redirect": "",
    "external_reference": "",
    "creation_time": "2024-04-06 11:05:19"
},
...
]

save-checkout

Create a new checkout, or update an existing one..


Arguments

api-key
Your API key.
function
Enter save-checkout.
checkout
Pass the checkout array below in JSON format or get it from the function get-checkouts. Add the key id: CHECKOUT-ID to update an existing checkout.
{
    "title": "MyCheckout",
    "description": "",
    "price": "99",
    "currency": "USD",
    "type": "I",
    "redirect": "",
    "external_reference": "",
    "creation_time": "2024-02-02 10:00:00"
}

Response

Returns the checkout ID.


delete-checkout

Delete a checkout.


Arguments

api-key
Your API key.
function
Enter delete-checkout.
checkout_id
The checkout ID.

Response

true

Returns the payment link of a transaction.


Arguments

api-key
Your API key.
function
Enter payment-link.
transaction_id
The transaction ID.

Response

https://admin.grwv.app/pay.php?id=1234

REST API
Miscellaneous

Miscellaneous


vat

Returns the VAT information of a given amount and country.


Arguments

api-key
Your API key.
function
Enter vat.
amount
The amount.
country_code
The country code of the VAT-registered country you want to apply. If not provided, the country is automatically retrieved from the user's IP. Default: false.
currency_code
The currency code of the provided amount. Default: false.

Response

[12.2,2.2,"IT","Italy","Including  2.2 for VAT in Italy",22]

vat-validation

Validate a VAT number.


Arguments

api-key
Your API key.
function
Enter vat-validation.
vat_number
The VAT number.

Response

Returns true if the VAT number is valid, otherwise returns false.