Documentation Sweet Pricing API

POST / productgroups / :productGroupId / variants

This endpoint creates a new pricing model for a proportion of an app's audience. In-app stores have one or more pricing models.

All new pricing models are experimental and target a proportion of an app's audience. We display the default pricing model to any user that is not in a test group. To replace the default pricing model, you must first create the model with this endpoint and promote it with PUT /productgroups/:productGroupId/nullvariant.

With this endpoint, you can create static and segmented pricing models. Indeed, we consider a static pricing model to be the degenerate segmented pricing model that uses the 'All Users' segment.

URL

https://api.sweetpricing.com/v1.0/productgroups/:productGroupId/variants

Header

Field Type Description
Authorization String

Header of form api-key <API key>

Authorization: api-key <API Key>

Parameters

Field Type Description
:productGroupId Number

Product Group ID.

Body

Field Type Description
audienceSharePercent Number

Audience share percentage.

variantsegments Object[]
variantsegments.order Number

Number representing the order of precedence, where lower values are more precedent.

variantsegments.segment Object
variantsegments.segment.id Number

ID of the segment

variantsegments.pricepoints Object[]
variantsegments.pricepoints.productId Number

Product ID

variantsegments.pricepoints.pricepoint Object
variantsegments.pricepoints.pricepoint.id Number

ID of the pricepoint to be used for the product ID in this particular variant.

{
	"audienceSharePercent": 10,
	"variantsegments": [{
		"order": 1,
		"segment": {
			"id": 1
		},
		"pricepoints": [{
			"productId": 1,
			"pricepoint": {
				"id": 2
			}
		}]
	}]
}

200

Field Type Description
id Number

ID of the variant

isControl Boolean

Is the control group?

audienceSharePercent Number

Number between 0 and 100, the fraction of user sessions that this experiment targets.

variantsegments Object[]

Array for each segment that is targeted by this variant.

variantsegments.id Number

ID of the variantsegment record.

variantsegments.order Number

Order of precedence for segments (where lower = more precedence)

variantsegments.segment Object
variantsegments.segment.id Number

ID of the segment that is being used.

variantsegments.segment.name String

Name of the segment being used.

variantsegments.pricepoints Object[]

Array of pricepoints for individual products.

variantsegments.pricepoints.productId Number

ID of the product

variantsegments.pricepoints.mode Boolean

'dynamic' if using machine learning based dynamic pricing; 'static' otherwise

variantsegments.pricepoints.pricepoint Object
variantsegments.pricepoints.pricepoint.id Number

ID of the pricepoint.

variantsegments.pricepoints.pricepoint.sku String

SKU of the pricepoint.

variantsegments.pricepoints.pricepoint.multiplier Mixed

Multiplier for subscriptions.

{
	"id": 1,
	"isControl": false,
	"audienceSharePercent": 5,
	"variantsegments": [{
		"id": 1,
		"order": 1,
		"segment": {
			"id": 1,
			"name": "All Users"
		},
		"pricepoints": [{
			"productId": 1,
			"mode": "static",
			"pricepoint": {
				"id": 1,
				"sku": "TenCoinsSKU",
				"multiplier": 1
			}
		}]
	}]
}

401

Name Description
401

You are not authenticated to perform the request.

403

Name Description
403

You are not allowed to view/modify this resource.

404

Name Description
404

Resource not found.