2017 © Pedro Peláez
 

library flypme-php

A PHP wrapper for Flyp.me API

image

vittominacori/flypme-php

A PHP wrapper for Flyp.me API

  • Tuesday, May 15, 2018
  • by vittominacori
  • Repository
  • 1 Watchers
  • 1 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 13 % Grown

The README.md

Flyp.me for PHP

A PHP wrapper for Flyp.me APIs, (*1)

Install

composer require vittominacori/flypme-php

Usage

Prepare requirements

require __DIR__ . '/vendor/autoload.php';

use \FlypMe\FlypMe;

Create client

$flypme = new FlypMe();

Call APIs

Create

Create a new order, (*2)

Last param could be "invoiced_amount" or "ordered_amount"., (*3)

You can optionally specify destination and refund_address on the request., (*4)

$flypme->orderNew("LTC", "ZEC", "0.02", "t1SBTywpsDMKndjogkXhZZSKdVbhadt3rVt", "LajyQBeZaBA1NkZDeY8YT5RYYVRkXMvb2T", "invoiced_amount");

result:, (*5)

{
  "order": {
    "uuid": "1b5929e7-0e6c-44a6-a428-e4db856d880e",
    "destination": "t1SBTywpsDMKndjogkXhZZSKdVbhadt3rVt",
    "exchange_rate": "0.5403268038",
    "ordered_amount": "0.00980653",
    "invoiced_amount": "0.02",
    "charged_fee": "0.001",
    "from_currency": "LTC",
    "to_currency": "ZEC"
  },
  "expires": 1199,
  "refund_address": "LajyQBeZaBA1NkZDeY8YT5RYYVRkXMvb2T"
}

Update

Update an order, (*6)

Last param could be "invoiced_amount" or "ordered_amount"., (*7)

You can optionally specify destination and refund_address on the request., (*8)

$flypme->orderUpdate("1b5929e7-0e6c-44a6-a428-e4db856d880e", "LTC", "ZEC", "0.03", "t1SBTywpsDMKndjogkXhZZSKdVbhadt3rVt", "LajyQBeZaBA1NkZDeY8YT5RYYVRkXMvb2T", "invoiced_amount");

result:, (*9)

{
  "order": {
    "uuid": "1b5929e7-0e6c-44a6-a428-e4db856d880e",
    "destination": "t1SBTywpsDMKndjogkXhZZSKdVbhadt3rVt",
    "exchange_rate": "0.5292734791",
    "ordered_amount": "0.0148782",
    "invoiced_amount": "0.03",
    "charged_fee": "0.001",
    "from_currency": "LTC",
    "to_currency": "ZEC"
  },
  "expires": 1199,
  "refund_address": "LajyQBeZaBA1NkZDeY8YT5RYYVRkXMvb2T"
}

Accept

Accept an order, (*10)

Accept an order by uuid, (*11)

$flypme->orderAccept("1b5929e7-0e6c-44a6-a428-e4db856d880e");

result:, (*12)

{
  "order": {
    "uuid": "1b5929e7-0e6c-44a6-a428-e4db856d880e",
    "destination": "t1SBTywpsDMKndjogkXhZZSKdVbhadt3rVt",
    "exchange_rate": "0.5292734791",
    "ordered_amount": "0.0148782",
    "invoiced_amount": "0.03",
    "charged_fee": "0.001",
    "from_currency": "LTC",
    "to_currency": "ZEC"
  },
  "expires": 1053,
  "deposit_address": "MHoWWcJzNH4aWUKvrtMwpqMggRRBsvB7va",
  "refund_address": "LajyQBeZaBA1NkZDeY8YT5RYYVRkXMvb2T"
}

Check

Check order status by uuid, (*13)

Possible status are: WAITING_FOR_DEPOSIT, DEPOSIT_RECEIVED, DEPOSIT_CONFIRMED, EXECUTED, NEEDS_REFUND, REFUNDED, CANCELED and EXPIRED.
Possible payment_status are PENDING, UNDERPAY_RECEIVED, UNDERPAY_CONFIRMED, PAYMENT_RECEIVED, PAYMENT_CONFIRMED, OVERPAY_RECEIVED, OVERPAY_CONFIRMED. Orders with underpay or overpay will be refunded by the system., (*14)

$flypme->orderCheck("1b5929e7-0e6c-44a6-a428-e4db856d880e");

result:, (*15)

{
    "status": "WAITING_FOR_DEPOSIT",
    "payment_status": "PENDING"
}

Result will also include 'confirmations' when the payment is in some XXX_RECEIVED status., (*16)

{
    "confirmations": "3/47",
    "payment_status": "PAYMENT_RECEIVED",
    "status": "DEPOSIT_RECEIVED"
}

Result will also include 'txid' and 'txurl' when the order is EXECUTED., (*17)

{
    "payment_status": "PAYMENT_CONFIRMED",
    "status": "EXECUTED",
    "txid": "XXXXX", 
    "txurl": "https://etherscan.io/tx/XXX"
}

Info

