Skip to content

makepay-io/makepay-laravel

Repository files navigation

MakePay Laravel

Laravel package for MakePay payment links, checkout helpers, bookkeeping, and webhook verification.

This package wraps the official makepay/makepay-php SDK with Laravel config, service container bindings, and a facade.

Installation

composer require makepay/makepay-laravel

Publish the config:

php artisan vendor:publish --tag=makepay-config

Set environment variables:

MAKEPAY_KEY_ID=
MAKEPAY_KEY_SECRET=
MAKEPAY_WEBHOOK_SECRET=
MAKEPAY_BASE_URL=https://www.makecrypto.io
MAKEPAY_CHECKOUT_BASE_URL=https://makepay.io

Never expose MAKEPAY_KEY_SECRET or MAKEPAY_WEBHOOK_SECRET to browser code, mobile apps, public repositories, or logs.

Usage

use MakePay\Laravel\Facades\MakePay;

$payment = MakePay::createPaymentLink([
    'title' => 'Order #1042',
    'amount' => '129.99',
    'currency' => 'USDT',
    'orderId' => 'order_1042',
    'customerEmail' => 'buyer@example.com',
    'returnUrl' => route('orders.show', 'order_1042'),
]);

return redirect($payment['paymentLink']['publicUrl']);

Dependency Injection

use MakePay\Laravel\MakePayManager;

final class CheckoutController
{
    public function __invoke(MakePayManager $makePay)
    {
        return $makePay->createPaymentLink([
            'amount' => '49',
            'currency' => 'USDT',
            'title' => 'Checkout',
        ]);
    }
}

Webhooks

Read the raw request body before parsing JSON.

use Illuminate\Http\Request;
use MakePay\Laravel\Facades\MakePay;

Route::post('/webhooks/makepay', function (Request $request) {
    $payload = MakePay::parseWebhook(
        $request->getContent(),
        $request->header('X-MakePay-Signature')
    );

    if (($payload['event']['type'] ?? null) === 'status_changed') {
        // Reconcile order status idempotently by deliveryId and session id.
    }

    return response()->json(['ok' => true]);
});

Bookkeeping

$invoice = MakePay::createBookkeepingInvoice([
    'title' => 'Invoice #1042',
    'currency' => 'USD',
    'counterparty' => [
        'name' => 'Buyer Example',
        'email' => 'buyer@example.com',
    ],
    'lineItems' => [
        [
            'description' => 'Implementation services',
            'quantity' => '1',
            'unitAmount' => '500',
        ],
    ],
]);

Tests

composer install
composer validate --strict
composer test

Maintainer: Ethan Carter (makepayio).

About

Laravel package for MakePay payment links, checkout helpers, bookkeeping, and webhook verification. 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

Languages