Parameters
Name | Type | Description |
---|---|---|
publisherToken* | string | Your publisher token |
customerEmail* | string | Customer's email |
currentOfferId* | string | Id of an offer that a viewer wants to switch from (the one currently active) |
newOfferId* | string | Id of an offer that a viewer wants to switch to |
switchType* | string | Type of switching (currently supported: instant_keep_date) |
Result Parameters
Name | Type | Description |
---|---|---|
offerPrice | float | price of the new offer |
offerCurrency | string | currency of the new offer |
offerCurrencySymbol | string | currency symbol of the new offer |
offerLocale | string | locale of the new offer |
offerCountry | string | country of the new offer |
newSubscriptionPlanPriceInclTax | float | price of the new offer including tax |
newSubscriptionPlanPriceExclTax | float | price of the new offer excluding tax |
switchPriceInclTax | float | the amount of money that a viewer should be charged immediately before switching their subscription including tax |
switchPriceExclTax | float | the amount of money that a viewer should be charged immediately before switching their subscription excluding tax |
customerCurrency | string | currency used by user |
customerCurrencySymbol | string | symbol of currency used by user |
customerLocale | string | customer locale |
customerCountry | string | customer country |
discountedNewSubscriptionPlanPriceInclTax | float | price of the new offer including tax with coupon applied |
discountedNewSubscriptionPlanPriceExclTax | float | price of the new offer excluding tax with coupon applied |
discountedPreviousSubscriptionPlanPriceInclTax | float | price of the old offer including tax with coupon applied |
discountedPreviousSubscriptionPlanPriceExclTax | float | price of the old offer excluding tax with coupon applied |
discountPeriods | integer | the number of discounted billing periods |
API Request/Response
Request
{
"method": "calculateSwitchPrice",
"params": {
"publisherToken": "your_publisher_token",
"customerEmail": "[email protected]",
"currentOfferId": "S123123123_PL",
"newOfferId": "S321321321_PL",
"switchType": "instant_keep_date"
},
"jsonrpc": "2.0",
"id": 1
}
Response
{
"result": {
"offerPrice": 298.99,
"offerCurrency": "USD",
"offerCurrencySymbol": "$",
"offerLocale": "en_US",
"offerCountry": "FI",
"newSubscriptionPlanPriceInclTax": 265.01,
"newSubscriptionPlanPriceExclTax": 215.45,
"switchPriceInclTax": 83,
"switchPriceExclTax": 67.48,
"customerCurrency": "EUR",
"customerCurrencySymbol": "âŹ",
"customerLocale": "PL",
"customerCountry": "PL",
"discountedNewSubscriptionPlanPriceInclTax": 265.01,
"discountedNewSubscriptionPlanPriceExclTax": 215.45542890768024,
"discountedPreviousSubscriptionPlanPriceInclTax": 6.6612,
"discountedPreviousSubscriptionPlanPriceExclTax": 8.19,
"discountPeriods": 0
},
"id": "1",
"jsonrpc": "2.0"
}
ErrorCodes
Code | Description |
---|---|
3 | Invalid publisher token |
10 | Invalid email address |
32 | Unable to find existing subscription |