An open API service indexing awesome lists of open source software.

https://github.com/zerosdev/durianpay-php-client


https://github.com/zerosdev/durianpay-php-client

Last synced: 2 months ago
JSON representation

Awesome Lists containing this project

README

          

durianpay-php-client



release
language
license
size
downloads
pulls

## 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);
```