Skip to content

makepay-io/makepay-symfony-bundle

Repository files navigation

MakePay Symfony Bundle

Reusable Symfony bundle for MakePay payment links, customers, bookkeeping invoices, and signed webhook handling.

Features

  • Autowireable MakePayClient using Symfony HttpClient.
  • Bundle configuration for MakePay key ID, key secret, webhook secret, and base URL.
  • Helpers for payment links, customers, bookkeeping invoices, and invoice payment links.
  • Fixed-time X-MakePay-Signature verifier.
  • Optional webhook route/controller that dispatches a Symfony event after verification.

Installation

composer require makepay/symfony-bundle

Register the bundle if Symfony Flex does not do it automatically:

// config/bundles.php
return [
    MakePay\Bundle\MakePayBundle\MakePayBundle::class => ['all' => true],
];

Configuration

# config/packages/make_pay.yaml
make_pay:
  base_url: '%env(default:MAKEPAY_BASE_URL:https://www.makecrypto.io)%'
  key_id: '%env(MAKEPAY_KEY_ID)%'
  key_secret: '%env(MAKEPAY_KEY_SECRET)%'
  webhook_secret: '%env(MAKEPAY_WEBHOOK_SECRET)%'

Client Usage

use MakePay\Bundle\MakePayBundle\Client\MakePayClient;

final class BillingController
{
    public function __construct(private readonly MakePayClient $makePay)
    {
    }

    public function createLink(): array
    {
        return $this->makePay->createPaymentLink([
            'title' => 'Pro plan',
            'amount' => '49.00',
            'currency' => 'USD',
            'customerEmail' => 'customer@example.com',
            'returnUrl' => 'https://example.com/billing/return',
            'metadata' => ['account_id' => 'acct_123'],
        ]);
    }
}

Webhooks

Import the route:

# config/routes/make_pay.yaml
make_pay:
  resource: '@MakePayBundle/config/routes.yaml'

Subscribe to verified events:

use MakePay\Bundle\MakePayBundle\Event\MakePayWebhookEvent;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;

#[AsEventListener(event: MakePayWebhookEvent::NAME)]
final class MakePayWebhookListener
{
    public function __invoke(MakePayWebhookEvent $event): void
    {
        $payload = $event->payload;
        // Reconcile invoices, orders, subscriptions, or entitlements here.
    }
}

The bundled route listens on POST /webhooks/makepay.

Development

composer install
composer validate --strict
vendor/bin/phpunit
php scripts/lint.php
npm run validate

About

Symfony bundle for MakePay payment links and signed webhooks. Cryptocurrency payment gateway for direct self-custody merchant-wallet settlement, decentralized swaps, and 70+ coin/20+ chain auto-conversion.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors