curl --request POST \
--url https://api.unibee.dev/merchant/discount/plan_apply_preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "<string>",
"currency": "<string>",
"email": "<string>",
"externalPlanId": "<string>",
"isChangeToLongPlan": true,
"isChangeToSameIntervalPlan": true,
"isUpgrade": true,
"planId": 123
}
'{
"code": 123,
"data": {
"discountAmount": 123,
"discountCode": {
"advance": true,
"billingType": 123,
"code": "<string>",
"createTime": 123,
"currency": "<string>",
"cycleLimit": 123,
"discountAmount": 123,
"discountPercentage": 123,
"discountType": 123,
"endTime": 123,
"id": 123,
"isDeleted": 123,
"merchantId": 123,
"metadata": {},
"name": "<string>",
"planApplyGroup": {
"currency": [
"<string>"
],
"groupPlanIntervalSelector": [
{
"intervalCount": 123,
"intervalUnit": "<string>"
}
],
"type": [
123
]
},
"planApplyType": 123,
"planIds": [
123
],
"quantity": 123,
"startTime": 123,
"status": 123,
"upgradeLongerOnly": true,
"upgradeOnly": true,
"userLimit": 123,
"userScope": 123
},
"failureReason": "<string>",
"valid": true
},
"message": "<string>",
"redirect": "<string>",
"requestId": "<string>"
}Check discount can apply to plan, Only check rules about plan,the actual usage is subject to the subscription interface
curl --request POST \
--url https://api.unibee.dev/merchant/discount/plan_apply_preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "<string>",
"currency": "<string>",
"email": "<string>",
"externalPlanId": "<string>",
"isChangeToLongPlan": true,
"isChangeToSameIntervalPlan": true,
"isUpgrade": true,
"planId": 123
}
'{
"code": 123,
"data": {
"discountAmount": 123,
"discountCode": {
"advance": true,
"billingType": 123,
"code": "<string>",
"createTime": 123,
"currency": "<string>",
"cycleLimit": 123,
"discountAmount": 123,
"discountPercentage": 123,
"discountType": 123,
"endTime": 123,
"id": 123,
"isDeleted": 123,
"merchantId": 123,
"metadata": {},
"name": "<string>",
"planApplyGroup": {
"currency": [
"<string>"
],
"groupPlanIntervalSelector": [
{
"intervalCount": 123,
"intervalUnit": "<string>"
}
],
"type": [
123
]
},
"planApplyType": 123,
"planIds": [
123
],
"quantity": 123,
"startTime": 123,
"status": 123,
"upgradeLongerOnly": true,
"upgradeOnly": true,
"userLimit": 123,
"userScope": 123
},
"failureReason": "<string>",
"valid": true
},
"message": "<string>",
"redirect": "<string>",
"requestId": "<string>"
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Check discount can apply to plan, Only check rules about plan,the actual usage is subject to the subscription interface
The discount's unique code, customize by merchant
The currency of plan which code to apply
The externalId of plan which code to apply, either planId or externalPlanId is needed
IsChangeToLongPlan
IsChangeToSameIntervalPlan
IsUpgrade
The id of plan which code to apply, either planId or externalPlanId is needed
Show child attributes
The discount amount can apply to plan
Show child attributes
AdvanceConfig, 0-false,1-true, will enable all advance config if set true
billing_type, 1-one-time, 2-recurring
code
create utc time
currency of discount, available when discount_type is fixed_amount
the count limitation of subscription cycle , 0-no limit
amount of discount, available when discount_type is fixed_amount
percentage of discount, 100=1%, available when discount_type is percentage
discount_type, 1-percentage, 2-fixed_amount
end of discount available utc time, 0-invalid
Id
0-UnDeleted,> 0, Deleted, the deleted utc time
merchantId
name
Show child attributes
1-main plan,2-addon plan,3-onetime
plan apply type, 0-apply for all, 1-apply for plans specified, 2-exclude for plans specified, 3-Apply to Plans by Groups(Billing Period Included), 4-Apply to Plans except by Groups(Billing Period Included)
Ids of plan which discount code can effect, default effect all plans if not set
quantity of code, 0-no limit
start of discount available utc time
status, 1-editable, 2-active, 3-deactivate, 4-expire, 10-archive
AdvanceConfig, 0-false,1-true, will forbid for all except upgrade to longer plan if set true
AdvanceConfig, 0-false,1-true, will forbid for all except same interval upgrade action if set true
AdvanceConfig, The limit of every customer can apply, the recurring apply not involved, 0-unlimited
AdvanceConfig, Apply user scope,0-for all, 1-for only new user, 2-for only renewals, renewals is upgrade&downgrade&renew
The apply preview failure reason
The apply preview result, true or false