PHP code example of moathdev / tap
1. Go to this page and download the library: Download moathdev/tap library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
moathdev / tap example snippets
Route::get('/getCharge/{charge_id}', function($charge_id)
{
$res = Tap::getCharge(['charge_id' => $charge_id]);
dd($res);
});
Route::get('/createCharge', function()
{
$res = Tap::createCharge([
'amount'=> 1,
'currency' => 'SAR',
'threeDSecure' => true,
'save_card' => false,
'description' => 'Test Description',
'statement_descriptor' => 'Sample',
'metadata' => [
'udf1' => 'test 1',
'udf2' => 'test 2',
],
'reference' => [
'transaction' => 'txn_0001',
'order' => 'ord_0001',
],
'receipt' => [
'email' => false,
'sms' => false,
],
'customer' => [
'first_name' => "test",
'middle_name' => "test",
'last_name' => "test",
'email' => "[email protected] ",
'phone' => [
'country_code' => "965",
'number' => "50000000",
],
],
'merchant' => [
'id' => ''
],
'source' => [
'id' => 'src_all',
],
'post' => [
'url' => 'http://your_website.com/post_url'
],
'redirect' => [
'url' => 'http://your_website.com/post_url'
]
]);
dd($res);
});
Route::get('/getCharge/{refund_id}', function($refund_id)
{
$res = Tap::getRefund(['refund_id' => $refund_id]);
dd($res);
});
Route::get('/createRefund', function()
{
$res = Tap::createRefund([
'charge_id' => 'chg_TS022520210006x9R20903398',
'amount' => 1,
'currency' => 'SAR',
'description' => 'Test Description',
'reason' => 'requested by customer',
'reference' => [
'merchant' => 'txn_0001'
],
'metadata' => [
'udf1' => 'test1',
'udf2' => 'test2',
]
]);
dd($res);
});
/config/tap.php