remp / crm-coupon-module
CRM Coupon Module
Installs: 14 049
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 5
Forks: 0
Open Issues: 0
pkg:composer/remp/crm-coupon-module
Requires
- php: ^8.1
- dev-master
- 4.3.0
- 4.2.0
- 4.1.0
- 4.0.0
- 3.7.0
- 3.6.0
- 3.5.0
- 3.4.0
- 3.3.0
- 3.2.0
- 3.1.0
- 3.0.0
- 2.11.0
- 2.10.0
- 2.9.0
- 2.8.0
- 2.7.0
- 2.6.0
- 2.5.0
- 2.4.0
- 2.3.0
- 2.2.0
- 2.1.0
- 2.0.0
- 1.2.0
- 1.1.0
- 1.0.0
- 1.0.0-beta2
- 1.0.0-beta1
- 0.39.0
- 0.38.0
- 0.37.0
- 0.36.0
- 0.35.0
- 0.34.0
- 0.33.0
- 0.32.0
- 0.31.0
- 0.30.0
- 0.29.0
- 0.28.0
- 0.27.0
- 0.26.0
- 0.25.0
- 0.24.0
- 0.23.0
- 0.22.0
- 0.21.0
- 0.20.0
- 0.18.0
- 0.17.0
- 0.16.0
- 0.15.0
- 0.14.0
- 0.13.0
- 0.12.0
- 0.11.0
- 0.10.0
- 0.9.0
- 0.8.2
- 0.8.1
- 0.8.0
- 0.7.0
- 0.6.0
- 0.5.0
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.10
- 0.2.9
- 0.2.8
- 0.2.7
- 0.2.5
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.1
This package is auto-updated.
Last update: 2025-10-22 06:25:52 UTC
README
API documentation
All examples use http://crm.press as a base domain. Please change the host to the one you use
before executing the examples.
All examples use XXX as a default value for authorization token, please replace it with the
real tokens:
- API tokens. Standard API keys for server-server communication. It identifies the calling application as a whole.
They can be generated in CRM Admin (/api/api-tokens-admin/) and each API key has to be whitelisted to access specific API endpoints. By default the API key has access to no endpoint.
- User tokens. Generated for each user during the login process, token identify single user when communicating between
different parts of the system. The token can be read:
- From n_tokencookie if the user was logged in via CRM.
- From the response of /api/v1/users/loginendpoint - you're free to store the response into your own cookie/local storage/session.
 
- From 
API responses can contain following HTTP codes:
| Value | Description | 
|---|---|
| 200 OK | Successful response, default value | 
| 400 Bad Request | Invalid request (missing required parameters) | 
| 403 Forbidden | The authorization failed (provided token was not valid) | 
| 404 Not found | Referenced resource wasn't found | 
If possible, the response includes application/json encoded payload with message explaining
the error further.
POST /api/v1/coupon/activate
Activate coupon specified by code for authenticated user.
Headers:
| Name | Value | Required | Description | 
|---|---|---|---|
| Authorization | Bearer String | yes | User token. | 
Params:
| Name | Value | Required | Description | 
|---|---|---|---|
| code | String | yes | The code of coupon to activate. | 
| notifyUser | Boolean | no | Flag indicating that user should be notified (email, push notification). | 
Example:
curl -X POST \ http://crm.press/api/v1/coupon/activate \ -H 'Authorization: Bearer XXX' \ -H 'Content-Type: application/json' \ -d '{ "code": "123456-789ABC-DEFG", "notifyUser": true }'
Response:
{ "coupon_id": 1234567, "coupon_type": "new-user-promo", "subscription_id": 1234345, "subscription_type_id": 123, "subscription_type_name": "1 month promo subscription", "subscription_start_time": "2020-07-02T11:30:00+00:00", // String; RFC3339 encoded start time "subscription_end_time": "2020-08-02T11:30:00+00:00" // String; RFC3339 encoded end time }