Download the PHP package itaccfarm/reseller-api-sdk without Composer

On this page you can find all versions of the php package itaccfarm/reseller-api-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package reseller-api-sdk

Markdown output:

Accfarm SDK

This is an official Accfarm Reseller SDK. Out of the box it covers all endpoints and has the functionality to fully interact with API. This SDK can be used for development as it is, or serve as reference for you own SDK.


Table of contents


Installation

Installation via composer: composer require itaccfarm/reseller-api-sdk

Manual installation:

  1. Download archive
  2. Unpack and add ResellerSDK to your project
  3. Remove ITAccfarm from namespace and path to where you put ResellerSDK folder and add your namespace

Getting started

There are only 4 files in this SDK:

Let's start with our first and only ResellerSDK class.

  1. First of all, we need to create new object.

  2. Then authenticate with email and password, check if our credentials are correct, and then store token and user secret from auth data to your DB, file, config, etc.

  3. Then we can make API requests with this object! You can see the list of all methods in Methods section.

  4. Next time you create an object of that class you can simply pass bearer token and user secret into the construct method.

Order statuses


Methods

List of all methods:


Authentication

Authenticate

Endpoint: https://accfarm.com/api/v1/user/login
Method: $api->auth(string $email, string $password)
Params: string $email, string $password
Returns: ?array ['bearerToken' => 'token', 'userSecret' => 'secret'] or null

This method:

  1. Attempts authentication on 'user/login' endpoint.
  2. Stores bearer token to an object.

It is strongly suggested to store your token to the database, file or some other way and not to use this method every time when making requests.

Refresh

Endpoint: https://accfarm.com/api/v1/user/refresh
Method: $api->refresh();
Returns: string (new token) or null

This method:

  1. Refreshes token.
  2. Replaces old token with a new one in an object.

Invalidate

Endpoint: https://accfarm.com/api/v1/user/invalidate
Method: $api->refresh();
Returns: bool (invalidation successful or not)

This method:

  1. Invalidates and deletes token from an object.

Object

Construct

Params: string $bearerToken = '', string $userSecret = ''

Get Token

Method: $api->getToken()
Returns: string (token from an object)

This method:

  1. Returns bearer token from an object.

Get Secret

Method: $api->getSecret()
Returns: string (secret from an object)

This method:

  1. Returns user secret from an object.

Set Token

Method: $api->setToken(string $token)
Params: string $token Returns: $this

This method:

  1. Sets bearer token to an object.

Set Secret

Method: $api->setSecret(string $secret)
Params: string $secret Returns: $this

This method:

  1. Sets user secret to an object.

Data

User

Endpoint: https://accfarm.com/api/v1/user
Method: $api->user();
Returns: array (current user)

This method:

  1. Returns current user.

Offers

Endpoint: https://accfarm.com/api/v1/offers
Method: $api->offers(array $data);
Params: Optional: [category_id => int, product_id => int, discount => bool]
Returns: array (offers)

This method:

  1. Return offers with filters.

Offer

Endpoint: https://accfarm.com/api/v1/offer
Method: $api->offer(int $id);
Params: int $id
Returns: array (offer)

This method:

  1. Return offer by its id.

Categories

Endpoint: https://accfarm.com/api/v1/categories
Method: $api->categories();
Returns: array (all categories)

This method:

  1. Returns all categories.

Orders

Endpoint: https://accfarm.com/api/v1/orders
Method: $api->orders();
Returns: array (user orders)

This method:

  1. Return all user orders.

Order

Endpoint: https://accfarm.com/api/v1/order
Method: $api->order(string $orderNumber);
Params: string $orderNumber
Returns: array (user order)

This method:

  1. Return order by it's 'order_number'.

Buy

Endpoint: https://accfarm.com/api/v1/buy
Method: $api->buy(string $type, array $data);
Returns: array (user order)

This method:

  1. Creates order and does everything a simple order creation on website would do.

Params for types:

$type options:

  1. 'offer'
  2. 'review'
  3. 'install'

'offer' type $data params:

'review' type $data params:

'install' type $data params:

If 'file', 'reviews' or 'reviews_array' is empty, then reviews will be autogenerated. It is recommended to write your on reviews.

Params in $data explained:

Callback

If you provide callback_url in buy method, Accfarm will send you order data on order updates.

Call to you endpoint (your callbackurl) will always have Signature_ header. This will allow you to be sure call is coming from Accfarm. To check if it's valid you're going to need to:

  1. Hash request data with your user secret with the following code:

  2. And then to check resulting hash against Signature header:

All versions of reseller-api-sdk with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3
ext-json Version *
ext-curl Version *
ext-fileinfo Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package itaccfarm/reseller-api-sdk contains the following files

Loading the files please wait ....