PHP code example of vendasta / sales-orders

1. Go to this page and download the library: Download vendasta/sales-orders library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

vendasta / sales-orders example snippets


$environment = getenv("ENVIRONMENT");
if ($environment == null) {
    $environment = "DEMO";
}
$client = new Vendasta\SalesOrders\V1\SalesOrdersClient($environment);

// Create the request
$req = new CreateAndActivateOrderRequest();

// Create the line items
$gSuite = SalesOrdersUtils::buildLineItem('MP-6XDHVMQ84K4THNNP2Z7W2GC28VLHRC4Q');
$goDaddy = SalesOrdersUtils::buildLineItem('MP-NNTJMBF6HPXR5XXC2JKCFWKJ64VZLBFQ');
$lineItems = array($gSuite, $goDaddy);

// Create the custom field
$gSuiteCustomField = SalesOrdersUtils::buildGSuiteCustomField("MP-6XDHVMQ84K4THNNP2Z7W2GC28VLHRC4Q", 'testdomain123.com', 'adminusername', 'First', 'Last', '[email protected]');
$goDaddyCustomField = SalesOrdersUtils::buildGoDaddyCustomFields("MP-NNTJMBF6HPXR5XXC2JKCFWKJ64VZLBFQ", "testdomain123.com", "[email protected]", "First", "Last", "3065555555", "[email protected]", "First", "Last");
$customFields = array($gSuiteCustomField, $goDaddyCustomField);

// Create the order
$order = SalesOrdersUtils::buildOrder("ABC", "AG-123", $lineItems, $customFields);
$req->setOrder($order);

// Call CreateAndActivateOrder
$resp = $client->CreateAndActivateOrder($req);