Assigning a perpetual unit price
Learn how to assign a perpetual unit price to a subscription with add-ons.
currentAssigning 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 of the product's perpetualUnitPrice
is 120
and the value for the add-on's perpetualUnitPrice
is 50
. See the perpetual-price resource for more information
curl --location --request POST 'https://api.digitalriver.com/v1/subscriptions/{subscriptionId}/perpetual-price' \
--header 'authorization: Basic ***\
...
--data-raw '{
"perpetualUnitPrice": 120,
"addOns": [
{
"product": {
"externalReferenceId": "A123"
},
"perpetualUnitPrice": 20
},
{
"product": {
"id": "B456"
},
"perpetualUnitPrice": 50
}
]
}'
You will receive a 202 Accepted
response.
See Selling subscriptions with add-ons for more information.
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
).
curl --location --request POST 'https://{host}/v1/shoppers/me/carts/active' \
--header 'authorization: Basic ***\
...
--data-raw '{
"cart": {
"lineItems": {
"lineItem": [
{
"quantity": "1",
"product": {
"id": "5363866300"
},
"customAttributes": {
"attribute": [
{
"name": "groupIdForAddon",
"value": "9814462289"
}
]
},
"subscriptionOverrideInfo": {
"perpetualUnitPrice": {
"currencyCode": "USD",
"amount": 49.99
}
}
},
{
"quantity": "1",
"product": {
"id": "5400082600"
},
"customAttributes": {
"attribute": [
{
"name": "groupIdForAddon",
"value": "9814462289"
},
{
"name": "parentProductIdForAddon",
"value": "5363866300"
}
]
},
"subscriptionOverrideInfo": {
"perpetualUnitPrice": {
"currencyCode": "USD",
"amount": 39.99
}
}
}
]
}
}
}'
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 -X POST \
https://{host}/v1/subscriptions/{subscription_Id}/perpetual-price \
-H 'authorization: Basic ****' \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-H 'postman-token: 5cb141b9-8077-8b12-3eff-ebb45db3ffa6' \
-d '{
"perpetualUnitPrice" : 59.99
}'
You will receive a 202 Accepted
response.
Last updated
Was this helpful?