2017 © Pedro Peláez
 

project php-ecom-sdk

Due PHP Library

image

due/php-ecom-sdk

Due PHP Library

  • Tuesday, July 25, 2017
  • by Due
  • Repository
  • 3 Watchers
  • 0 Stars
  • 25 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

Due E-Commerce PHP SDK

Sign up for a free account at https://app.due.com/register, (*1)

Working PHP Example: https://static.due.com/code-examples/due-ecom-php-test.zip, (*2)

Request Access: https://due.com/blog/request-access-use-due-payment-gateway-woocommerce/, (*3)

API Docs: https://api-docs.due.com, (*4)

Run in Postman, (*5)

Composer

You can install the bindings via Composer. Run the following command:, (*6)

composer require due/php-ecom-sdk

To use the bindings, use Composer's autoload:, (*7)

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 init.php file., (*8)

require_once('/path/to/php-ecom-sdk/init.php');

Getting Started

  1. The default environment is production, but you can set it to stage for testing
\Due\Due::setEnvName('stage'); //set to 'stage' or 'prod'
\Due\Due::setRailType('us'); //set to 'us' or 'us_int'
  1. Set your API Key and App Id
//API Key from your Due Account
\Due\Due::setApiKey(' -- SET API KEY HERE -- ');
//App Id given after approval
\Due\Due::setAppId(' -- SET APP ID HERE -- ');
  1. Platforms will set their Platform Id instead of an App Id. Please contact support@due.com for more info on Platform Payments.
//Platform user's Due API Key
\Due\Due::setApiKey(' -- SET API KEY HERE -- ');
//Platform Id given after approval
\Due\Due::setPlatformId(' -- SET PLATFORM ID HERE -- ');

Create A Customer

$customer = \Due\Customers::create(array(
    'email' => 'customer@email.com',
    'phone' => '2226061234',
    'full_name' => 'Alex Brown',
    'card_id' => '2726251911',
    'card_hash' => 'CC_f4nu9f2nfue9432fnu4e932fbu432gfb4u923fnjdwbu29'
));

$customer_id = $customer->id;

Charge A Customer

$transaction = \Due\Customers::charge(array(
    'amount' => 15,
    'currency' => 'USD',
    'customer_id' => $customer_id
));

$transaction_id = $transaction->id;

Get Transaction

$transaction = \Due\Transactions::get(array(
    'id' => $transaction_id
));

Get Transaction List

$transactions_list = \Due\Transactions::all(array(
    'page' => 1
));

foreach ($transactions_list->transactions as $transaction) {
    $transaction_id = $transaction->id;
}

Charge A Card

$transaction = \Due\Charge::card(array(
    'amount' => 15,
    'currency' => 'USD',
    'card_id' => '1238203690',
    'card_hash' => 'CC_XMzfDhNahJsfPAGPzVpX'
));

$transaction_id = $transaction->id;

Get A Customer

$customer = \Due\Customers::get(array(
    'id' => $customer_id
));

$customer_id = $customer->id;

Get Customer List

$customer_list = \Due\Customers::all(array(
    'page' => 1
));

foreach ($customer_list->customers as $customer) {
    $customer_id = $customer->id;
}

Update Customer

$customer->card_id = '132311820';
$customer->card_hash = 'CC_VXV81vIv7rx0VRXbLlxq';
$updated_customer = \Due\Customers::update($customer);

$customer_id = $customer->id;

Contribution Requests

If you would like to contribute, please contact us at support@due.com., (*9)

The Versions

25/07 2017

dev-master

9999999-dev

Due PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api e-commerce payment processing invoice marketplace due

24/07 2017

v1.0.7

1.0.7.0

Due PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api e-commerce payment processing invoice marketplace due

19/07 2017

v1.0.6

1.0.6.0

Due PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api e-commerce payment processing invoice marketplace due

14/07 2017

v1.0.5

1.0.5.0

Due PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api e-commerce payment processing invoice marketplace due

14/07 2017

v1.0.4

1.0.4.0

Due PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api e-commerce payment processing invoice marketplace due

08/04 2017

v1.0.3

1.0.3.0

Due PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api e-commerce payment processing invoice marketplace due

05/04 2017

v1.0.2

1.0.2.0

Due PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api e-commerce payment processing invoice marketplace due

31/03 2017

v1.0.1

1.0.1.0

Due PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api e-commerce payment processing invoice marketplace due

30/03 2017

v1.0.0

1.0.0.0

Due PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *
  • ext-json *
  • ext-mbstring *

 

The Development Requires

api e-commerce payment processing invoice marketplace due