Download the PHP package coinsimple/coinsimple without Composer
On this page you can find all versions of the php package coinsimple/coinsimple. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download coinsimple/coinsimple
More information about coinsimple/coinsimple
Files in coinsimple/coinsimple
Package coinsimple
Short Description CoinSimple API wrapper
License MIT
Homepage https://coinsimple.com
Informations about the package coinsimple
PHP CoinSimple API
The CoinSimple API allows you to create invoices for your businesses programatically using the Business's ID and API key.
Installation
Composer
You can add this repo to your project via composer, to both download and include the neccessary classes into your project. To do this simply add coinsimple/coinsimple
to your composer.json
like in the following:
Manual Install
Alternatively you can download the repo manually and require
the coinsimple.php
file into your project.
Usage
To create a new invoice you need to objects, a business
and an invoice
. A business contains the Business ID
and the API Key
and handles authorization:
You can then use this instance to send invoices. An invoice can have the following fields:
But the only fields that are really required are name
, email
, items
, processor
, rate
and currency
. If you set defaults for processor
, rate
and currency
in the business settings on CoinSimple, then they can be left out as well.
This library also contains the following functions if you preffer to setup the invoice incrementally:
->setName($name)
->setEmail($email)
->addItem($item)
->setProcessor($processor)
->setRate($rate)
->setCurrency($currency)
->setNotes($notes)
->setPercent($percent)
(alias:->setDiscount($percent)
)->setCustom($data)
->setCallbackUrl($url)
->setRedirectUrl($url)
->setRecurringTimes($times)
(alias:->stopAfter($times)
)->recurByDays($num_days)
->recurByDate($day_of_month)
These methods are all chainable and you can mix both options of using functions and setting intial parameters in the constructor. For example you can create an invoice like so:
This code will create an invoice with one item which will recur 2 times once every four days.
To then send the invoice using a business you created you can use the sendInvoice
method: