PHPackages                             accsm/reseller-api-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. accsm/reseller-api-sdk

ActiveLibrary[API Development](/categories/api)

accsm/reseller-api-sdk
======================

SDK for accsmaster reseller api

v1.0.0(2y ago)03PHPPHP &gt;=7.3

Since Jun 30Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Accsm/resellers-api-sdk)[ Packagist](https://packagist.org/packages/accsm/reseller-api-sdk)[ Docs](https://github.com/Accsm/reseller-api-sdk)[ RSS](/packages/accsm-reseller-api-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Markdown output:

Accsmaster SDK
==============

[](#accsmaster-sdk)

This is an official [Accsmaster](https://accsmaster.com/) 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.

- [API Reference](https://documenter.getpostman.com/view/26405500/2s93Jxs2HD)

---

### Table of contents

[](#table-of-contents)

- [Installation](#installation)
- [Getting started](#getting-started)
- [Order Statuses](#order-statuses)
- [Methods](#methods)
    - [Authentication](#authentication)
        - [Authenticate](#authenticate)
        - [Refresh](#refresh)
        - [Invalidate](#invalidate)
    - [Object](#object)
        - [Get Token](#get-token)
        - [Get Secret](#get-secret)
        - [Set Token](#set-token)
        - [Set Secret](#set-secret)
    - [Data](#data)
        - [Offers](#offers)
        - [Offer](#offer)
        - [Categories](#categories)
        - [Orders](#orders)
        - [Order](#order)
        - [User](#user)
    - [Buy](#buy)
- [Callback](#callback)

---

### Installation

[](#installation)

Installation via composer: `composer require accsm/reseller-api-sdk`

Manual installation:

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

---

### Getting started

[](#getting-started)

There are only 4 files in this SDK:

- src/ResellerSDK/ResellerSDK.php - Contains all core code and logic
- index.php - File used for demonstration (you can delete it)
- callback\_example.php - File used for demonstration (you can delete it)

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

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

```
require 'src\ResellerSDK\ResellerSDK.php';
// and/or
use Accsm\ResellerSDK\ResellerSDK;

$api = new ResellerSDK();
```

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.

```
$authData = $api->auth('email@email.com', 'pass');

if (empty($success)) {
    throw new Exception('Wrong credentials');
}

$bearerToken = $authData['bearerToken'];
$userSecret = $authData['userSecret'];

// Store $userSecret & $bearerToken
// ...
```

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

```
$categories = $api->categories();
$offers = $api->offers(['product_id' => 4]);
$user = $api->user();
```

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

```
$api = new ResellerSDK('token', 'secret');
```

---

### Order statuses

[](#order-statuses)

- 1: new:
- 2: in\_progress
- 3: complete
- 4: canceled
- 5: pending
- 6: refunded
- 7: mispaid

---

### Methods

[](#methods)

List of all methods:

- `$api->auth(string $email, string $password): ?array`
- `$api->refresh(): ?string`
- `$api->invalidate(): bool`
- `$api->uesr(): array`
- `$api->categories(): array`
- `$api->offers(array $filters): array`
- `$api->orders(): array`
- `$api->order(string $orderNumber): array`
- `$api->buy(string $type, array $data)`
- `$api->getToken(): string`
- `$api->getSecret(): string`
- `$api->setToken(string $token): $this`
- `$api->setSecret(string $secret): $this`

---

### Authentication

[](#authentication)

### Authenticate

[](#authenticate)

**Endpoint:**
**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

[](#refresh)

**Endpoint:**
**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

[](#invalidate)

**Endpoint:**
**Method:** `$api->refresh();`
**Returns:** bool (invalidation successful or not)

This method:

1. Invalidates and deletes token from an object.

---

### Object

[](#object)

### Construct

[](#construct)

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

```
$api = new \Accsm\ResellerSDK\ResellerSDK($bearerToken, $userSecret);
```

### Get Token

[](#get-token)

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

This method:

1. Returns bearer token from an object.

### Get Secret

[](#get-secret)

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

This method:

1. Returns user secret from an object.

### Set Token

[](#set-token)

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

This method:

1. Sets bearer token to an object.

### Set Secret

[](#set-secret)

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

This method:

1. Sets user secret to an object.

---

### Data

[](#data)

### User

[](#user)

**Endpoint:**
**Method:** `$api->user();`
**Returns:** array (current user)

This method:

1. Returns current user.

### Offers

[](#offers)

**Endpoint:**
**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

[](#offer)

**Endpoint:**
**Method:** `$api->offer(int $id);`
**Params:** `int $id`
**Returns:** array (offer)

This method:

1. Return offer by its id.

### Categories

[](#categories)

**Endpoint:**
**Method:** `$api->categories();`
**Returns:** array (all categories)

This method:

1. Returns all categories.

### Orders

[](#orders)

**Endpoint:**
**Method:** `$api->orders();`
**Returns:** array (user orders)

This method:

1. Return all user orders.

### Order

[](#order)

**Endpoint:**
**Method:** `$api->order(string $orderNumber);`
**Params:** `string $orderNumber`
**Returns:** array (user order)

This method:

1. Return order by it's 'order\_number'.

---

### Buy

[](#buy)

**Endpoint:**
**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:

- quantity: **required**|int
- offer\_id: **required**|int
- callback\_url: optional|string
- sandbox: optional|bool

`'review'` type `$data` params:

- quantity: **required**|int
- offer\_id: **required**|int
- url: **required**|string
- reviews\_array: optional|array
- reviews: optional|string
- file: optional|types:txt,doc,csv|max\_size:6020
- callback\_url: optional|string
- sandbox: optional|bool

`'install'` type `$data` params:

- quantity: **required**|int
- offer\_id: **required**|int
- app\_link: **required**|string
- app\_id: **required**
- days: **required**|int
- country: **required**|array
- reviews: optional|string
- file: optional|types:txt,doc,csv|max\_size:6020
- callback\_url: optional|string
- sandbox: optional|bool

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:**

- `'file'`: send reviews in file. They will be reviewed manually. Example: `$data['file'] = realpath('') . '\' . 'test_data.txt;`
- `'reviews'`: reviews should be divided by \\n. Example: `$data['reviews'] = 'review1 \n review2 \n review3';`
- `'reviews_array'`: each review in new index. Example: `$data['reviews_array'] = ['review1', 'review2', ...]`
- `'url'`: url to place where to write reviews
- `'app_link'`: url to place where to make installs
- `'days'`: spread installations in this span of days
- `'country'`: ISO country code (US, RU, UA, etc.)
- `'sandbox'`: sandbox mode to make test orders. `$data['sandbox'] = 1;` for test orders.
- `'callback_url'`: your url endpoint to send order data to.

---

### Callback

[](#callback)

If you provide callback\_url in buy method, Accsmaster will send you order data on order updates.

```
$response = [
  'number' => 'order_number',
  'status' => 'status_id',
  'total' => 'price',
  'secret_key' => 'secret_key'
  'download_link' - 'link' // if needed
];
```

Call to you endpoint (your callback\_url) will always have ***Signature*** header. This will allow you to be sure call is coming from Accsmaster. To check if it's valid you're going to need to:

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

```
function signCallbackData(string $secret, array $data)
{
    ksort($data);

    $string = '';

    foreach($data as $value) {
        if (in_array(gettype($value), ['array', 'object', 'NULL']) ){
            continue;
        }
        if(is_bool($value) && $value){
            $string .= 1;
        } else {
            $string .= $value;
        }
    }

    return hash_hmac('sha512', strtolower($string), $secret);
}
```

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

```
$json = file_get_contents('php://input');
$data = json_decode($json);
$headers = getallheaders();

$secret = 'my_secret';
$testSignature = signCallbackData($secret, $data);
$signature = $headers['Signature'];

if (!hash_equals($signature, $testSignature)) {
    // Error, wrong signature
    die;
}

// Process data
// ...
```

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1044d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b97ed36e814f6f1c2360f8fcb7a3b808285ee9e9f29302bb93c9e7c02f7f47c8?d=identicon)[Accsm](/maintainers/Accsm)

---

Top Contributors

[![Accsm](https://avatars.githubusercontent.com/u/128096083?v=4)](https://github.com/Accsm "Accsm (3 commits)")

### Embed Badge

![Health badge](/badges/accsm-reseller-api-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/accsm-reseller-api-sdk/health.svg)](https://phpackages.com/packages/accsm-reseller-api-sdk)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M475](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M452](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
