tappayments/gosell

v0.2 2020-04-08 07:00 UTC

README

PHP from Packagist (specify version) Latest Stable Version Build Status Total Downloads License Coverage Status

GoSell PHP SDK

Official bindings to GoSell API.

Note: Detailed REST API request and response schema can be found at API Documentation

Requirements

This library supports PHP 5.6 and later.

Installation

The recommended way to install GoSell PHP SDK is through Composer:

composer require tappayments/gosell

To use the bindings, use Composer's autoload:

require_once('vendor/autoload.php');

Manual Installation

If you do not wish to use Composer, you can download the latest release. Then, to use the bindings, include the vendor.php file.

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

Getting Started

use TapPayments\GoSell;

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

  

$charge = GoSell\Charges::create(
	[
      "amount"=> 1,
      "currency"=> "KWD",
      "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"=> "test@test.com",
        "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

Code samples

More Help