Skip to main content

Create a Proration Policy

POST 

https://euwest.api.elasticpath.com/v2/subscriptions/proration-policies

In Subscriptions, you configure proration by creating a proration policy and attaching it to an offering. Once you have attached the policy, the proration policy applies to all subscriptions that use the offering.

Request

Body

    data ProrationPolicyCreaterequired
    typeProrationPolicyType (string)required

    Possible values: [subscription_proration_policy]

    Example: subscription_proration_policy
    attributes ProrationPolicyAttributesrequired
    namestringrequired

    A name for the proration policy.

    Possible values: >= 3 characters and <= 1024 characters

    Example: Main Policy
    roundingstringrequired

    When rounding in proration, you must decide how to round the units of time used to calculate the charges.

    • round up to the next unit, ensuring subscribers are charged slightly more to cover any partial use.
    • round down to the previous whole unit, providing subscribers with a slight benefit by not charging for partial use.
    • round to the nearest whole unit, whether up or down, based on standard rounding rules. For example, rounding 0.5 up and rounding 0.5 down.

    Possible values: [up, down, nearest]

    Example: up
    external_refExternalRef (string)

    A unique attribute that you could use to contain information from another company system, for example. The maximum length is 2048 characters.

    Possible values: <= 2048 characters

    Example: abc123

Responses

Success. The proration policy is created.

Schema
    data ProrationPolicy
    idUUID (string)

    The unique identifier.

    Example: 11111111-2222-3333-4444-555555555555
    typeProrationPolicyType (string)required

    Possible values: [subscription_proration_policy]

    Example: subscription_proration_policy
    attributes ProrationPolicyResponseAttributes
    namestringrequired

    A name for the proration policy.

    Possible values: >= 3 characters and <= 1024 characters

    Example: Main Policy
    roundingstringrequired

    When rounding in proration, you must decide how to round the units of time used to calculate the charges.

    • round up to the next unit, ensuring subscribers are charged slightly more to cover any partial use.
    • round down to the previous whole unit, providing subscribers with a slight benefit by not charging for partial use.
    • round to the nearest whole unit, whether up or down, based on standard rounding rules. For example, rounding 0.5 up and rounding 0.5 down.

    Possible values: [up, down, nearest]

    Example: up
    external_refExternalRef (string)

    A unique attribute that you could use to contain information from another company system, for example. The maximum length is 2048 characters.

    Possible values: <= 2048 characters

    Example: abc123
    meta ProrationPolicyMetarequired
    ownerstringrequired

    The owner of a resource, either store or organization.

    Example: store
    timestamps Timestampsrequired
    updated_atstringrequired

    The date and time a resource was updated.

    Example: 2017-01-10T11:41:19.244842Z
    created_atstringrequired

    The date and time a resource was created.

    Example: 2017-01-10T11:41:19.244842Z

Authorization: http

name: BearerTokentype: httpscheme: bearer
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://euwest.api.elasticpath.com/v2/subscriptions/proration-policies");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{\n \"data\": {\n \"type\": \"subscription_proration_policy\",\n \"attributes\": {\n \"name\": \"Main Policy\",\n \"rounding\": \"up\",\n \"external_ref\": \"abc123\"\n }\n }\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Request Collapse all
Base URL
https://euwest.api.elasticpath.com/v2
Auth
Body
{
  "data": {
    "type": "subscription_proration_policy",
    "attributes": {
      "name": "Main Policy",
      "rounding": "up",
      "external_ref": "abc123"
    }
  }
}
ResponseClear

Click the Send API Request button above and see the response here!

We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies.