https://github.com/ferdhika31/ipaymu-php
iPaymu REST API Client for PHP
https://github.com/ferdhika31/ipaymu-php
composer-package ipaymu ipaymu-api library payment-gateway payment-gateway-indonesia php-cli php7
Last synced: 12 months ago
JSON representation
iPaymu REST API Client for PHP
- Host: GitHub
- URL: https://github.com/ferdhika31/ipaymu-php
- Owner: ferdhika31
- License: gpl-3.0
- Created: 2020-11-25T08:13:14.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2020-11-27T10:43:55.000Z (over 5 years ago)
- Last Synced: 2025-02-01T08:16:10.348Z (about 1 year ago)
- Topics: composer-package, ipaymu, ipaymu-api, library, payment-gateway, payment-gateway-indonesia, php-cli, php7
- Language: PHP
- Homepage:
- Size: 80.1 KB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
iPaymu REST API Client PHP
==============
[iPaymu](https://ipaymu.com) API wrapper written in PHP for access from applications.
[](https://travis-ci.org/ferdhika31/iPaymu-php)
[](https://github.styleci.io/repos/315871520)
[](https://coveralls.io/github/ferdhika31/iPaymu-php?branch=main)
[](https://packagist.org/packages/ferdhika31/iPaymu-php)
[](https://packagist.org/packages/ferdhika31/iPaymu-php)
[](https://packagist.org/packages/ferdhika31/iPaymu-php)
[](https://packagist.org/packages/ferdhika31/iPaymu-php)
## Documentation
For the API documentation, please check [iPaymu API Documentation](https://ipaymu.com/en/api-documentation/).
## Installation
Install the package with [composer](https://getcomposer.org/) by following command:
```
composer require ferdhika31/ipaymu-php
```
## Usage
### Initialization
Configure package with your account's secret key obtained from iPaymu Dashboard. You can use [production](https://my.ipaymu.com/) or [sandbox](https://sandbox.ipaymu.com/) environment.
```php
'SANDBOX', // SANDBOX or PRODUCTION
'virtual_account' => 'your_virtual_account',
'api_key' => 'your_api_key',
'notify_uri' => 'http://localhost:8000/notify',
// for redirect payment is required
'cancel_uri' => 'http://localhost:8000/cancel',
'return_uri' => 'http://localhost:8000/return'
];
iPaymu::init($config);
```
See [example codes](./examples) for more details.
### Get Balance
```php
'Dika',
'email' => 'fer@dika.web.id',
'phone' => '083213123332'
];
iPaymu::setCustomer($customer);
```
### Add Product
```php
'Mangga',
'qty' => 2,
'price' => 2500,
'description' => 'Mangga cobian'
]);
iPaymu::addProduct([
'name' => 'Jeruk',
'qty' => 1,
'price' => 1500,
'description' => 'Jeruk haseum'
]);
```
### Create Redirect Payment
```php
1, // in hours
'comments' => 'Transaction comment here',
'referenceId' => 'TRX202008310001'
];
$redirectPayment = PaymentRedirect::create($payloadTrx);
```
### Create Redirect Payment with Payment Method
```php
1, // in hours
'comments' => 'Transaction comment here',
'referenceId' => 'TRX202008310001'
];
$redirectPayment = PaymentRedirect::mandiriVA()->create($payloadTrx);
$redirectPayment = PaymentRedirect::niagaVA()->create($payloadTrx);
$redirectPayment = PaymentRedirect::BNIVA()->create($payloadTrx);
$redirectPayment = PaymentRedirect::BAGVA()->create($payloadTrx);
$redirectPayment = PaymentRedirect::BCATransfer()->create($payloadTrx);
$redirectPayment = PaymentRedirect::QRIS()->create($payloadTrx);
$redirectPayment = PaymentRedirect::CStore()->create($payloadTrx);
$redirectPayment = PaymentRedirect::creditCard()->create($payloadTrx);
$redirectPayment = PaymentRedirect::COD()->create($payloadTrx);
$redirectPayment = PaymentRedirect::akulaku()->create($payloadTrx);
```
### Create Direct Payment
```php
5000,
// optional
'expired' => 10,
'expiredType' => 'minutes', // in:seconds,minutes,hours,days
'comments' => 'Transaction comment here',
'referenceId' => 'TRX202008310001'
];
// Available channel Virtual Account : bag, bni, cimb (default), mandiri
$channel = 'mandiri';
$directPayment = PaymentDirect::VA($channel)->create($payloadTrx);
// Available channel Transfer Bank : bca (default)
$channel = 'bca';
$directPayment = PaymentDirect::bankTransfer($channel)->create($payloadTrx);
// Available channel Convenience Store : indomaret (default), alfamart
$channel = 'alfamart';
$directPayment = PaymentDirect::cStore($channel)->create($payloadTrx);
// Available channel: linkaja (default)
$channel = 'linkaja';
$directPayment = PaymentDirect::QRIS($channel)->create($payloadTrx);
```
### Get Transaction Detail
```php