Discount code management requires admin permission. The
/validate endpoint requires read permission, making it safe to call from client-side checkout flows.Authentication
https://platform-api.anyspend.com/api/v1
Endpoints
List Discount Codes
read
List all discount codes with optional filtering and pagination.
string
Search by code string (case-insensitive partial match).
boolean
Filter by active status. Omit to return all codes.
number
Page number for pagination (default:
1).number
Results per page (default:
20, max: 100).- cURL
- SDK
Create Discount Code
admin
Create a single discount code.
string
required
The discount code string (e.g.,
SUMMER25). Must be unique. Automatically uppercased.string
required
Discount type:
percentage or fixed.number
required
Discount value. For
percentage, a number between 1-100. For fixed, the amount in the token’s smallest unit (e.g., 5000000 for 5 USDC).string
Restrict this code to a specific payment link. If omitted, the code works on all payment links.
number
Maximum number of times this code can be redeemed. Omit for unlimited uses.
string
Minimum order amount required to use this code, in the token’s smallest unit.
string
ISO 8601 expiration timestamp. Omit for a code that never expires.
- cURL
- SDK
Update Discount Code
admin
Update an existing discount code. All fields are optional.
- cURL
- SDK
Delete Discount Code
admin
Permanently delete a discount code. Active sessions using this code will not be affected.
- cURL
- SDK
Validate Discount Code
read
Validate a discount code against a payment link and order amount. Returns the discount details if valid, or an error message explaining why the code is invalid.
string
required
The discount code to validate.
string
required
The payment link the code is being applied to.
string
required
The order amount in the token’s smallest unit, used to check
min_order_amount and calculate the discounted total.- cURL
- SDK
The validate endpoint does not consume a use. Uses are only counted when a payment is completed with the discount applied.
Batch Create Discount Codes
admin
Bulk-create multiple discount codes at once with shared configuration. Useful for generating promotional campaigns or unique single-use codes.
string[]
required
Array of code strings to create. Each must be unique.
string
required
Discount type applied to all codes:
percentage or fixed.number
required
Discount value applied to all codes.
string
Restrict all codes to a specific payment link.
number
Maximum uses per code. Set to
1 for single-use codes.string
Minimum order amount for all codes.
string
ISO 8601 expiration timestamp for all codes.
- cURL
- SDK
HypeDuel