PHP code example of tavp / tavphive

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

    

tavp / tavphive example snippets


use Tavp\Hive\BillingManager;

// Initialize billing with Mayar gateway
$billing = new BillingManager([
    'gateways' => [
        'mayar' => [
            'driver' => 'mayar',
            'api_key' => env('MAYAR_API_KEY'),
            'sandbox' => true, // false untuk production
        ],
    ],
]);

// Create checkout
$result = $billing->createCheckout('mayar', [
    'product_name' => 'Pro Plan',
    'amount' => 290000,
    'currency' => 'IDR',
]);

// Redirect user to checkout URL
header('Location: ' . $result['checkout_url']);