PHPackages                             aceraven777/laravel-paymaya - 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. aceraven777/laravel-paymaya

ActiveLibrary[Payment Processing](/categories/payments)

aceraven777/laravel-paymaya
===========================

PayMaya Payment integration to Laravel

v1.1.3(3y ago)1823.8k↓50%7[1 issues](https://github.com/aceraven777/laravel-paymaya/issues)MITPHPPHP &gt;=5.3.0CI failing

Since May 13Pushed 3y ago4 watchersCompare

[ Source](https://github.com/aceraven777/laravel-paymaya)[ Packagist](https://packagist.org/packages/aceraven777/laravel-paymaya)[ RSS](/packages/aceraven777-laravel-paymaya/feed)WikiDiscussions master Synced 1mo ago

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

Integrate PayMaya payments in Laravel
=====================================

[](#integrate-paymaya-payments-in-laravel)

[![Build Status](https://camo.githubusercontent.com/072c51a0494a4931247247eaf128587013457ea86efa81ce3d597b8a9e4f87b3/68747470733a2f2f7472617669732d63692e6f72672f616365726176656e3737372f6c61726176656c2d7061796d6179612e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/aceraven777/laravel-paymaya)

Integrated PayMaya SDK () and port it to Laravel.

- [Installation](#installation)
- [Usage](#usage)
    - [Setting up Webhooks](#setting-up-webhooks)
    - [Customize Merchant Page](#customize-merchant-page)
    - [Checkout](#checkout)
    - [Webhook Callback](#webhook-callback)
    - [Void Payment](#void-payment)
    - [Refund Payment](#refund-payment)
- [Donate](#donate)

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

[](#installation)

Run the following command to install:

```
composer require aceraven777/laravel-paymaya "~1.1"
```

Run the following command to publish `User` library file:

```
php artisan vendor:publish --provider "Aceraven777\PayMaya\PayMayaServiceProvider"
```

Usage
-----

[](#usage)

When you run `php artisan vendor:publish` it will create file in `config/paymaya.php` and `app/Libraries/PayMaya/User.php`, you may edit this file based on your needs.

For the sample codes below you have to define `PAYMAYA_PUBLIC_KEY` and `PAYMAYA_SECRET_KEY` in your `.env` file for your API keys. Here's the link for sandbox API keys for PayMaya:

### Setting up Webhooks

[](#setting-up-webhooks)

```
use Aceraven777\PayMaya\PayMayaSDK;
use Aceraven777\PayMaya\API\Webhook;

public function setupWebhooks()
{
    PayMayaSDK::getInstance()->initCheckout(
        config('paymaya.public_key'),
        config('paymaya.secret_key'),
        (app()->environment('production') ? 'PRODUCTION' : 'SANDBOX')
    );

    $this->clearWebhooks();

    $successWebhook = new Webhook();
    $successWebhook->name = Webhook::CHECKOUT_SUCCESS;
    $successWebhook->callbackUrl = url('callback/success');
    $successWebhook->register();

    $failureWebhook = new Webhook();
    $failureWebhook->name = Webhook::CHECKOUT_FAILURE;
    $failureWebhook->callbackUrl = url('callback/error');
    $failureWebhook->register();

    $dropoutWebhook = new Webhook();
    $dropoutWebhook->name = Webhook::CHECKOUT_DROPOUT;
    $dropoutWebhook->callbackUrl = url('callback/dropout');
    $dropoutWebhook->register();
}

private function clearWebhooks()
{
    $webhooks = Webhook::retrieve();
    foreach ($webhooks as $webhook) {
        $webhook->delete();
    }
}
```

### Customize Merchant Page

[](#customize-merchant-page)

```
use Aceraven777\PayMaya\PayMayaSDK;
use Aceraven777\PayMaya\API\Customization;

public function customizeMerchantPage()
{
    PayMayaSDK::getInstance()->initCheckout(
        config('paymaya.public_key'),
        config('paymaya.secret_key'),
        (app()->environment('production') ? 'PRODUCTION' : 'SANDBOX')
    );

    $shopCustomization = new Customization();
    $shopCustomization->get();

    $shopCustomization->logoUrl = asset('logo.jpg');
    $shopCustomization->iconUrl = asset('favicon.ico');
    $shopCustomization->appleTouchIconUrl = asset('favicon.ico');
    $shopCustomization->customTitle = 'PayMaya Payment Gateway';
    $shopCustomization->colorScheme = '#f3dc2a';

    $shopCustomization->set();
}
```

### Checkout

[](#checkout)

```
use Aceraven777\PayMaya\PayMayaSDK;
use Aceraven777\PayMaya\API\Checkout;
use Aceraven777\PayMaya\Model\Checkout\Item;
use App\Libraries\PayMaya\User as PayMayaUser;
use Aceraven777\PayMaya\Model\Checkout\ItemAmount;
use Aceraven777\PayMaya\Model\Checkout\ItemAmountDetails;

public function checkout()
{
    PayMayaSDK::getInstance()->initCheckout(
        config('paymaya.public_key'),
        config('paymaya.secret_key'),
        (app()->environment('production') ? 'PRODUCTION' : 'SANDBOX')
    );

    $sample_item_name = 'Product 1';
    $sample_total_price = 1000.00;

    $sample_user_phone = '1234567';
    $sample_user_email = 'test@gmail.com';

    $sample_reference_number = '1234567890';

    // Item
    $itemAmountDetails = new ItemAmountDetails();
    $itemAmountDetails->tax = "0.00";
    $itemAmountDetails->subtotal = number_format($sample_total_price, 2, '.', '');
    $itemAmount = new ItemAmount();
    $itemAmount->currency = "PHP";
    $itemAmount->value = $itemAmountDetails->subtotal;
    $itemAmount->details = $itemAmountDetails;
    $item = new Item();
    $item->name = $sample_item_name;
    $item->amount = $itemAmount;
    $item->totalAmount = $itemAmount;

    // Checkout
    $itemCheckout = new Checkout();

    $user = new PayMayaUser();
    $user->contact->phone = $sample_user_phone;
    $user->contact->email = $sample_user_email;

    $itemCheckout->buyer = $user->buyerInfo();
    $itemCheckout->items = array($item);
    $itemCheckout->totalAmount = $itemAmount;
    $itemCheckout->requestReferenceNumber = $sample_reference_number;
    $itemCheckout->redirectUrl = array(
        "success" => url('returl-url/success'),
        "failure" => url('returl-url/failure'),
        "cancel" => url('returl-url/cancel'),
    );

    if ($itemCheckout->execute() === false) {
        $error = $itemCheckout::getError();
        return redirect()->back()->withErrors(['message' => $error['message']]);
    }

    if ($itemCheckout->retrieve() === false) {
        $error = $itemCheckout::getError();
        return redirect()->back()->withErrors(['message' => $error['message']]);
    }

    return redirect()->to($itemCheckout->url);
}
```

### Webhook Callback

[](#webhook-callback)

```
use Illuminate\Http\Request;
use Aceraven777\PayMaya\PayMayaSDK;
use Aceraven777\PayMaya\API\Checkout;

public function callback(Request $request)
{
    PayMayaSDK::getInstance()->initCheckout(
        config('paymaya.public_key'),
        config('paymaya.secret_key'),
        (app()->environment('production') ? 'PRODUCTION' : 'SANDBOX')
    );

    $transaction_id = $request->get('id');
    if (! $transaction_id) {
        return ['status' => false, 'message' => 'Transaction Id Missing'];
    }

    $itemCheckout = new Checkout();
    $itemCheckout->id = $transaction_id;

    $checkout = $itemCheckout->retrieve();

    if ($checkout === false) {
        $error = $itemCheckout::getError();
        return redirect()->back()->withErrors(['message' => $error['message']]);
    }

    return $checkout;
}
```

### Void Payment

[](#void-payment)

```
use Aceraven777\PayMaya\PayMayaSDK;
use Aceraven777\PayMaya\API\VoidPayment;

public function voidPayment($checkoutId)
{
    PayMayaSDK::getInstance()->initCheckout(
        config('paymaya.public_key'),
        config('paymaya.secret_key'),
        (app()->environment('production') ? 'PRODUCTION' : 'SANDBOX')
    );

    $voidPayment = new VoidPayment;
    $voidPayment->checkoutId = $checkoutId;
    $voidPayment->reason = 'The item is out of stock.';

    $response = $voidPayment->execute();

    if ($response === false) {
        $error = $voidPayment::getError();
        return redirect()->back()->withErrors(['message' => $error['message']]);
    }

    return $response;
}
```

### Refund Payment

[](#refund-payment)

Refund a checkout.

```
use Aceraven777\PayMaya\PayMayaSDK;
use Aceraven777\PayMaya\API\RefundPayment;
use Aceraven777\PayMaya\Model\Refund\Amount;

public function refundPayment($checkoutId)
{
    PayMayaSDK::getInstance()->initCheckout(
        config('paymaya.public_key'),
        config('paymaya.secret_key'),
        (app()->environment('production') ? 'PRODUCTION' : 'SANDBOX')
    );

    $refundAmount = new Amount();
    $refundAmount->currency = "PHP";
    $refundAmount->value = 200.22;

    $refundPayment = new RefundPayment;
    $refundPayment->checkoutId = $checkoutId;
    $refundPayment->reason = 'The item is out of stock.';
    $refundPayment->amount = $refundAmount;

    $response = $refundPayment->execute();

    if ($response === false) {
        $error = $refundPayment::getError();
        return redirect()->back()->withErrors(['message' => $error['message']]);
    }

    return $response;
}
```

Get refund attempts of a checkout.

```
use Aceraven777\PayMaya\PayMayaSDK;
use Aceraven777\PayMaya\API\RefundPayment;

public function retrieveRefunds($checkoutId)
{
    PayMayaSDK::getInstance()->initCheckout(
        config('paymaya.public_key'),
        config('paymaya.secret_key'),
        (app()->environment('production') ? 'PRODUCTION' : 'SANDBOX')
    );

    $refundPayment = new RefundPayment;
    $refundPayment->checkoutId = $checkoutId;

    $refunds = $refundPayment->retrieve();

    if ($refunds === false) {
        $error = $refundPayment::getError();
        return redirect()->back()->withErrors(['message' => $error['message']]);
    }

    return $refunds;
}
```

Retrieve information of a particular refund.

```
use Aceraven777\PayMaya\PayMayaSDK;
use Aceraven777\PayMaya\API\RefundPayment;

public function retrieveRefundInfo($checkoutId, $refundId)
{
    PayMayaSDK::getInstance()->initCheckout(
        config('paymaya.public_key'),
        config('paymaya.secret_key'),
        (app()->environment('production') ? 'PRODUCTION' : 'SANDBOX')
    );

    $refundPayment = new RefundPayment;
    $refundPayment->checkoutId = $checkoutId;
    $refundPayment->refundId = $refundId;

    $refund = $refundPayment->retrieveInfo();

    if ($refund === false) {
        $error = $refundPayment::getError();
        return redirect()->back()->withErrors(['message' => $error['message']]);
    }

    return $refund;
}
```

Donate
------

[](#donate)

### Via GCash

[](#via-gcash)

[![Logo](./assets/qr-code-donate.png)](./assets/qr-code-donate.png)

### Via PayPal

[](#via-paypal)

[![Donate](https://camo.githubusercontent.com/604e3db9c8751116b3f765aad0353ec7ded655bbe8aaacbc38d8c4a6b784b3ed/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f6e6174652d50617950616c2d677265656e2e737667)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Q4XLBV46V3958)

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 88.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~114 days

Recently: every ~190 days

Total

15

Last Release

1317d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b504f0ed76ad0b6f8fc972186abac3b3478c486f9aa7af3161de071fa84be9c4?d=identicon)[aceraven777](/maintainers/aceraven777)

---

Top Contributors

[![aceraven777](https://avatars.githubusercontent.com/u/2563083?v=4)](https://github.com/aceraven777 "aceraven777 (32 commits)")[![NikkoJaca](https://avatars.githubusercontent.com/u/45310280?v=4)](https://github.com/NikkoJaca "NikkoJaca (2 commits)")[![lloricode](https://avatars.githubusercontent.com/u/8251344?v=4)](https://github.com/lloricode "lloricode (1 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

---

Tags

laravelpaymayaphp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/aceraven777-laravel-paymaya/health.svg)

```
[![Health](https://phpackages.com/badges/aceraven777-laravel-paymaya/health.svg)](https://phpackages.com/packages/aceraven777-laravel-paymaya)
```

###  Alternatives

[laraveldaily/laravel-invoices

Missing invoices for Laravel

1.5k1.3M4](/packages/laraveldaily-laravel-invoices)[musahmusah/laravel-multipayment-gateways

A Laravel Package that makes implementation of multiple payment Gateways endpoints and webhooks seamless

852.2k1](/packages/musahmusah-laravel-multipayment-gateways)[karson/mpesa-php-sdk

172.2k](/packages/karson-mpesa-php-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
