MOR API subscription update

From Kolmisoft Wiki
Revision as of 08:29, 15 March 2023 by Edvardas (talk | contribs) (→‎Parameters)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Description

MOR API Update subscription

Usage

  • Call: /api/subscription_update
  • Methods: POST, GET(if allowed, not recomended)



Parameters

Parameters which are included into hash:

  • subscription_id - Subscription ID. Required.

Parameters which are not included into hash:

  • hash - SHA1 hash constructed using API_Secret_Key ( More described in Constructing hash). Required.
  • u - username for authentication. Required.
  • subscription_activation_start - timestamp of Subscription activation start.
  • subscription_activation_end - timestamp of Subscription activation end.
  • subscription_memo - memo of Subscription.
  • subscription_discount_percent - Subscription Discount Percent. Possible values are from 0 to 100.
  • subscription_start_period_day - Start Period on the day, possible values between 1 and 31.
  • subscription_start_period_month - Start Period on the month, possible values between 1 and 12.
  • subscription_charge_balance_on - Charge Balance on, possible values are 1,2,3 (where 1: Period Start, 2: Period End, 3: Every Day).
  • subscription_until_canceled - subscription is until canceled (0 - off, 1 - on, default - off).
  • subscription_no_expiration_at_the_end_of_a_month - subscription has no expiration at the end of the month. (0 - off, 1 - on, default - off). Only for Flat Rate.



Request

We have subscription_id = 10, subscription_activation_start = 1255132800, subscription_memo = acc_one, API Secret Key = 456789.

We send:

HTML POST: http://<SERVER_IP>/billing/api/subscription_update?u=username&subscription_id=10&subscription_activation_start=1255132800&subscription_memo=acc_one&hash=e0f93111f867ca5d424c0f0ebb6b678159086d00

* Note that username is not included in hash

Returns

Success

 <?xml version="1.0" encoding="UTF-8"?>
 <page>
   <status>
     <success>Subscription was successfully updated</success>
   </status>
 </page>




Errors

  • <error>Access Denied</error> - the user does not exist or cannot use this functionality.
  • <error>You are not authorised to use this functionality</error> - accountant does not have Manage Subscription permission.
  • <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
  • <error>Subscription activation end date must be valid timestamp</error> - self explanatory.
  • <error>Subscription activation start date must be valid timestamp</error> - self explanatory.
  • <error>Subscription was not found</error> - Subscription with specified subscription_id was not found.
  • <error>Activation start date must be earlier than end date</error> - self explanatory.
  • <error>Service is not flat rate</error> - you are using subscription_no_expiration_at_the_end_of_a_month parameter with service which is not Flat-Rate type.

Info

  • <info>Not possible to set activation end until canceled </info> - It is not possible to set activations to end until canceled, for subscription types: One Time fee, Dynamic Flat rate.
  • <info>Not possible to change dates </info> - It is not possible to change dates, for subscription type Dynamic Flat rate and it is not possible to change the end date for subscription type One time fee.



See also