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
Via Composer
$ composer require b24io/loyalty-php-sdk
Loyalty PHP SDK works with PHP 8.2 or above, need ext-json
and ext-curl
support
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.
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
Work with card as an admin
role
Method | Status | Description |
---|---|---|
list |
β | get card list with page navigation |
getById |
β | get card by uuid |
count |
β οΈ | count cards |
delete |
π οΈ | delete card by uuid |
add |
β οΈ | add new card |
block |
βοΈ | block card by uuid |
unblock |
βοΈ | unblock card by uuid |
setLevel |
βοΈ | set card level by uuid |
setPercentage |
βοΈ | set card percentage by uuid |
Work with card as a user
role
Method | Status | Description |
---|---|---|
getById |
π | get card by uuid |
If you need export all cards, you can use CardsFetcher
Work with card levels as an admin
role
Method | Status | Description |
---|---|---|
list |
π | get card level list |
add |
π | add new card level |
delete |
π | delete card level |
update |
βοΈ | update card level |
Work with transactions as an admin
role.
Transactions service contains methods, list method work with pagination
Method | Description |
---|---|
list |
get transactions list for all cards with pagination |
count |
count transactions |
getByCardNumber |
get transactions list for current card number |
processAccrualTransactionByCardNumber |
process accrual transaction |
processPaymentTransactionByCardNumber |
process payment transaction |
if you want read all transactions without pagination you can work with TransactionsFetcher
All fetcher methods return
generator, under the hood fetcher use pagination.
Method | Description |
---|---|
list |
get transactions list for all cards |
listByCardNumber |
list all transactions for current card |
Work with transactions as an user
role
Method | Status | Description |
---|---|---|
getByCardId |
π | get transactions list for current card |
Work with contacts as an admin
role
Method | Status | Description |
---|---|---|
list |
β | get contacts list |
getById |
β | get contact by id |
add |
β | add new contact |
update |
βοΈ | update contact |
delete |
βοΈ | delete contact |
count |
β | count contacts |
startAuthByPhone |
βοΈ | start auth attempt by phone |
finishAuth |
βοΈ | finish auth attempt |
Work with contacts as an user
role
Method | Status | Description |
---|---|---|
getById |
π | get contact by id |
startAuthByPhone |
π | start auth attempt by phone |
finishAuth |
π | finish auth attempt |
If you need export all contacts, you can use ContactsFetcher
Work with company as an admin
role
Method | Status | Description |
---|---|---|
current |
β | get current company |
add |
βοΈ | add company |
update |
βοΈ | update company |
delete |
βοΈ | delete company |
Work with company as an user
role
Method | Status | Description |
---|---|---|
current |
π | get current company |
Work with application journal as an admin
role
Method | Status | Description |
---|---|---|
list |
π | get application journal items list with page navigation |
getById |
π | get application journal item by id |
Work with touch points as an admin
role
Method | Status | Description |
---|---|---|
list |
π | get touch points list with page navigation |
getById |
π | get touch point item by id |
add |
π | add new touch point |
update |
βοΈ | update touch point |
delete |
π οΈ | delete touch point |
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
Bugs and feature request are tracked on GitHub
Run static analysis tool
make phpstan
If you discover any security related issues, please contact us at app@b24.io
The MIT License (MIT). Please see License File for more information.