Search…
Applying a midterm change with price override
Learn how to apply a midterm change with a price override for a subscription with add-ons.

Applying a midterm change with price override using the Preview cart resource

In this scenario, the customer has a basic subscription and decided to upgrade the subscription product with add-on using POST /v1/subscriptions/{subscriptionId}/preview-cart.
Use the POST /v1/subscriptions/{subscriptionId}/preview-cart resource to upgrade the customer's subscription product. You need to include the product identifier (id), the quantity (quantity), and the prorated Unit Price (proratedUnitPrice). In the following example, the value for the proratedUnitPrice is 20.5.
cURL
1
curl --location --request POST 'http://<<host>>/v1/subscriptions/{subscriptionId}/preview-cart' \
2
--header 'Content-Type: application/json' \
3
--header 'authorization: bearer ***\
4
--data-raw '{
5
"product" : {
6
"id" : "5396391700"
7
},
8
"quantity" : 1,
9
"addOns" : [ {
10
"product" : {
11
"id" : "5400082600"
12
},
13
"quantity" : 1,
14
"proratedUnitPrice" : 0.0
15
} ],
16
"proratedUnitPrice" : 20.5
17
}'
Copied!
You will receive a 200 OK response.
JSON
1
{
2
"subscriptionId" : "15682787789",
3
"subTotal" : 20.5,
4
"credit" : 0.0,
5
"totalTax" : 0.0,
6
"totalAmountDue" : 20.5,
7
"currency" : "USD",
8
"prorationDate" : "2021-03-03",
9
"previewCharges" : [ {
10
"product" : "5396391700",
11
"quantity" : 1,
12
"unitPrice" : 20.5,
13
"proratedUnitPrice" : 20.5
14
} ],
15
"previewSubscription" : {
16
"addOns" : [ {
17
"product" : {
18
"id" : "5400082600"
19
},
20
"quantity" : 1,
21
"proratedUnitPrice" : 0.0
22
} ],
23
"product" : {
24
"id" : "5396391700"
25
},
26
"quantity" : 1,
27
"proratedUnitPrice" : 20.5
28
},
29
"cart" : {
30
"token" : "bearer dbea3e7a3605b764afe1113c3bd539aee2645ebef2c5581584663d957b514f24d205a4b72aa404acc03d85062b1b7c99954ef1e22c9a2de5a9214082273e2ee0e5480ea0e38cc85260e9c7d22d7e8851",
31
"url" : "[https://drhadmin-sys-drx.drextenv.net/store?Action=DisplayHGOP2LandingPage&Locale=en_US&SiteID=sub2test&Token=eHBLKQgMBhgUBTIFSVpVSVxFXVhBW1RJUk1fVU9TVktVewA%3D&session=CB289EB23D78E50C7203166BFDD6CF1AAA48BA8DDDED419570AB88C662F4B8480D9146F3517FB71E6658420B74105DE424E90940F72DAC34E5F9EF1E089976E25ED5A6AEB92345D8420A79758692FFFE]"
32
},
33
"isCartNeeded" : true,
34
"isPaymentOnFile" : true
35
}
Copied!

Applying a midterm change with price override using the Preview resource

In this scenario, the customer has a basic subscription and decided to upgrade the subscription product with add-ons using POST /v1/subscriptions/{subscriptionId}/preview.
Use the POST /v1/subscriptions/{subscriptionId}/preview resource to upgrade the customer's subscription product. You need to include the product identifier (id), the quantity (quantity), the prorated Unit Price (proratedUnitPrice). In the following example, the value for the proratedUnitPrice is 20.5.
cURL
1
curl --location --request POST 'http://{host}/v1/subscriptions/{subscriptionId}/preview' \
2
--header 'Content-Type: application/json' \
3
--header 'authorization: bearer ***\
4
--data-raw '{
5
"product" : {
6
"id" : "5363866300"
7
},
8
"product" : {
9
"id" : "5396391700"
10
},
11
"product" : {
12
"id" : "5396391700"
13
},
14
"quantity" : 1,
15
"addOns" : [ {
16
"product" : {
17
"id" : "5400082600"
18
},
19
"quantity" : 1,
20
"proratedUnitPrice" : 0.0
21
} ],
22
"proratedUnitPrice" : 20.5
23
}
24
Copied!
You will receive a 200 OK response.
JSON
1
{
2
"subscriptionId" : "15684493989",
3
"subTotal" : 20.5,
4
"credit" : 0.0,
5
"totalTax" : 0.0,
6
"totalAmountDue" : 20.5,
7
"currency" : "USD",
8
"prorationDate" : "2021-03-05",
9
"previewCharges" : [ {
10
"product" : "5396391700",
11
"quantity" : 1,
12
"unitPrice" : 20.5,
13
"proratedUnitPrice" : 20.5
14
} ],
15
"previewSubscription" : {
16
"addOns" : [ {
17
"product" : {
18
"id" : "5400082600"
19
},
20
"quantity" : 1,
21
"proratedUnitPrice" : 0.0
22
} ],
23
"product" : {
24
"id" : "5396391700"
25
},
26
"quantity" : 1,
27
"proratedUnitPrice" : 20.5
28
},
29
"isCartNeeded" : true,
30
"isPaymentOnFile" : true
31
}
32
Copied!
Last modified 5mo ago