Get order full info, (*18)

$flypme->orderInfo("1b5929e7-0e6c-44a6-a428-e4db856d880e");

result:, (*19)

{
  "order": {
    "uuid": "1b5929e7-0e6c-44a6-a428-e4db856d880e",
    "destination": "t1SBTywpsDMKndjogkXhZZSKdVbhadt3rVt",
    "exchange_rate": "0.5292734791",
    "ordered_amount": "0.0148782",
    "invoiced_amount": "0.03",
    "charged_fee": "0.001",
    "from_currency": "LTC",
    "to_currency": "ZEC"
  },
  "expires": 961,
  "status": "WAITING_FOR_DEPOSIT",
  "payment_status": "PENDING",
  "deposit_address": "MHoWWcJzNH4aWUKvrtMwpqMggRRBsvB7va",
  "refund_address": "LajyQBeZaBA1NkZDeY8YT5RYYVRkXMvb2T"
}

Result will also include 'confirmations' when the payment is in some XXX_RECEIVED status., (*20)

{
  "order": {
    "uuid": "1b5929e7-0e6c-44a6-a428-e4db856d880e",
    (...)
  },
  (...)
  "confirmations": "47/47"
}

Result will also include 'txid' and 'txurl' when the order is EXECUTED., (*21)

{
  "order": {
    "uuid": "1b5929e7-0e6c-44a6-a428-e4db856d880e",
    (...)
  },
  (...)
  "txid": "XXXXX",
  "txurl": "https://etherscan.io/tx/..."
}

Cancel order

Cancel a pending order, (*22)

$flypme->orderCancel("1b5929e7-0e6c-44a6-a428-e4db856d880e");

result:, (*23)

{
    "result": "ok"
}

Add refund

Add a refund address for orders not having one, (*24)

$flypme->addRefund("fc0d5579-5921-4097-8e5c-7e5ec8e7a2ea", "LajyQBeZaBA1NkZDeY8YT5RYYVRkXMvb2T");

result:, (*25)

{
    "result": "ok"
}

Query rates

Get exchange rates, (*26)

$flypme->dataExchangeRates();

result:, (*27)

{
    "LTC-BTC": "0.0174777496",
    "BTC-LTC": "55.724760293",
    (...)
    "CREA-FYP": "2.06496",
    "FYP-CREA": "0.3423985733"
}

Query active currencies

Get available currencies information, (*28)

A currency needs to have both exchange and send set to true to be enabled for the accountless exchange. Confirmation time is the expected time in minutes (approximate). Other parameters are self explanatory., (*29)

$flypme->currencies();

result:, (*30)

{
    "BTC": {
        "code": "BTC",
        "precision": 8,
        "display_precision": 4,
        "created_at": "2014-02-04T02:28:37.000Z",
        "updated_at": "2017-12-12T17:03:52.000Z",
        "name": "Bitcoin",
        "website": "https://bitcoin.org/",
        "confirmation_time": 20,
        "default": false,
        "charged_fee": "0.0008",
        "currency_type": "CRYPTO",
        "exchange": true,
        "send": true
    },
    (...)
    "ZEC": {
        "code": "ZEC",
        "precision": 8,
        "display_precision": 4,
        "created_at": "2017-02-24T11:41:27.000Z",
        "updated_at": "2017-12-12T14:44:02.000Z",
        "name": "Zcash",
        "website": "https://z.cash/",
        "confirmation_time": 5,
        "default": false,
        "charged_fee": "0.0008",
        "currency_type": "CRYPTO",
        "exchange": true,
        "send": true
    }
}

Query limits

Get max and min limits in $toCurrency. To get the limits in $fromCurrency you must calculate it using the exchange rate., (*31)

// $flypme->orderLimits($fromCurrency, $toCurrency)
$flypme->orderLimits('BTC', 'ETH');

result:, (*32)

{
  "min": "0.006",
  "max": "7.26915022"
}

License

Code released under the MIT License., (*33)

The Versions

15/05 2018

dev-master

9999999-dev https://github.com/vittominacori/flypme-php

A PHP wrapper for Flyp.me API

  Sources   Download

MIT

The Requires

 

client crypto exchange flypme

14/05 2018

0.0.4

0.0.4.0 https://github.com/vittominacori/flypme-php

A PHP wrapper for Flyp.me API

  Sources   Download

MIT

The Requires

 

client crypto exchange flypme

15/12 2017

0.0.3

0.0.3.0 https://github.com/vittominacori/flypme-php

A PHP wrapper for Flyp.me API

  Sources   Download

MIT

The Requires

 

client crypto exchange flypme

13/12 2017

0.0.2

0.0.2.0 https://github.com/vittominacori/flypme-php

A PHP wrapper for Flyp.me API

  Sources   Download

MIT

The Requires

 

client crypto exchange flypme

13/12 2017

0.0.1

0.0.1.0 https://github.com/vittominacori/flypme-php

A PHP wrapper for Flyp.me API

  Sources   Download

MIT

The Requires

 

client crypto exchange flypme