Search…
Assigning a perpetual unit price
Learn how to assign a perpetual unit price to a subscription with add-ons.

Assigning a perpetual unit price to a subscription

In this scenario, you assign a perpetual unit price to a customer's subscription.
Use the POST /v1/subscriptions/{subscriptionId}/perpetual-price resource to assign a perpetual unit price to a customer's subscription. You need to include the subscription identifier (subscriptionId) and the perpetual unit price (perpetUnitPrice). In the following example, the value for the product's perpetualUnitPrice is 120 and the value for the add-on's perpetualUnitPrice is 50.
cURL
1
curl --location --request POST 'http://{host}/v1/subscriptions/{subscriptionId}/perpetual-price' \
2
--header 'Content-Type: application/json' \
3
--header 'authorization: bearer ***\
4
--data-raw '{
5
"perpetualUnitPrice": 120,
6
"addOns": [
7
{
8
"product": {
9
"externalReferenceId": "A123"
10
},
11
"perpetualUnitPrice": 20
12
},
13
{
14
"product": {
15
"id": "B456"
16
},
17
"perpetualUnitPrice": 50
18
}
19
]
20
}'
Copied!
You will receive a 202 Accepted response.

Creating a cart with a perpetual unit price

In this scenario, you create a cart and assign a perpetual unit price to a customer's subscription.
Use the POST /v1/shoppers/me/carts/active or the POST /v1/shoppers/me/carts/active/line-items resource to create a cart request. You need to include the perpetual unit price (perpetualUnitPrice) in the subscription override info (subscriptionOverrideInfo).
/active cURL
/line-items cURL
1
curl --location --request POST 'http://{host}/v1/shoppers/me/carts/active' \
2
--header 'Content-Type: application/json' \
3
--header 'authorization: bearer ***\
4
--data-raw '{
5
"cart": {
6
"lineItems": {
7
"lineItem": [
8
{
9
"quantity": "1",
10
"product": {
11
"id": "5363866300"
12
},
13
"customAttributes": {
14
"attribute": [
15
{
16
"name": "groupIdForAddon",
17
"value": "9814462289"
18
}
19
]
20
},
21
"subscriptionOverrideInfo": {
22
"perpetualUnitPrice": {
23
"currencyCode": "USD",
24
"amount": 49.99
25
}
26
}
27
},
28
{
29
"quantity": "1",
30
"product": {
31
"id": "5400082600"
32
},
33
"customAttributes": {
34
"attribute": [
35
{
36
"name": "groupIdForAddon",
37
"value": "9814462289"
38
},
39
{
40
"name": "parentProductIdForAddon",
41
"value": "5363866300"
42
}
43
]
44
},
45
"subscriptionOverrideInfo": {
46
"perpetualUnitPrice": {
47
"currencyCode": "USD",
48
"amount": 39.99
49
}
50
}
51
}
52
]
53
}
54
}
55
}'
Copied!
1
curl --location --request POST 'http://<<host>>/v1/shoppers/me/carts/line-items' \
2
--header 'Content-Type: application/json' \
3
--header 'authorization: bearer ***\
4
--data-raw '{
5
"cart": {
6
"lineItems": {
7
"lineItem": [
8
{
9
"quantity": "1",
10
"product": {
11
"id": "5363866300"
12
},
13
"customAttributes": {
14
"attribute": [
15
{
16
"name": "groupIdForAddon",
17
"value": "9814462289"
18
}
19
]
20
},
21
"subscriptionOverrideInfo": {
22
"perpetualUnitPrice": {
23
"currencyCode": "USD",
24
"amount": 49.99
25
}
26
}
27
},
28
{
29
"quantity": "1",
30
"product": {
31
"id": "5400082600"
32
},
33
"customAttributes": {
34
"attribute": [
35
{
36
"name": "groupIdForAddon",
37
"value": "9814462289"
38
},
39
{
40
"name": "parentProductIdForAddon",
41
"value": "5363866300"
42
}
43
]
44
},
45
"subscriptionOverrideInfo": {
46
"perpetualUnitPrice": {
47
"currencyCode": "USD",
48
"amount": 39.99
49
}
50
}
51
}
52
]
53
}
54
}
55
}'
Copied!
You will receive a 200 OK response. The response to this request creates a shopping cart and returns an access token to be included in all other cart interactions.
JSON
1
{
2
"cart" : {
3
"uri" : "http://dispatch-test.digitalriver.com/shop/sites/sub2test/shoppers/me/carts/active",
4
"paymentMethods" : {
5
"uri" : "http://dispatch-test.digitalriver.com/shop/sites/sub2test/shoppers/me/carts/active/payment-methods"
6
},
7
"webCheckout" : {
8
"uri" : "http://dispatch-test.digitalriver.com/shop/sites/sub2test/shoppers/me/carts/active/web-checkout"
9
},
10
"id" : 861184190082,
11
"lineItems" : {
12
"uri" : "http://dispatch-test.digitalriver.com/shop/sites/sub2test/shoppers/me/carts/active/line-items",
13
"lineItem" : [ {
14
"uri" : "http://dispatch-test.digitalriver.com/shop/sites/sub2test/shoppers/me/carts/active/line-items/10288020082",
15
"id" : 10288020082,
16
"quantity" : 1,
17
"product" : {
18
"uri" : "http://dispatch-test.digitalriver.com/shop/sites/sub2test/shoppers/me/products/5363866300",
19
"displayName" : "Monthly auto renewal Subscription",
20
"thumbnailImage" : null
21
},
22
"pricing" : {
23
"listPrice" : {
24
"currency" : "USD",
25
"value" : 11.11
26
},
27
"listPriceWithQuantity" : {
28
"currency" : "USD",
29
"value" : 11.11
30
},
31
"salePriceWithQuantity" : {
32
"currency" : "USD",
33
"value" : 11.11
34
},
35
"formattedListPrice" : "$11.11",
36
"formattedListPriceWithQuantity" : "$11.11",
37
"formattedSalePriceWithQuantity" : "$11.11",
38
"productTax" : {
39
"currency" : "USD",
40
"value" : 0
41
},
42
"shippingTax" : {
43
"currency" : "USD",
44
"value" : 0
45
},
46
"feeTax" : {
47
"currency" : "USD",
48
"value" : 0
49
},
50
"taxRate" : 0,
51
"importTax" : {
52
"currency" : "USD",
53
"value" : 0
54
},
55
"formattedImportTax" : "$0.00",
56
"importDuty" : {
57
"currency" : "USD",
58
"value" : 0
59
},
60
"formattedImportDuty" : "$0.00"
61
}
62
}, {
63
"uri" : "http://dispatch-test.digitalriver.com/shop/sites/sub2test/shoppers/me/carts/active/line-items/10288030082",
64
"id" : 10288030082,
65
"quantity" : 1,
66
"product" : {
67
"uri" : "http://dispatch-test.digitalriver.com/shop/sites/sub2test/shoppers/me/products/5400082600",
68
"displayName" : "Subscription AddOn 1",
69
"thumbnailImage" : null
70
},
71
"pricing" : {
72
"listPrice" : {
73
"currency" : "USD",
74
"value" : 11
75
},
76
"listPriceWithQuantity" : {
77
"currency" : "USD",
78
"value" : 11
79
},
80
"salePriceWithQuantity" : {
81
"currency" : "USD",
82
"value" : 11
83
},
84
"formattedListPrice" : "$11.00",
85
"formattedListPriceWithQuantity" : "$11.00",
86
"formattedSalePriceWithQuantity" : "$11.00",
87
"productTax" : {
88
"currency" : "USD",
89
"value" : 0
90
},
91
"shippingTax" : {
92
"currency" : "USD",
93
"value" : 0
94
},
95
"feeTax" : {
96
"currency" : "USD",
97
"value" : 0
98
},
99
"taxRate" : 0,
100
"importTax" : {
101
"currency" : "USD",
102
"value" : 0
103
},
104
"formattedImportTax" : "$0.00",
105
"importDuty" : {
106
"currency" : "USD",
107
"value" : 0
108
},
109
"formattedImportDuty" : "$0.00"
110
}
111
} ]
112
},
113
"totalItemsInCart" : 2,
114
"businessEntityCode" : "DR_INC-ENTITY",
115
"billingAddress" : {
116
"uri" : "http://dispatch-test.digitalriver.com/shop/sites/sub2test/shoppers/me/carts/active/billing-address"
117
},
118
"shippingAddress" : {
119
"uri" : "http://dispatch-test.digitalriver.com/shop/sites/sub2test/shoppers/me/carts/active/shipping-address"
120
},
121
"payment" : { },
122
"paymentSession" : {
123
"id" : "2912a240-a65b-4ef5-bd2c-427b342b4dba",
124
"clientSecret" : "2912a240-a65b-4ef5-bd2c-427b342b4dba_978f2dd6-eaef-4933-a460-5f6b917d2b35",
125
"status" : "requires_source"
126
},
127
"shippingMethod" : { },
128
"shippingOptions" : {
129
"uri" : "http://dispatch-test.digitalriver.com/shop/sites/sub2test/shoppers/me/carts/active/shipping-options"
130
},
131
"taxInclusive" : "false",
132
"landedCostState" : "NOT_ELIGIBLE",
133
"pricing" : {
134
"subtotal" : {
135
"currency" : "USD",
136
"value" : 22.11
137
},
138
"discount" : {
139
"currency" : "USD",
140
"value" : 0
141
},
142
"shippingAndHandling" : {
143
"currency" : "USD",
144
"value" : 0
145
},
146
"importTaxAndDuty" : {
147
"currency" : "USD",
148
"value" : 0
149
},
150
"tax" : {
151
"currency" : "USD",
152
"value" : 0
153
},
154
"orderTotal" : {
155
"currency" : "USD",
156
"value" : 22.11
157
},
158
"formattedSubtotal" : "$22.11",
159
"formattedDiscount" : "$0.00",
160
"formattedShippingAndHandling" : "$0.00",
161
"formattedImportTaxAndDuty" : "$0.00",
162
"formattedTax" : "$0.00",
163
"formattedOrderTotal" : "$22.11"
164
},
165
"termsOfSalesAcceptance" : null
166
}
167
}
Copied!
Apply the shopper and submit the cart using the Shoppers resource.

Creating or changing a perpetual unit price

In this scenario, you create or change a perpetual unit price to a customer's subscription.
Use the POST /v1/subscriptions/{subscriptionId}/perpetual-price resource to apply a forever price for the remaining subscription cycle. You can use it to change a non-perpetual subscription to a perpetual subscription if the supplied subscription is not a perpetual subscription. You need to provide the subscriptionId and the renewalUnitPrice. Note that the renewalUnitPrice cannot be higher than the existing price.
cURL
1
curl -X POST \
2
http://{host}/v1/subscriptions/{subscription_Id}/perpetual-price \
3
-H 'authorization: Basic ****' \
4
-H 'cache-control: no-cache' \
5
-H 'content-type: application/json' \
6
-H 'postman-token: 5cb141b9-8077-8b12-3eff-ebb45db3ffa6' \
7
-d '{
8
"perpetualUnitPrice" : 59.99
9
}'
Copied!
You will receive a 202 Accepted response.
Last modified 5mo ago