To send topup transaction.

Parameter Description
product_id Integer. Product ID. How get products?
amount Double. Amount to send.
phonenumber String. Destination phone number.
reference_id Integer. Reference ID from the customer(Optional).

    curl --request GET \
         --url https://unicomusaonline.com/api/v1/topups \
         --header 'x-iotopup-user: USER' \
         --header 'x-iotopup-password: PASSWORD' \
         --header 'x-iotopup-key: KEY' 
            

    var client = new RestClient("https://unicomusaonline.com/api/v1/topups");
    var request = new RestRequest(Method.POST);
    
    request.AddHeader("x-iotopup-user", "APP-USER");
    request.AddHeader("x-iotopup-password", "APP-PASSWORD");
    request.AddHeader("x-iotopup-key", "APP-KEY");

    request.AddParameter("product_id", "2");
    request.AddParameter("amount", "5");
    request.AddParameter("phonenumber", "50999999999");

    //optional
    request.AddParameter("reference_id", "20");
    
    IRestResponse response = client.Execute(request);
            

    $params = array(
        'product_id' => 2,
        'amount' => 5,
        'phonenumber' => '50999999999',
        'reference_id' => 20
        );

    $curl = curl_init(); 
        
    curl_setopt_array($curl, array(
        CURLOPT_URL => "https://unicomusaonline.com/api/v1/topups",
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => "",
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_POSTFIELDS => $params,
        CURLOPT_CUSTOMREQUEST => "POST",
        CURLOPT_HTTPHEADER => array(
                "x-iotopup-user: USER",
                "x-iotopup-password: PASSWORD",
                "x-iotopup-key: KEY"
            ),
        ));

        $response = curl_exec($curl);
        $err = curl_error($curl);

        curl_close($curl);

        if ($err) {
            
            echo $err;
            
        } else {
            echo $response;
        }
            
    
    {
        "response_code": 200,
        "error_message": "",
        "response": {
          "invoice": "2016040731",
          "created": "2016-07-04 04:07:31",
          "amount": 5,
          "phone": "50999999999",
          "country": "Haiti",
          "deliveredAmount": "311.25(HTG)",
          "paymentMethod": "Cash",
          "product": "Digicel Haiti Test"
        }
    }
   
Field Description
invoice Integer. Invoice number.
created Datetime. Transaction datetime.
amount Double. Amount sent.
phone String. Destination phone number.
country String. Destination country.
deliveredAmount String. Delivered amount in destination country.
paymentMethod String. Payment method used by customer.
product String. Product name.
Product ID Phone Number Result
2 50999999999 Transaction OK
2 50988888888 Transaction Error: Invalid Phone Number
2 50937777777 Transaction Error: Invalid amount
2 50966666666 Transaction Error: Payment amount outside acceptable range