rainko/rainko-sdk-php

Rainko provides a PHP SDK that wraps the Rainko REST APIs

1.1.0 2020-03-06 11:35 UTC

This package is auto-updated.

Last update: 2024-04-10 00:33:42 UTC


README

rainko-sdk-php is the part of Rainko PHP API client.

How to use

<?php

require 'vendor/autoload.php';

$category = new \Rainko\APP\Model\Category(258, 1, 'Lavage');
$propertyType = new \Rainko\APP\Model\PropertyKey('smartprice');

//Create the product 
$product = new \Rainko\APP\Model\Product();
$product->setInternReference(9003)
    ->setName('Ifuck X20')
    ->setSku('K89256')
    ->setPrice(999.59)
    ->setEcoTax(8.66)
    ->setEan('5454812135646')
    ->setProductCondition('new')
    ->setCategory($category)
    ->setSupplierName('Apple')
    ->setManufacturerName('Pear')
    ->setQuantity(5)
    ->setPropertyValueCollection(
        [
            new \Rainko\APP\Model\PropertyValue($propertyType, '45.32')
        ]
    );

//Passing products, categories and all property types on request
$request = \Rainko\APP\Service\RainkoRequest::getReplaceFluxRequest([$product], [$category], [$propertyType]);

// Instantiating the Rainko API Client
$client = \Rainko\APP\Service\RainkoClient::getClient(
    'https://your.env/api/v1',
    'your_merchant_id',
    'your_secret_key'
);

// Calling the API
$response = $client->go($request); // returns \Psr\Http\Message\ResponseInterface