Skip to content

Calculate a discounted price

POST
/coupons/calculate-price
curl --request POST \
--url https://api.proxyrequest.com/api/v1/coupons/calculate-price \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "package_id": "550e8400-e29b-41d4-a716-446655440002", "coupon_code": "WELCOME20", "data": 10737418240 }'

Validates a coupon against the selected package and data amount, then returns both the original and discounted prices without creating an invoice.

object
package_id
string format: uuid
coupon_code
required
string
>= 1 characters <= 64 characters
data
required
integer
>= 1
Examples
ExampleCalculatePackageDiscount

Calculate package discount

{
"package_id": "550e8400-e29b-41d4-a716-446655440002",
"coupon_code": "WELCOME20",
"data": 10737418240
}

The operation completed successfully.

Media typeapplication/json
object
price_original
required

Original price in the service’s smallest currency unit.

integer
price_discounted
required

Price after applying the coupon, in the smallest currency unit.

integer
discount_percentage
required
number format: double
Examples
ExampleDiscountedPrice

Discounted price

{
"price_original": 2500,
"price_discounted": 2000,
"discount_percentage": 20
}

The request is malformed or violates a business rule.

Media typeapplication/json

Validation and API error payload. Field names may be added dynamically; field errors are returned as arrays of human-readable messages.

object
detail
string
non_field_errors
Array<string>
translation

Stable translation key suitable for client localisation.

string
key
additional properties
One of:
string
Examples
ExampleValidationError

Validation error

{
"non_field_errors": [
"The request could not be processed."
],
"translation": "errors.request.invalid"
}

Authentication credentials are missing, expired, or invalid.

Media typeapplication/json

Validation and API error payload. Field names may be added dynamically; field errors are returned as arrays of human-readable messages.

object
detail
string
non_field_errors
Array<string>
translation

Stable translation key suitable for client localisation.

string
key
additional properties
One of:
string
Examples
ExampleAuthenticationRequired

Authentication required

{
"detail": "Authentication credentials were not provided."
}

The authenticated account cannot perform this operation.

Media typeapplication/json

Validation and API error payload. Field names may be added dynamically; field errors are returned as arrays of human-readable messages.

object
detail
string
non_field_errors
Array<string>
translation

Stable translation key suitable for client localisation.

string
key
additional properties
One of:
string
Examples
ExamplePermissionDenied

Permission denied

{
"detail": "You do not have permission to perform this action."
}