b24io / loyalty-php-sdk
B24io.Loyalty: PHP-SDK for bonus cards and loyalty program for Bitrix24
Requires
- php: 8.2.* || 8.3.*
- ext-bcmath: *
- ext-curl: *
- ext-intl: *
- ext-json: *
- fig/http-message-util: 1.1.*
- giggsey/libphonenumber-for-php: 8.1.*
- league/csv: ^9.0
- mesilov/moneyphp-percentage: 0.2.0
- moneyphp/money: 4.*
- psr/log: ^1.1.4 || ^2.0 || ^3.0
- symfony/console: 7.*
- symfony/dotenv: 7.*
- symfony/filesystem: 7.*
- symfony/http-client: 7.*
- symfony/http-client-contracts: ^3.1
- symfony/http-foundation: 7.*
- symfony/uid: 7.*
Requires (Dev)
- fakerphp/faker: 1.23.*
- monolog/monolog: 2.1.*
- nunomaduro/phpinsights: 2.*
- phpstan/phpstan: 1.*
- phpunit/phpunit: *
- rector/rector: ^1.0
- roave/security-advisories: dev-master
- symfony/debug-bundle: 7.*
- symfony/stopwatch: 7.*
README
Loyalty PHP SDK is a tool for work with REST-API Bitrix24 Application Loyalty Program and bonus cards for Bitrix24 CRM
- Loyalty app adds bonus card for Bitrix24 client profile in CRM
- Loyalty app support transactions for payment and accrual operations
- store percentage of discount
- operations with cards: create, read, delete, block
Documentation
Installation
Via Composer
$ composer require b24io/loyalty-php-sdk
Versions
Requirements
Loyalty PHP SDK works with PHP 8.2 or above, need ext-json
and ext-curl
support
Authentication with admin and user roles
SDK can work with two roles:
admin
- can work with all cards in his account and loyalty application instanceuser
- can work only with his own card
We work with many accounts, each account has a CLIENT_API_KEY
If you want work in admin role you must use ADMIN_API_KEY
to sign queries.
If you want work with client role in JS you must use CLIENT_API_KEY
and CARD_UUID
as user API key.
Domain entities available from REST-API
Legend
- ✅ — available wia rest-api and implemented in PHP-SDK
- 🛠 — available wia rest-api and not implemented in PHP-SDK
- ❌ — not implemented in rest-api
Cards
Work with card as an admin
role
Work with card as a user
role
If you need export all cards, you can use CardsFetcher
CardLevels
Work with card levels as an admin
role
Transactions
Work with transactions as an admin
role.
Transactions service contains methods, list method work with pagination
if you want read all transactions without pagination you can work with TransactionsFetcher
All fetcher methods return
generator, under the hood fetcher use pagination.
Work with transactions as an user
role
Contacts
Work with contacts as an admin
role
Work with contacts as an user
role
If you need export all contacts, you can use ContactsFetcher
Company
Work with company as an admin
role
Work with company as an user
role
ApplicationJournal
Work with application journal as an admin
role
TouchPoints
Work with touch points as an admin
role
Basic Usage
Command line utilities
Command line utilities for work via REST-API
php bin/console
cards:export
Export loyalty cards to csv filetransactions:bulk-transaction
Bulk transaction to all active cards: accrual or paymenttransactions:load-from-file
Process transactions from csv filetransactions:export
Export transactions to csv file
Submitting bugs and feature requests
Bugs and feature request are tracked on GitHub
Development
Testing
Run static analysis tool
make phpstan
Support
Security
If you discover any security related issues, please contact us at app@b24.io
License
The MIT License (MIT). Please see License File for more information.