Skip to content

5-Minute Quickstart

This quickstart follows the Aegean Voyages (aegeanvoyages.example) charter deposit and club membership examples in site/modules/Payments/examples/real-world/.

  1. Configure a sandbox gateway

    Open Setup -> Payments -> Gateways, click + Set Up Gateway on Dummy Test Gateway (or Manual / Bank Transfer / EFT), give it handle aegean-sandbox, set mode to sandbox, and enable it.

  2. Authorize and capture a charter deposit

    <?php namespace ProcessWire;
    use Totoglu\Payments\Domain\Money;
    use Totoglu\Payments\Domain\PaymentIntentRequest;
    $payments = Payments::requireInstance($wire);
    $intent = new PaymentIntentRequest(
    amount: Money::fromMajor('4900.00', 'EUR'),
    payableType: 'charter_booking',
    payableId: 'CHR-2026-104',
    idempotencyKey: 'charter:CHR-2026-104:deposit:v1',
    gatewayHandle: 'aegean-sandbox',
    customerEmail: '[email protected]',
    customerName: 'Claire Beaumont',
    description: '30% charter deposit for Gulet Blue Horizon',
    );
    // Step A: Hold funds with authorize()
    $auth = $payments->authorize($intent);
    // Step B: Capture once yacht availability is confirmed
    $capture = $payments->capture($auth->transactionId);
    // Verify total paid for the booking
    $isPaid = $payments->isPaid('charter_booking', 'CHR-2026-104');
    $summary = $payments->summaryForPayable('charter_booking', 'CHR-2026-104');
  3. Generate a hosted /pay/{token} link for the final balance

    <?php namespace ProcessWire;
    use Totoglu\Payments\Domain\Money;
    $link = $payments->createPaymentLink([
    'title' => 'Final Balance: Gulet Blue Horizon (CHR-2026-104)',
    'amount' => Money::fromMajor('9800.00', 'EUR'),
    'payable_type' => 'charter_invoice',
    'payable_id' => 'INV-2026-104',
    'customer_email' => '[email protected]',
    'expires_in_hours' => 72,
    ]);
    // Share $link['url'] (uses $link['rawToken'], returned once at creation)
  4. Start a recurring subscription

    Create a billing plan in Setup -> Payments -> Plans (for example aegean-club-pro at 199.00 EUR / month with a 14-day trial), then subscribe a member:

    <?php namespace ProcessWire;
    $subscription = $payments->subscribe([
    'plan_handle' => 'aegean-club-pro',
    'gateway_handle' => 'aegean-sandbox',
    'user_id' => (int) $user->id,
    'customer_email' => '[email protected]',
    'customer_name' => 'Claire Beaumont',
    ]);
  5. Inspect the ledger in Setup -> Payments

    Open Setup -> Payments -> Transactions, Payment Links, and Subscriptions to confirm your authorization, capture, hosted link, and trialing subscription appear in real time.

Next steps