<?php
require_once "blesta_api.php";
$user = "username";
$key = "key";
$url = "https://yourdomain.com/installpath/api/";
$api = new BlestaApi($url, $user, $key);
$data = array(
'vars' => array(
'client_id' => 1,
'date_billed' => date("c"),
'date_due' => date("c"),
'currency' => "USD",
'lines' => array(
array(
'description' => "Line item #1",
'amount' => "5.99"
),
array(
'description' => "Line item #2",
'amount' => "3.75",
'qty' => 2
)
),
'delivery' => array("email")
)
);
$response = $api->post("invoices", "add", $data);
print_r($response->response());
print_r($response->errors());
?>
|