PHP code example of autlantic / billing

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

    

autlantic / billing example snippets


use Autlantic\Billing\AutlanticBilling;

$billing = AutlanticBilling::fromEnv(); // AUTLANTIC_BILLING_API_KEY

$link = $billing->createPaymentLink([
  'amountUsdc' => 42,
  'merchantRefPrefix' => 'invoice',
  'successUrl' => 'myapp://billing/success',
  'cancelUrl' => 'myapp://billing/cancel',
]);
// Share $link['url'] or open it with a mobile Checkout SDK

use Autlantic\Billing\Webhook;

$ok = Webhook::verify($secret, $rawBody, $_SERVER['HTTP_X_AUTLANTIC_SIGNATURE'] ?? null);
$event = Webhook::parseEvent($rawBody);
// Unlock on invoice.paid / payment.paid / subscription.activated