v1.0.2 2017-11-05 18:28 UTC

This package is not auto-updated.

Last update: 2024-05-08 00:15:53 UTC


README

Code climate
68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f35643632613134633262346462353439306162612f6d61696e7461696e6162696c697479

Install

$ composer require agile-pay/sdk

Usage

$agilePay = new \AgilePay\Sdk\AgilePay([
    'api_key' => '',
    'api_secret' => ''
]);

Gateways

To create a new gateway :

$gateway = $agilePay->gateway()->create('stripe', [
    'secret_key' => ''
]);

The response will contain a gateway reference which is used to perform transactions against the gateway

$gateway->reference;

Payment methods

To create a new payment method type of gateway token:

In this case the payment method will be retained with the provided gateway, please check the availability of transaction store in the gateways

Gateways list -> http://docs.agilepay.io/#!/gateway

Gateway token -> http://docs.agilepay.io/#!/payment-method-create-gateway-token

$paymentMethod = $agilePay->paymentMethod()->createGatewayToken($gateway->reference, [
    'number' => '',
    'holder_name' => '',
    'cvv' => '',
    'expiry_month' => '', //mm
    'expiry_year' => '',  //yy
]);

The response will contain a payment method token which is used to perform transactions against the payment method

$paymentMethod->token;

Transactions

Auth (Charge a credit card with a payment method type of gateway token):

$transaction = $agilePay->transaction()
                ->setPaymentMethod($paymentMethod->token;)
                ->auth(500, 'eur'); //Charging 5.00 euros

The response will contain a reference which can be used for second steps transactions such as void, capture and refund

$transaction->reference;

Void (Cancel an authorized transaction):

$response = $agilePay->transaction($transaction->reference)->void();

Capture (Settle an authorized transaction):

$response = $agilePay->transaction($transaction->reference)->capture();

Credit (Refund a settled transaction):

$response = $agilePay->transaction($transaction->reference)->credit();