PHPackages                             bagene/ph-payments - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. bagene/ph-payments

ActiveLibrary[Payment Processing](/categories/payments)

bagene/ph-payments
==================

A Package container for different PH compatible payment providers

0.2.1(2y ago)016MITPHPPHP ^8.1

Since Feb 17Pushed 2y ago1 watchersCompare

[ Source](https://github.com/bagene/ph-paymets)[ Packagist](https://packagist.org/packages/bagene/ph-payments)[ RSS](/packages/bagene-ph-payments/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (3)Versions (14)Used By (0)

Installation
------------

[](#installation)

```
composer require "bagene/ph-payments"
```

Configuration
-------------

[](#configuration)

```
php artisan vendor:publish --tag="ph-payments-config"
```

Usage
-----

[](#usage)

```
use Bagene\PhPayments\Helpers\PaymentBuilder;

PaymentBuilder::xendit();

$response = PaymentBuilder::xendit()
    ->invoice()
    ->create([
      'external_id' => 'invoice-123',
      'amount' => 100000,
      'payer_email' => 'test@example.org',
      'description' => 'Invoice #123',
      'success_redirect_url' => 'https://example.org/success',
      'failure_redirect_url' => 'https://example.org/failure',
  ]);

dump($response->getId());
dump($response->getExternalId());

return redirect()->away($response->getInvoiceUrl());
```

Methods
-------

[](#methods)

```
invoice() ['create', 'get']
qr() ['create'] - If supported
```

Webhooks
--------

[](#webhooks)

```
use Bagene\PhPayments\Helpers\PaymentBuilder;

public function xenditWebhook(Request $request)
{
    $gateway = PaymentBuilder::getXendidGateway();
    $response = $gateway->parseWebhookPayload($request);

    // Do something with the response
}
```

Alternatively, you can use the `xendit-webhook` route and Controller to handle the webhook.

```
php artisan vendor:publish --tag=ph-payments-routes
php artisan vendor:publish --tag=ph-payments-services

```

After publishing the routes, you can add the route to your `routes/payments.php` file and the Service folder. You can then use the `Services/WebhookService.php` to handle the webhook.

`routes/payments`

```
