update README.md

This commit is contained in:
ZerosDev
2023-03-03 09:43:10 +07:00
parent baadc99d30
commit f9a5bc3de0

View File

@@ -11,7 +11,7 @@
</p>
## Requirements
- PHP v7.2+
- PHP v7.2.5+
- PHP JSON Extension
- PHP cURL Extension
@@ -31,6 +31,7 @@ require 'path/to/your/vendor/autoload.php';
use ZerosDev\TriPay\Client as TriPayClient;
use ZerosDev\TriPay\Support\Constant;
use ZerosDev\TriPay\Support\Helper;
use ZerosDev\TriPay\Transaction;
$merchantCode = 'T12345';
@@ -42,13 +43,21 @@ $guzzleOptions = []; // Your additional Guzzle options (https://docs.guzzlephp.o
$client = new TriPayClient($merchantCode, $apiKey, $privateKey, $mode, $guzzleOptions);
$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
->addOrderItem('Gula', 10000, 1)
->addOrderItem('Kopi', 6000, 1)
->addOrderItem('Kopi', 6000, 5)
->create([
'method' => 'BRIVA',
'merchant_ref' => 'INV123',
'customer_name' => 'Nama Pelanggan',
'customer_email' => 'email@konsumen.id',
'customer_phone' => '081234567890',
'expired_time' => Helper::makeTimestamp('6 HOUR'),
]);
echo $result->getBody()->getContents();