A Laravel Package for working with paycoin easily
PHP 5.4+ and Composer are required.
To get the latest version of Laravel Paycoin, simply require it
$ composer require paycoin/paycoin-laravel
You can publish the configuration file using this command:
$ php artisan vendor:publish
"then input 0 follow by enter key"
Open your .env file and add yoursecret key like so:
secret_key=xxxxxxxxxxxxxxxxxxxxxxxxxx
You can simply use these functons within your controllers:
use Paycoin\Paycoins\Paycoins;
public function getAllInvoices()
{
return Paycoins::getInvoices();
}
use Paycoin\Paycoins\Paycoins;
public function getInvoiceByRef()
{
return Paycoins::getInvoice("INV1626354432969");
}
use Paycoin\Paycoins\Paycoins;
public function createInvoice()
{
return Paycoins::create_invoice(
(object)[
"amount" => 1000000,
"currency" => 'NGN',
"redirect_url"=> 'https://abc.com',
"customer" => [
'firstname' => "test",
'lastname' => "name",
'email' => "testname@mail.com"
],
"customization" => [
"title" => "Sales"
]
]
);
}
use Paycoin\Paycoins\Paycoins;
public function getExchangeRates()
{
return Paycoins::exchangeRate("NGN");
}
Webhooks allow you to configure a URL that will be notified every time an event occurs on your account. When one of the events you subscribe to happens, paycoins will send a json object representing that event through a HTTP POST request to your webhooks URL.
You can either edit your existing webhook configurations, or click “Add Webhook” configurations in your paycoins developer account settings. The most important things is to provide the URL address that events should be sent to.
We do not expect any response from the endpoint you configure. You can respond with a customary HTTP 200 code, however this is not required. We currently do not support resending events that were failed to be properly delivered.
This is a list of all the types of events we currently send. We may add more at any time, so you shouldn’t rely on only these types existing in your code.
Sent when new payment has been deposited to your wallet.
data: {
currency: "BTC",
amount: 0.001,
type: "payment-successful",
reference: "INV1608644446774",
},
Sent when new payout/withdrawal is made on your wallet.
N.B: This respnse may varies depending on the status of the payout action
payout successful response
data: {
currency: "BTC",
amount: 0.001,
type: "payout",
status: "successful"
},
payout failed response
data: {
currency: "BTC",
amount: 0.001,
type: "payout",
status: "failed"
},
payout request expired response
data: {
currency: "BTC",
amount: 0.001,
type: "payout",
status: "expired"
},
payout cancelled response
data: {
currency: "BTC",
amount: 0.001,
type: "payout",
status:"canceled"
},