bamalik1996 / tap-payment-gateway-laravel
dev-main
2023-04-30 16:05 UTC
Requires
- php: ^7.4|^8.0
- guzzlehttp/guzzle: ^7.5
- illuminate/support: 5.* || 6.* || 7.* || 8.* || 9.*
Requires (Dev)
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-09-30 01:52:21 UTC
README
Tap Payment SDK Package for PHP Laravel
Installation
You can install the package via composer:
composer require bamalik1996/tap-payment-gateway-laravel
Environment Variables
To run this project, you will need to add the following environment variables to your .env file
TAP_PAYMENT_MODE
= 'sandbox' // production
TAP_PAYMENT_SECRET_KEY
TAP_PAYMENT_PUBLISH_KEY
TAP_PAYMENT_SANDBOX_SECRET_KEY
TAP_PAYMENT_SANDBOX_PUBLISH_KEY
## Documentation (Charge)
Charge Create
use Bamalik1996\TapPaymentGateway\TapPaymentGateway;
$trans_object["amount"] = 123; $trans_object["currency"] = 'AED'; $trans_object["threeDsecure"] = true; $trans_object["save_card"] = false; $trans_object["description"] = "ORDER ID :" . 1; $trans_object["statement_descriptor"] = 'Sample'; $trans_object["metadata"]["udf1"] = 'test'; $trans_object["metadata"]["udf2"] = 'test'; $trans_object["reference"]["transaction"] = 'txn_0000' . 2; $trans_object["reference"]["order"] = 2; $trans_object["receipt"]["email"] = false; $trans_object["receipt"]["sms"] = true; $trans_object["customer"]["first_name"] = 'auth()->user()->last_name'; $trans_object["customer"]["last_name"] = 'auth()->user()->first_name'; $trans_object["customer"]["email"] = 'auth()->user()->email'; $trans_object["customer"]["phone"]["country_code"] = ''; $trans_object["customer"]["phone"]["number"] = ''; $trans_object["source"]["id"] = 'src_all'; $trans_object["post"]["url"] = '1'; $trans_object["redirect"]["url"] = 'v'; $tapPaymentGateway = new TapPaymentGateway; return ($tapPaymentGateway->charges()->create($trans_object));
Charge Update
use Bamalik1996\TapPaymentGateway\TapPaymentGateway; $tapPaymentGateway = new TapPaymentGateway; return $tapPaymentGateway->charges()->update($id,[ "description"=> "test", "receipt"=> [ "email"=> false, "sms"=> true ], "metadata"=> [ "udf2"=> "testing update" ] ]);
Charge Retrieve
use Bamalik1996\TapPaymentGateway\TapPaymentGateway; $tapPaymentGateway = new TapPaymentGateway; return $tapPaymentGateway->charges()->retrieve($id);
Charge Delete
use Bamalik1996\TapPaymentGateway\TapPaymentGateway; $tapPaymentGateway = new TapPaymentGateway; return $tapPaymentGateway->charges()->delete($id);
Charge All
use Bamalik1996\TapPaymentGateway\TapPaymentGateway; $tapPaymentGateway = new TapPaymentGateway; return $tapPaymentGateway->charges()->all([ "period"=> [ "date"=> [ "from"=> time() - (30 * 24 * 60 * 60),//last 30 days "to"=> time()//today ] ], "status"=> "", "starting_after"=> "", "limit"=> 25 ]);
Documentation (Custom)
Customer Create
use Bamalik1996\TapPaymentGateway\TapPaymentGateway;
$params = array ( 'first_name' => 'test', 'middle_name' => 'test', 'last_name' => 'test', 'email' => 'test@test.com', 'phone' => array ( 'country_code' => '965', 'number' => '51234567', ), 'description' => 'test', 'metadata' => array ( 'sample string 1' => 'string1', 'sample string 3' => 'string2', ), 'currency' => 'KWD', ); $tapPaymentGateway = new TapPaymentGateway; return ($tapPaymentGateway->customers()->create($params));
Customer Update
use Bamalik1996\TapPaymentGateway\TapPaymentGateway; $tapPaymentGateway = new TapPaymentGateway; return $tapPaymentGateway->customers()->update($id,[ 'first_name' => 'test', 'middle_name' => 'test', 'last_name' => 'test', 'email' => 'test@test.com', 'phone' => array ( 'country_code' => '965', 'number' => '51234567', ), 'description' => 'test', 'metadata' => array ( 'sample string 1' => 'string1', 'sample string 3' => 'string2', ), 'currency' => 'KWD', ]);
Customer Retrieve
use Bamalik1996\TapPaymentGateway\TapPaymentGateway; $tapPaymentGateway = new TapPaymentGateway; return $tapPaymentGateway->customers()->retrieve($id);
Customer Delete
use Bamalik1996\TapPaymentGateway\TapPaymentGateway; $tapPaymentGateway = new TapPaymentGateway; return $tapPaymentGateway->customers()->delete($id);
Customer All
use Bamalik1996\TapPaymentGateway\TapPaymentGateway; $tapPaymentGateway = new TapPaymentGateway; return $tapPaymentGateway->customers()->all([ "period"=> [ "date"=> [ "from"=> time() - (30 * 24 * 60 * 60),//last 30 days "to"=> time()//today ] ], "status"=> "", "starting_after"=> "", "limit"=> 25 ]);