PHP code example of sahlowle / tappayment

1. Go to this page and download the library: Download sahlowle/tappayment 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/ */

    

sahlowle / tappayment example snippets


use Sahlowle\TapPayment\Tap;

    $body = [
        'amount'=> 200,
        'description'=> 'iphone 14 pro max',
        'first_name'=> 'Ahmed',
        'last_name'=> 'Ali',
        'email'=> '[email protected]',
        'country_code'=> 966,
        'phone_number'=> 0555551122,
    ];

    $response = Tap::charge($body);

    return redirect($response->transaction->url);


use Sahlowle\TapPayment\Tap;

$tap_id = request()->tap_id;

$response = Tap::getCharge($tap_id);
    
if ($response->status == "CAPTURED"){
      return "successful payment";
}


Card Num : 4111 1111 1111 1111

Date : any future date

CVV : any cvv
bash
php artisan vendor:publish --tag="tap_payment.config"



return [

    /*
    |--------------------------------------------------------------------------
    | Tap Payment Config
    
    */

    'base_url' => 'https://api.tap.company/v2/',

    'token' => 'your-key',

    'currency' => 'SAR',

    'redirect_url' => 'http://localhost:8000/redirect_url',
    
];