Coupons reference
CouponClient
Bases: BaseClient
Source code in abacatepay/coupons/client.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
|
create(data=None, **kwargs)
Create a new coupon.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
Coupon
|
an instance of |
None
|
Other Parameters:
Name | Type | Description |
---|---|---|
code |
str
|
The unique code for the coupon. |
discount_kind |
DISCOUNT_KINDS
|
The type of discount (e.g., percentage or fixed amount). |
discount |
int
|
The value of the discount. |
notes |
Optional[str]
|
A description or note about the coupon. Defaults to None. - Serialization alias: 'notes' - Example: "Cupom de desconto pro meu público" |
max_redeems |
Optional[int]
|
The maximum number of times the coupon can be redeemed. Defaults to -1 for unlimited redemptions. |
metadata |
Optional[dict]
|
Additional metadata for the coupon. Defaults to None. |
Returns:
Name | Type | Description |
---|---|---|
Coupon |
Coupon
|
The response with the coupon data. |
Source code in abacatepay/coupons/client.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
|
list()
List all coupons. Returns: list[Coupon]: A list of coupon objects.
Source code in abacatepay/coupons/client.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
|
Coupon
Bases: BaseModel
Represents a coupon model for retrieval.
Attributes:
Name | Type | Description |
---|---|---|
id |
str
|
The unique identifier for the coupon. |
discount_kind |
str
|
The type of discount (e.g., percentage or fixed amount). |
discount |
int
|
The value of the discount. |
status |
str
|
The current status of the coupon (e.g., ACTIVE, INACTIVE). |
notes |
Optional[str]
|
A description or note about the coupon. |
max_redeems |
int
|
The maximum number of times the coupon can be redeemed. |
redeems_count |
int
|
The number of times the coupon has been redeemed. |
created_at |
str
|
The timestamp when the coupon was created. |
updated_at |
str
|
The timestamp when the coupon was last updated. |
Source code in abacatepay/coupons/models.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
|
CouponIn
Bases: BaseModel
Represents a coupon model for creation.
Attributes:
Name | Type | Description |
---|---|---|
code |
str
|
The unique code for the coupon. |
discount_kind |
DISCOUNT_KINDS
|
The type of discount (e.g., percentage or fixed amount). |
discount |
int
|
The value of the discount. |
notes |
Optional[str]
|
A description or note about the coupon. Defaults to None. - Serialization alias: 'notes' - Example: "Cupom de desconto pro meu público" |
max_redeems |
Optional[int]
|
The maximum number of times the coupon can be redeemed. Defaults to -1 for unlimited redemptions. |
metadata |
Optional[dict]
|
Additional metadata for the coupon. Defaults to None. |
Source code in abacatepay/coupons/models.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|