PHP code example of etchfoda / tap-gosell

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

    

etchfoda / tap-gosell example snippets

require_once('vendor/autoload.php');
require_once('/pathto/Tap-Payments/gosell-sdk-php/vendor/autoload.php');

use TapPayments\GoSell;

  
//set yout secret key here
GoSell::setPrivateKey("sk_test_XKokBfNWv6FIYuTMg5sLPjhJ");

  

$charge = GoSell\Charges::create(
	[
      "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"=> true
      ],
      "customer"=> [
        "first_name"=> "test",
        "middle_name"=> "test",
        "last_name"=> "test",
        "email"=> "[email protected]",
        "phone"=> [
          "country_code"=> "965",
          "number"=> "50000000"
        ]
      ],
      "source"=> [
        "id"=> "src_all"
      ],
      "post"=> [
        "url"=> "http://your_website.com/post_url"
      ],
      "redirect"=> [
        "url"=> "http://your_website.com/redirect_url"
      ]
    ]
);

  

echo '<pre>';
var_dump($charge); //will give charge response as PHP object