mirror of
https://github.com/zerosdev/tripay-sdk-php.git
synced 2026-01-07 01:01:29 +00:00
update README.md
This commit is contained in:
13
README.md
13
README.md
@@ -11,7 +11,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
- PHP v7.2+
|
- PHP v7.2.5+
|
||||||
- PHP JSON Extension
|
- PHP JSON Extension
|
||||||
- PHP cURL Extension
|
- PHP cURL Extension
|
||||||
|
|
||||||
@@ -31,6 +31,7 @@ require 'path/to/your/vendor/autoload.php';
|
|||||||
|
|
||||||
use ZerosDev\TriPay\Client as TriPayClient;
|
use ZerosDev\TriPay\Client as TriPayClient;
|
||||||
use ZerosDev\TriPay\Support\Constant;
|
use ZerosDev\TriPay\Support\Constant;
|
||||||
|
use ZerosDev\TriPay\Support\Helper;
|
||||||
use ZerosDev\TriPay\Transaction;
|
use ZerosDev\TriPay\Transaction;
|
||||||
|
|
||||||
$merchantCode = 'T12345';
|
$merchantCode = 'T12345';
|
||||||
@@ -42,13 +43,21 @@ $guzzleOptions = []; // Your additional Guzzle options (https://docs.guzzlephp.o
|
|||||||
$client = new TriPayClient($merchantCode, $apiKey, $privateKey, $mode, $guzzleOptions);
|
$client = new TriPayClient($merchantCode, $apiKey, $privateKey, $mode, $guzzleOptions);
|
||||||
$transaction = new Transaction($client);
|
$transaction = new Transaction($client);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* `amount` will be calculated automatically from order items
|
||||||
|
* so you don't have to enter it
|
||||||
|
* In this example, amount will be 40.000
|
||||||
|
*/
|
||||||
$result = $transaction
|
$result = $transaction
|
||||||
->addOrderItem('Gula', 10000, 1)
|
->addOrderItem('Gula', 10000, 1)
|
||||||
->addOrderItem('Kopi', 6000, 1)
|
->addOrderItem('Kopi', 6000, 5)
|
||||||
->create([
|
->create([
|
||||||
'method' => 'BRIVA',
|
'method' => 'BRIVA',
|
||||||
|
'merchant_ref' => 'INV123',
|
||||||
'customer_name' => 'Nama Pelanggan',
|
'customer_name' => 'Nama Pelanggan',
|
||||||
'customer_email' => 'email@konsumen.id',
|
'customer_email' => 'email@konsumen.id',
|
||||||
|
'customer_phone' => '081234567890',
|
||||||
|
'expired_time' => Helper::makeTimestamp('6 HOUR'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
echo $result->getBody()->getContents();
|
echo $result->getBody()->getContents();
|
||||||
|
|||||||
Reference in New Issue
Block a user