PHP code example of programster / leaddyno

1. Go to this page and download the library: Download programster/leaddyno 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/ */

    

programster / leaddyno example snippets




use Programster\LeadDyno\LeadDyno;
use Programster\LeadDyno\LineItem;
use Programster\LeadDyno\LineItemCollection;

sr7\HttpFactory(),
    new \GuzzleHttp\Client(),
);

$lineItems = new LineItemCollection(
    new LineItem(
        sku: "Botswana1",
        description: "A ticket to Botswana",
        quantity: "1",
        amount: "123.45",
    ),
);

$response = $leadDyno->createPurchase(
    customerEmail: "[email protected]",
    purchaseAmount: 123.45,
    purchaseId: "9eb2d2b1-f4fb-4b2c-84e3-688f950db50d",
    planCode: "Default",
    affiliateCode: "someAffiliateCode",
    description: "Description of purchase goes here.",
    lineItems: $lineItems,
);

if ($response->getStatusCode() === 201)
{
    // Purchase succssfully registered...
}
else
{
    // Handle error response here...
}