PHPackages                             yupay/yupay-php - 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. [API Development](/categories/api)
4. /
5. yupay/yupay-php

ActiveLibrary[API Development](/categories/api)

yupay/yupay-php
===============

Official PHP SDK for the Yupay merchant API (charges, refunds, balance, webhooks).

v1.0.0(1mo ago)03MITPHPPHP &gt;=8.1

Since Jun 30Pushed 1mo agoCompare

[ Source](https://github.com/hwsdev/yupay-php)[ Packagist](https://packagist.org/packages/yupay/yupay-php)[ Docs](https://github.com/hwsdev/yupay-php)[ RSS](/packages/yupay-yupay-php/feed)WikiDiscussions main Synced 2w ago

READMEChangelogDependenciesVersions (2)Used By (0)

Yupay PHP SDK
=============

[](#yupay-php-sdk)

Official PHP client for the [Yupay merchant API](../../docs/merchant). Zero dependencies (uses `ext-curl`), PHP 8.1+.

Website &amp; docs: [yupay.id](https://yupay.id) · [Dashboard](https://app.yupay.id) · [API reference](https://yupay.id/docs)

Install
-------

[](#install)

```
composer require yupay/yupay-php
```

Or drop the `src/` folder into your project and `require` the files directly (PSR-4 namespace `Yupay\`).

Quickstart
----------

[](#quickstart)

```
use Yupay\Yupay;
use Yupay\Exceptions\YupayException;

$yupay = new Yupay(getenv('YUPAY_API_KEY'), [
    'base_url' => 'https://yupay.id/api/v1', // your Yupay instance
]);

try {
    $charge = $yupay->createCharge(
        ['amount' => 50000, 'method' => 'qris'],
        idempotencyKey: 'order-1001',
    );

    echo $charge['payment_no'];          // PAY-260626-AB12CD
    echo $charge['status'];              // pending
    print_r($charge['artifact']);        // qr_string / va_number / redirect_url …
} catch (YupayException $e) {
    error_log($e->getMessage());
    print_r($e->validationErrors());     // field errors on HTTP 422
}
```

Methods
-------

[](#methods)

```
$yupay->createCharge(array $params, ?string $idempotencyKey = null): array;
$yupay->retrieveCharge(string $paymentNo): array;
$yupay->refundCharge(string $paymentNo, ?int $amount = null, ?string $reason = null): array;
$yupay->balance(): array;
$yupay->paymentChannels(?string $category = null, bool $includeInactive = false): array;
```

All return the decoded JSON as an array; all throw `Yupay\Exceptions\YupayException` on error (`$e->statusCode`, `$e->response`, `$e->validationErrors()`).

Webhooks
--------

[](#webhooks)

Verify **and** decode an incoming webhook in one call. Pass the **raw** request body.

```
use Yupay\Webhook;
use Yupay\Exceptions\YupayException;

$payload = file_get_contents('php://input');
$sig     = $_SERVER['HTTP_X_YUPAY_SIGNATURE'] ?? '';

try {
    $event = Webhook::constructEvent($payload, $sig, getenv('YUPAY_WEBHOOK_SECRET'));
} catch (YupayException $e) {
    http_response_code(400);
    exit('invalid signature');
}

if ($event['event'] === 'payment.succeeded') {
    $payment = $event['data'];
    // fulfill order $payment['payment_no'] … (dedupe on $event['id'])
}

http_response_code(200);
echo 'ok';
```

> **Test your handler** without real payments: in the dashboard (**Developer → Webhooks**) use **Kirim test** or **Simulasi** to send a signed event to this endpoint, then check the **delivery log** — it shows your endpoint's response body, so a failed `constructEvent()` (HTTP 400) is easy to spot. See [webhooks docs](../../docs/merchant/webhooks.md#test--simulate).

See [`examples/`](examples) for a full charge flow and a webhook endpoint.

Links
-----

[](#links)

- Website: [yupay.id](https://yupay.id)
- Dashboard: [app.yupay.id](https://app.yupay.id)
- Documentation: [yupay.id/docs](https://yupay.id/docs)
- Support:

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance91

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

43d ago

### Community

Maintainers

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

---

Top Contributors

[![hwsdev](https://avatars.githubusercontent.com/u/26810271?v=4)](https://github.com/hwsdev "hwsdev (1 commits)")

---

Tags

apisdkpaymentindonesiaqrisyupay

### Embed Badge

![Health badge](/badges/yupay-yupay-php/health.svg)

```
[![Health](https://phpackages.com/badges/yupay-yupay-php/health.svg)](https://phpackages.com/packages/yupay-yupay-php)
```

###  Alternatives

[blocktrail/blocktrail-sdk

The BlockTrail PHP SDK, for integration of Bitcoin functionality through the BlockTrail API

4821.1k3](/packages/blocktrail-blocktrail-sdk)

PHPackages © 2026

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