Partnership Discounts
This API handles subscription activations with promotional codes and validates the promotional codes provided by users.

1. Discount Subscription
POST /discount-subscription
Description: Activates a subscription for a user with a valid promotional code. Validates the promotional code, activates the subscription, and sends a confirmation email to the user.
Request Body:
{
"userEmail": "string",
"userId": "string",
"promotionalCode": "string"
}
Response:
Status | Description |
---|---|
200 OK | Subscription activated successfully with the valid promotional code. |
400 Bad Request | Missing or invalid promotional code, user email, or user ID. |
500 Internal Server Error | An error occurred while activating the subscription. |
Response Object:
{
"message": "Subscription activated successfully",
"promotionCode": {
"id": "string",
"object": "string",
"active": true,
"code": "string",
"coupon": {
"id": "string",
"object": "string",
"amount_off": null,
"created": "integer",
"currency": null,
"duration": "string",
"duration_in_months": null,
"livemode": false,
"max_redemptions": "integer",
"metadata": {},
"name": "string",
"percent_off": "number",
"redeem_by": null,
"times_redeemed": "integer",
"valid": true
},
"created": "integer",
"customer": null,
"expires_at": null,
"livemode": false,
"max_redemptions": "integer",
"metadata": {},
"restrictions": {
"first_time_transaction": false,
"minimum_amount": null,
"minimum_amount_currency": null
},
"times_redeemed": "integer"
}
}
2. Validate Promotional Code
POST /validate-promotional-code
Description: Validates a promotional code provided by the user and returns its details if valid.
Request Body:
{
"promotionalCode": "string"
}
Response:
Status | Description |
---|---|
200 OK | Promotional code is valid and details are returned. |
400 Bad Request | Missing or invalid promotional code. |
500 Internal Server Error | An error occurred during validation. |
Response Object:
{
"message": "Promotional code is valid",
"promotionCode": {
"id": "string",
"code": "string",
"active": true,
"discount": {
"type": "string",
"amount": "number"
},
"expiration_date": "string"
}
}