rocketfuel/rocketfuel-php-sdk

PHP SDK for interacting with Rocketfuel

1.0.0 2022-10-09 21:43 UTC

README

PHP SDK for RocketFuel Payment Method

The registration procedure is described in the documentation RocketFuel

Installation

via composer

composer require rocketfuel/rocketfuel-php-sdk 

Manual install

composer will install all depences

git clone https://bitbucket.org/rocketfuelblockchain/rocketfuel-php-sdk.git
cd rocketfuel-php-sdk
composer install

Usage example for make order cart for payment via RocketFuel

 <?php
require_once(dirname(__FILE__) . '/rocketfuel-php-sdk/RocketFuel.php');

$rocketfuel = new RocketFuel(YOUR_MERCHANT_ID, YOUR_MERCHANT_PUBLIC_KEY);

$cart = $rocketfuel->getOrderPayload(ORDER_ID, YOUR_CART, ORDER_TOTAL_PRICE);
  • ORDER_ID - order ID should be unique for your shop
  • ORDER_TOTAL_PRICE - total price of whole order for payment, in USD only
  • YOUR_CART - array looks like

          $cart = [
          [
              'product_id' => 456,
              'total_price' => 6.7,
              'product_name' => 'test product 1',
              'quantity' => 5
          ],
          [
              'product_id' => 156,
              'total_price' => 15.1,
              'product_name' => 'test product 2',
              'quantity' => 1
          ],
          ...
          [
              'product_id' => 15667,
              'total_price' => 5.15,
              'product_name' => 'test product 3',
              'quantity' => 2
          ],
      ];
    

Usage example for check callback from RocketFuel

 <?php
require_once(dirname(__FILE__) . '/rocketfuel-php-sdk/RocketFuel.php');

$rocketfuel = new RocketFuel(YOUR_MERCHANT_ID, YOUR_MERCHANT_PUBLIC_KEY);

$result = $rocketfuel->callback(JSON_PAYLOAD_FROMROCKETFUEL,
    'SIGNATURE');
echo $result;

public key should be in PEM format, copy it from your RocketFuel merchant account

Setup

  • "Merchant ID" (provided in RocketFuel merchant UI for registered merchants).
  • "callback URL" use your own url for callback from RocketFuel service.
  • In the RocketFuel UI for registered merchants click "Edit" in the bottom left corner. A window will pop up and paste callback URL.