Search…
Assigning a perpetual unit price
Learn how to assign a perpetual unit price to a subscription.

Assigning a perpetual unit price to a subscription

In this scenario, you assign a perpetual unit price to the customer's subscription.
Use the POST /v1/subscriptions/{subscriptionId}/perpetual-price resource to assign a perpetual unit price. You need to provide the subscription identifier (subscriptionId) and the perpetual unit price (perpetUnitPrice). In the following example, the value for the product'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
}'
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 the 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 with a perpetual unit price. You need to include the perpetual unit price (perpetualUnitPrice) in the subscription override info (subscriptionOverrideInfo). The response to this request creates a shopping cart and returns an access token to be included in all other cart interactions.
/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
"customAttributes":{
7
8
},
9
"lineItems":{
10
"lineItem":[
11
{
12
"quantity":"1",
13
"product":{
14
"id":"5367865200"
15
},
16
"subscriptionOverrideInfo" : {
17
"perpetualUnitPrice": {
18
"currencyCode" : "USD",
19
"amount" : 56.87
20
}
21
22
},
23
"customAttributes":{
24
"attribute":[
25
26
]
27
}
28
}
29
]
30
},
31
"billingAddress":{
32
"firstName":"First",
33
"lastName":"Last",
34
"companyName":null,
35
"line1":"10380 Bren Rd",
36
"line2":null,
37
"line3":null,
38
"city":"Eden Prairie",
39
"countrySubdivision":"MN",
40
"postalCode":"55344",
41
"emailAddress":"[email protected]",
42
"country":"US",
43
"phoneNumber":"+1234567896"
44
},
45
"shippingAddress":{
46
"firstName":"First",
47
"lastName":"Last",
48
"companyName":null,
49
"line1":"10380 Bren Rd",
50
"line2":null,
51
"line3":null,
52
"city":"Eden Prairie",
53
"countrySubdivision":"MN",
54
"postalCode":"55344",
55
"emailAddress":"[email protected]",
56
"country":"US",
57
"phoneNumber":"+1234567896"
58
}
59
}'
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
{
6
"lineItem": [{
7
"quantity": 6,
8
"product": {
9
"id": "{{productID}}"
10
},
11
"subscriptionOverrideInfo": {
12
"perpetualUnitPrice": {
13
"currencyCode": "USD",
14
"amount": 175.00
15
}
16
}
17
}]
18
}'
Copied!
Apply the shopper and submit the cart using the Shoppers resource.

Creating or changing a perpetual price

In this scenario, you create a cart or change the perpetual unit price for the 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 perpetualUnitPrice. Note that the perpetualUnitPrice cannot be higher than the existing price.
cURL
1
curl -X POST \
2
http://{host}/v1/subscriptions/{ubscriptionId}/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 8mo ago