2017 © Pedro Peláez
 

library orangepay-php

PHP library for the Orangepay API.

image

hellovoid/orangepay-php

PHP library for the Orangepay API.

  • Tuesday, June 5, 2018
  • by hellovoid
  • Repository
  • 1 Watchers
  • 0 Stars
  • 18 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Latest Stable Version Total Downloads License, (*1)

Orangepay PHP API Client Library

This is the client library for the [Orangepay API][1]., (*2)

Installation

Install the library using Composer. Please read the Composer Documentation if you are unfamiliar with Composer or dependency managers in general., (*3)

composer require hellovoid/orangepay-php

Authentication

Use an API key to access your Orangepay account., (*4)

use Hellovoid\Orangepay\Client;
use Hellovoid\Orangepay\Configuration;


$client = \Hellovoid\Orangepay\Client::create(
    \Hellovoid\Orangepay\Configuration::apiKey(
        $apiKey,
        $apiUrl
    )
);

Response

Every successful method request returns decoded from json array., (*5)

Exceptions

It is recommended to handle exceptions in the event of a problem. Example:, (*6)

use Hellovoid\Orangepay\Client;
use Hellovoid\Orangepay\Configuration;
use Hellovoid\Orangepay\Exception\UnauthorizedException;
use Hellovoid\Orangepay\Exception\ValidationException;
use Hellovoid\Orangepay\Exception\NotFoundException;
use Hellovoid\Orangepay\Exception\RateLimitException;
use Hellovoid\Orangepay\Exception\InternalServerException;
use Hellovoid\Orangepay\Exception\HttpException;


$client = \Hellovoid\Orangepay\Client::create(
    \Hellovoid\Orangepay\Configuration::apiKey(
        $apiKey,
        $apiUrl
    )
);
try {
    $charge = $client->initializeCharge([
        'amount'       => 10.00,
        'currency'     => 'USD',
        'pay_method'   => 'card',
        'description'  => 'Test description',
        'reference_id' => 'my_unique_reference_id',
        'email'        => 'client@domain.ltd',
    ]);
} catch (UnauthorizedException $exception) {

} catch (ValidationException $exception) {

} catch (NotFoundException $exception) {

} catch (RateLimitException $exception) {

} catch (InternalServerException $exception) {

} catch (HttpException $exception) {

}

Retrieve wallet balances #ref

$client->getBalance();

Charges #ref

List charges

Retrieve pagination of charges with maximum 200 items per page., (*7)

Parameter Description
pay_method Request charges of provided type, for example: card, bitcoin, etc. (Optional, default null)
start_date Request charges after provided date in Y-m-d format. (Required)
end_date Request charges after provided date in Y-m-d format (Required)
page Pagination cursor
$client->getCharges([
    'pay_method' => 'card',
    'start_date' => '2018-01-01',
    'end_date'   => '2018-01-02',
]);

Charge details #ref

Retrieve charge details, (*8)

$client->getCharge($chargeId);

Initialization #ref

Create invoice for payment., (*9)

$client->initializeCharge([
   'amount'             => 10.00,
   'currency'           => 'USD',
   'pay_method'         => 'card',
   'description'        => 'Test description',
   'reference_id'       => 'my-unique-reference-id',
   'email'              => 'client@domain.ltd',
   'return_success_url' => 'https://my-site.ltd/payment-gateway-success',
   'return_error_url'   => 'https://my-site.ltd/payment-gateway-error',
   'callback_url'       => 'https://my-site.ltd/payment-gateway-callback',
]);

Refunds #ref

Create refund request

Returns the specified amount to the payer in the payment currency., (*10)

$client->refund([
    'charge_id' => '1499ae90-f860-11e6-a8b6-e74ae337c2e8',
    'amount'    => 10.00
]);

Transfers

List transfers

Retrieve pagination of transfers with maximum 200 items per page., (*11)

Parameter Description
pay_method Request transfers of provided type, for example: card, bitcoin, etc. (Optional, default null)
start_date Request transfers after provided date in Y-m-d format. (Required)
end_date Request transfers after provided date in Y-m-d format (Required)
page Pagination cursor
$client->getTransfers([
    'pay_method' => 'card',
    'start_date' => '2018-01-01',
    'end_date'   => '2018-01-02',
]);

Transfer details #ref

Retrieve Transfer details, (*12)

$client->getTransfer($transferId);

Transfer to card #ref

$client->transferToCard([
    'reference_id'      => 'my-unique-reference-id', // can be used as [#idempotency key](https://en.wikipedia.org/wiki/Idempotence)
    'amount'            => 10.00,
    'currency'          => 'USD',
    'description'       => 'Test description',
    'name'              => 'John Doe',
    'card_number'       => '4111111111111111',
    'card_expiry_month' => '02',
    'card_expiry_year'  => '19',
    'address_country'   => 'US',
    'address_city'      => 'New York',
    'address_line1'     => '123 East 169th Street Apt. 2A Bronx, NY 10456',
    'callback_url'      => 'https://my-site.ltd/payment-gateway-callback'
]);

There is an opportunity to make transfer to the payer, who made a payment earlier by using charge_id:, (*13)

$client->transferToCard([
    'charge_id'         => '1173157c-db4d-11e7-9296-cec278b6b50a',
    'reference_id'      => 'my-unique-reference-id',
    'amount'            => 10.00,
    'currency'          => 'USD',
    'description'       => 'Test description',
    'address_country'   => 'US',
    'address_city'      => 'New York',
    'address_line1'     => '123 East 169th Street Apt. 2A Bronx, NY 10456',
]);

Transfer to bitcoin address #ref

Amount must be in satoshi (1 BTC = 100000000 satoshis)., (*14)

$client->transferToBitcoinAddress([
    'reference_id' => 'my-unique-reference-id',
    'amount'       => 10000000, // 0.1 BTC
    'currency'     => 'BTC',
    'description'  => 'Test description',
    'address'      => '3**********FR',
]);

Rates #ref

Retrieve rates

$client->rates('BTC-EUR');

The Versions

05/06 2018

dev-master

9999999-dev

PHP library for the Orangepay API.

  Sources   Download

MIT

The Requires

 

The Development Requires

api orangepay

05/06 2018

1.0.0

1.0.0.0

PHP library for the Orangepay API.

  Sources   Download

MIT

The Requires

 

The Development Requires

api orangepay