https://github.com/zerosdev/durianpay-php-client
https://github.com/zerosdev/durianpay-php-client
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/zerosdev/durianpay-php-client
- Owner: zerosdev
- License: mit
- Created: 2021-11-17T14:40:38.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-08-21T08:54:33.000Z (over 1 year ago)
- Last Synced: 2025-10-19T00:08:46.014Z (6 months ago)
- Language: PHP
- Size: 40 KB
- Stars: 0
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
durianpay-php-client
## About
This library give you an easy way to call DurianPay API in elegant code style. Example :
```php
Durianpay::orders()->fetch();
```
```php
Durianpay::payments()
->setType('VA')
->setRequest(function (Request $request) {
$request->setOrderId('ord_JGytr64yGj8')
->setBankCode('XXX')
->setName('Nama Pelanggan')
->setAmount(10000);
})
->charge()
```
## Installation
1. Run command
composer require zerosdev/durianpay-php-client
### The following steps only needed if you are using Laravel
2. Then
php artisan vendor:publish --provider="ZerosDev\Durianpay\Laravel\ServiceProvider"
3. Edit **config/durianpay.php** and put your API credentials
## Usage
### Laravel
```php
setAmount(10000)
->setPaymentOption('full_payment')
->setCurrency('IDR')
->setOrderRefId("123456")
->setCustomer(function (Customer $customer) {
$customer->setEmail('email@customer.com')
->setAddress(function (Address $address) {
$address->setReceiverName('Nama Penerima');
});
})
->setItems(function (Items $items) {
$items->add('Nama Produk', 10000, 1, 'https://google.com/product.jpg');
})
->setMetadata(function (Metadata $metadata) {
$metadata->setMerchantRef('123456789');
})
->create();
dd($order);
}
}
```
### Non-Laravel
```php
orders()
->setAmount(10000)
->setPaymentOption('full_payment')
->setCurrency('IDR')
->setOrderRefId("123456")
->setCustomer(function (Customer $customer) {
$customer->setEmail('email@customer.com')
->setAddress(function (Address $address) {
$address->setReceiverName('Nama Penerima');
});
})
->setItems(function (Items $items) {
$items->add('Nama Produk', 10000, 1, 'https://google.com/product.jpg');
})
->setMetadata(function (Metadata $metadata) {
$metadata->setMerchantRef('123456789');
})
->create();
print_r($order);
```