Download the PHP package vp-trading/chapa-laravel without Composer
On this page you can find all versions of the php package vp-trading/chapa-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package chapa-laravel
Chapa Laravel Package
Installation
To install the chapa-laravel package, follow these steps:
-
Require the package via Composer:
-
Publish the configuration, route, and migration files:
The package comes with config, route, and migration files to help you get started quickly.
-
Run the migration:
-
Configure your
.envfile: Add your Chapa API keys: - Ready to use! You can now use the package in your Laravel application.
Usage
Before you start using this package you should know all amount must be put in cent values. The development of this package took standards from stripe. So for example if you want the amount be 100 Birr you will put 10000.
Here are some basic usage examples:
Initialize Payment
The Customization in the acceptPayment() method is optional and can be left out.
Chapa API v2
API v1 remains the default so existing applications continue to work without changes. To opt in to API v2, add:
The v2 API uses https://api.chapa.global/v2 by default. You can override it with CHAPA_V2_BASE_URL when needed.
The existing acceptPayment(), verifyPayment(), and refund() PHP interfaces remain unchanged. Under v2:
- Hosted payments use the nested
customerpayload and a generatedmerchant_reference. AcceptPaymentResponse::$transaction_idcontinues to contain that generated merchant reference.verifyPayment()expects the Chapa payment reference returned by Chapa through verification or a webhook.refund()expects the successful payment's Chapa reference.- The legacy
returnUrlandCustomizationarguments are retained for source compatibility but are not sent by the v2 hosted-payment API. Configure redirect and checkout presentation using the options supported by your Chapa v2 dashboard.
During migration, the included webhook endpoint accepts both v1 and v2 payload formats. When CHAPA_WEBHOOK_SECRET is configured, both formats require a valid x-chapa-signature generated from the exact raw request body.
Verify Payment
Refund
The amount and reason in the refund method are optional and can be left null.
Webhook
Chapa sends webhooks for all payment-related events to your application. This package provides a default webhook controller to handle these events. You can extend or override the default controller Vptrading\ChapaLaravel\Http\Controllers\WebhookController::class to implement custom logic for different webhook events.
To customize webhook handling, create your own controller and update the route in your application as needed.
Default route for receiving webhook is:
/vp/chapa/webhook
You can change the route by changing the CHAPA_CALLBACK_URL env variable.
🚀 And that's it. Do your thing and Give us a star if this helped you.🚀
All versions of chapa-laravel with dependencies
illuminate/http Version ^11.0 || ^12.0 || ^13.0
moneyphp/money Version ^4.7