PHP code example of mx13 / accept

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

    

mx13 / accept example snippets


 $apiContext = new ApiContext();    // MX13\Accept\ApiContext
 
 $item = new Item();    // MX13\Accept\Item
 // Set item details
 $item->setName('Product 1')    
     ->setDescription('Some Product')
     ->setAmountCents(9900) // Item price in cents
     ->setQuantity(1);

 $itemList = new ItemList();    // MX13\Accept\ItemList
 // Set list of items
 $itemList->setItems([$item]);

 $amount = new Amount();    // MX13\Accept\Amount
 // Set amount currency and amount in cents
 $amount->setCurrency('EGP')    
     ->setAmountCents($itemList->getTotal());

 $billingData = new BillingData();  // MX13\Accept\BillingData
 // Set billing data, mandatory by Accept and all  $payment->execute(); // Execute payment