Setting subscription line discount as a percentage through the NetSuite REST API?

Viewed 79

I am trying use the NetSuite REST API to set a percentage discount on a subscription line (we have NetSuite SuiteBilling enabled). I have tried various ways - in the subscriptionLine object when creating the subscription, in the priceInterval object when creating the subscription, and through a subscriptionChangeOrder of type MODIFY_PRICING.

In all cases, the discount goes through fine if I set it as a number, but it ends up in NetSuite as a "currency amount" discount, and not a percentage (e.g. $ 25.00 and not 25.00%). (As a side-note, this seems to be the opposite of what is stated on https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_158109853563.html, where "discount": 50.0 is said to result in a 50% discount).

If I try to set it as a string with the "%" sign included in the API payload, e.g. by POST'ing the following to /record/v1/subscriptionchangeorder:

{
"action": "MODIFY_PRICING",
"subscription": 12345,
"customer": 1234,
"billingAccount":5678,
"subline": {"items":[
        {"sequence":1, "apply":true, "discountNew": "25%"}
    ]}
}

I get this error message back from the API:

"o:errorDetails": [
        {
"detail": "Unable to parse value '25%' (String) from the Number field (discountnew).",
"o:errorPath": "subLine.items[?(@.sequence==\"1\")]",
"o:errorCode": "INVALID_VALUE"
        }
]

This is in fact in line with the NS REST API docs, which say that "discountNew" must be a number (double), and not a string (https://system.netsuite.com/help/helpcenter/en_US/APIs/REST_API_Browser/record/v1/2020.2/index.html#/definitions/subscriptionChangeOrder-sublineElement).

But - then how can I set the discount as a percentage, like it is possible to do in the NetSuite UI?

What puzzles me even further is that if I have a NetSuite SuiteBilling subscription with two subscription lines, one having a discount applied of 50% and one having a discount applied of $50 (both these discounts have been set through the UI), like this:

(View larger)

Then, when I pull these two lines out of the REST API (through the /record/v1/subscription/{SUB_ID}/subcriptionLine/{SUB_LINE_NUMBER} endpoint), I get these results (these are screenshots from Postman):

Line with discount-%: IMG

Line with discount-amount:

In other words, exactly the same value of “50.0” is returned, no matter if that means 50% or $50. And no other property/field on the returned data indicates whether this should be interpreted as a percentage or as a currency value.

How does NS internally keep track of whether a discount is a percentage or a concrete dollar value? It seems like some setting (eg. “discountIsAPercentage”) simply isn’t exposed through the API. I have checked, and these discounts are not stored as more detailed discountItems behind-the-scenes.

0 Answers
Related