ezhasyafaat / purwantara-laravel
Package for use payment in purwantara.id
1.0.6
2022-10-04 15:36 UTC
Requires
- php: ^7.0|^8.0
- friendsofphp/php-cs-fixer: ^3.11
- illuminate/support: ^6.0|^7.0|^8.0|^9.0
Requires (Dev)
- orchestra/testbench: ^7.7
- phpunit/phpunit: ^9.5
README
PURWANTARA LARAVEL
✨ What is Purwantara?
Purwantara is a digital payment service provider that helps businesses to accept digital payments with seamless and secure. Some of the payment services provided by Purwantara are Virtual Account, E Wallet, Credit Card and QRIS.⚙️ How to install
composer require ezhasyafaat/purwantara-laravel
🛠 Setup configuration
php artisan vendor:publish --provider="Ezhasyafaat\PurwantaraPayment\PurwantaraServiceProvider" --tag="config"
And you have to provide bearer token in .env file. You can get bearer token at purwantara.id
PURWANTARA_TOKEN="BEARER_TOKEN_FROM_PURWANTARA" PURWANTARA_MODE="SANDBOX" #You can fill this with "SANDBOX" for sandbox mode or "PRODUCTION" for production mode
💈 Virtual account
Virtual accounts is a medium for receiving payments that customer pay.- EXAMPLE CREATE VIRTUAL ACCOUNT
use Illuminate\Support\Str; use Ezhasyafaat\PurwantaraPayment\Purwantara; public function create_va() { $input = [ 'display_name' => 'John Doe', // Merchant store name 'channel_name' => 'BRI', //Payment channel at purwantara.id 'order_id_merchant' => Str::uuid(), //Unique id from merchant, customize by merchant 'expected_amount' => 10000, //Amount of virtual account 'description' => 'Testing create virtual account' //Description of virtual account 'expired_at' => Carbon::now()->addHours(2), //Set expired tme ]; $purwantara = new Purwantara; $response = $purwantara->create_virtual_account($input); }
- EXAMPLE CANCEL VIRTUAL ACCOUNT
use App\Models\Transaction; use Ezhasyafaat\PurwantaraPayment\Purwantara; public function cancel_va() { $transaction = Transaction::find(20); $input = [ 'purwantara_uuid' => $transaction->purwantara_uuid ]; $purwantara = new Purwantara; $response = $purwantara->cancel_virtual_account($input); }
- EXAMPLE INQUIRY VIRTUAL ACCOUNT
use App\Models\Transaction; use Ezhasyafaat\PurwantaraPayment\Purwantara; public function inquiry_va() { $transaction = Transaction::find(20); $input = [ 'purwantara_uuid' => $transaction->purwantara_uuid ]; $purwantara = new Purwantara; $response = $purwantara->inquiry_virtual_account($input); }
🧸 QRIS
Create QRIS serves as a means of payment for client.- EXAMPLE CREATE QRIS
use Illuminate\Support\Str; use Ezhasyafaat\PurwantaraPayment\Purwantara; public function create_qris() { $input = [ 'amount' => 10000, //Amount of qris 'customer_email' => 'johndoe@apps.com', //Customer email 'customer_first_name' => 'John', //Customer first name 'customer_last_name' => 'Doe', //Customer last name 'customer_phone' => '0812345678910', //Customer phone number 'description' => 'Testing create qris', //Description of qris 'channel_name' => 'shopeepay', //Payment channel at purwantara.id 'order_id_merchant' => Str::uuid() ]; $purwantara = new Purwantara; $response = $purwantara->create_qris($input); }
- EXAMPLE INQUIRY QRIS
use App\Models\Transaction; use Ezhasyafaat\PurwantaraPayment\Purwantara; public function inquiry_qris() { $transaction = Transaction::find(20); $input = [ 'purwantara_uuid' => $transaction->purwantara_uuid ]; $purwantara = new Purwantara; $response = $purwantara->inquiry_qris($input); }
- EXAMPLE CREATE PAYMENT LINK
use Illuminate\Support\Str; use Ezhasyafaat\PurwantaraPayment\Purwantara; public function create_paymentlink() { $input = [ 'amount' => 10000, 'title' => 'SMARTPHONE STORE', 'description' => 'Buy Smartphone', 'expired_at' => Carbon::now()->addHour(), 'external_id' => Str::uuid(), 'return_url' => 'https://myapp.test/payment' ]; $purwantara = new Purwantara; $response = $purwantara->create_payment_link($input); }