From f9a5bc3de0a7842840aea0a09b24ac6b23be0b06 Mon Sep 17 00:00:00 2001 From: ZerosDev Date: Fri, 3 Mar 2023 09:43:10 +0700 Subject: [PATCH] update README.md --- README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4e95d7f..baf6094 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@

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