Goods & Services API documentation

Goods & Services API documentation
4. Nauta Cuba


Service Description

This service allows the recharge of an Nauta account in Cuba used to browse the Internet. This is a real time recharge similar to the top-up solution.

The main difference now is that instead of reloading using a “phone number” you use the “nauta account” aka “username”.

Pre-conditions

Currently there are 2 possibles types of accounts:

  1. example@nauta.co.cu - international email + national navigation

  2. example@nauta.com.cu - internet access

Note: Please make sure the account name is correct, otherwise the recharge will fail.

Product IDs

You will find below the list of the currently available Product IDs that can be used to recharge a Nauta Account using our API.

GET /operators/2174/products - Will always return the latest list of products.

Product_id Operator Country Currency Product Value
175 Nauta Cuba (2174) Cuba (717) CUC 10
176 Nauta Cuba (2174) Cuba (717) CUC 12
177 Nauta Cuba (2174) Cuba (717) CUC 14
178 Nauta Cuba (2174) Cuba (717) CUC 16
179 Nauta Cuba (2174) Cuba (717) CUC 18
180 Nauta Cuba (2174) Cuba (717) CUC 20
181 Nauta Cuba (2174) Cuba (717) CUC 25
182 Nauta Cuba (2174) Cuba (717) CUC 30
183 Nauta Cuba (2174) Cuba (717) CUC 35
184 Nauta Cuba (2174) Cuba (717) CUC 40
185 Nauta Cuba (2174) Cuba (717) CUC 45
186 Nauta Cuba (2174) Cuba (717) CUC 47

How it works

Below you will find an example of an actual Nauta Cuba recharge. Make sure to read the entire API Documenttion if you need help on how to send a request.

Request :

POST /transactions/fixed_value_recharges

Body:

{
    "account_number": "jardines3@nauta.com.cu",
    "product_id": "175",
    "external_id": "123458",
    "simulation": "0",
    "recipient_sms_notification": "1",
    "sender_sms_notification": "1",
    "sender": {
        "last_name": "JARDINES",
        "middle_name": "",
        "first_name": "Harold",
        "email": "harold.jardines@dtone.com",
        "mobile": 13050000000
    },
    "recipient": {
        "last_name": "",
        "middle_name": "Jardines",
        "first_name": "Jose",
        "email": "jardines3@nauta.com.cu",
        "mobile": 5352440000
    }
}

Response :

HTTP Code: 201

Body:

{
    "transaction_id": "45264",
    "simulation": "0",
    "status": "0",
    "status_message": "Transaction successful",
    "date": "2015-10-23 15:56:14",
    "account_number": "jardines3@nauta.com.cu",
    "external_id": "123458",
    "operator_reference": "",
    "product_id": "175",
    "product": "Nauta Cuba 10 CUC",
    "product_desc": "Nauta WIFI Recharge 10 CUC",
    "product_currency": "CUC",
    "product_value": "10.00",
    "local_currency": "CUC",
    "local_value": "10.00",
    "operator_id": "2174",
    "operator": "Nauta Cuba",
    "country_id": "717",
    "country": "Cuba",
    "account_currency": "USD",
    "wholesale_price": "9.96",
    "retail_price": "12.00",
    "fee": "0.00",
    "sender": {
        "last_name": "JARDINES",
        "middle_name": "",
        "first_name": "Harold",
        "email": "harold.jardines@dtone.com",
        "mobile": "13050000000",
        "custom_field_1": "",
        "custom_field_2": "",
        "custom_field_3": ""
    },
    "recipient": {
        "last_name": "",
        "middle_name": "Jardines",
        "first_name": "Jose",
        "email": "jardines3@nauta.com.cu",
        "mobile": "5352440000",
        "custom_field_1": "",
        "custom_field_2": "",
        "custom_field_3": ""
    }
}

To check if an account is valid for a product, there is dedicated endpoint, see the following example:

Request :

GET /products/175/account_number/jardines3@nauta.com.cu/status

Body:

    {
        "verified":1
    }

If the account is not valid :

Request :

GET /products/175/account_number/invalid@nauta.co.cu/status

Body:

    {
        "verified":0
    }

For any additional help please make sure to contact us via support@dtone.com

PHP Full Example

Below you will find a PHP Example. Please do not put this in production without analyzing the code.

<?php

# You can use $_POST, $_GET, $_REQUEST to pass this variables.
$account_number = 'your_name@nauta.com.cu';
$product_id  = '175';   # The product you want to send
$external_id  = time(); # Your company unique Transaction ID.
$simulation  = '1';     # 1 = This is a Simulation, 0 =  This is a Real Transaction
$sender_sms_notification = '1'; # The sender will receive a notification
$recipient_sms_notification = '1'; # The recipient will receive a notification
$sender_last_name  = $_REQUEST['sender_last_name'];
$sender_middle_name = $_REQUEST['sender_middle_name'];
$sender_first_name  = $_REQUEST['sender_first_name'];
$sender_email  = $_REQUEST['sender_email'];
$sender_mobile = "13050000000";   # Mobile number for Sender Notification
$recipient_last_name = $_REQUEST['recipient_last_name'];
$recipient_middle_name = $_REQUEST['recipient_middle_name'];
$recipient_first_name = $_REQUEST['recipient_first_name'];
$recipient_email = $_REQUEST['recipient_email'];
$recipient_mobile  = "5352440000"; # Mobile number for Recipient Notification

$data = array(
    'account_number' => $account_number,
    'product_id' => $product_id,
    'external_id' => $external_id,
    'simulation' => $simulation,
    'sender_sms_notification' => $sender_sms_notification,
    'recipient_sms_notification' => $recipient_sms_notification,
    'sender' => array(
        'last_name' => $sender_last_name,
        'middle_name' => $sender_middle_name,
        'first_name' => $sender_first_name,
        'email' => $sender_email,
        'mobile' => $sender_mobile
        ),
    'recipient' => array(
        'last_name' => $recipient_last_name,
        'middle_name' => $recipient_middle_name,
        'first_name' => $recipient_first_name,
        'email' => $recipient_email,
        'mobile' => $recipient_mobile
        )
    );

$data_json = json_encode($data);

$api_key = 'your_api_key';
$api_secret = 'your_api_secret';
$nonce = time();
$host = 'https://gs-api.dtone.com/v1.1';


# POST Parameter
$resource = 'transactions/fixed_value_recharges';

$hmac = base64_encode(hash_hmac('sha256', $api_key.$nonce, $api_secret, true ));
echo "hmac : $hmac".PHP_EOL;

// set up the curl resource
$ch = curl_init();
$url = "$host/$resource";
echo "URL: ".$url.PHP_EOL;
echo "JSON: ".$data_json.PHP_EOL;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    "X-TransferTo-apikey: $api_key",
    "X-TransferTo-nonce: $nonce",
    "X-TransferTo-hmac: $hmac",
    'Content-Type: application/json',
    'Content-Length: ' . strlen($data_json)
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");

// execute the request
$output = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
// close curl resource to free up system resources
curl_close($ch);

echo $output."\n";