Rocketr / rocketr-payments-php

PHP Library for Rocketr Payments API

Home Page:https://api.rocketr.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rocketr Payments API

Composer

The easiest way to use the library is through Composer:

composer require rocketr/rocketr-payments-php

Then in your code, load the Autoloader:

require_once('vendor/autoload.php');

Manual Installation

To manually use the library, download the latest release and include the init.php file in your code:

require_once('/path-to-rocketr-payments-php/init.php');

Getting Started

Please take a look in the examples/ folder to see how to use different API functions.

If you want to simply create a payment request, it's really simple:

\RocketrPayments\RocketrPayments::setApiKey('API_CLIENT_ID', 'API_SECRET'); //From https://rocketr.net/merchants/api-keys
$o = new \RocketrPayments\Order();

$o->setPaymentMethod(\RocketrPayments\PaymentMethods::BitcoinPayment);
$o->setAmount(12.31);
$o->setBuyerEmail('saad@rocketr.net');
$o->addCustomField('internal_id', '2195342212');
$o->setIpnUrl('https://rocketr.net/webhook.php');

$result = $o->createOrder();

echo 'Please send ' . $result['paymentInstructions']['amount']  . $result['paymentInstructions']['currencyText'] . ' to ' . $result['paymentInstructions']['address'];

Support

About

PHP Library for Rocketr Payments API

https://api.rocketr.net

License:MIT License


Languages

Language:PHP 100.0%