Difference between revisions of "MOR API card payment add"

From Kolmisoft Wiki
Jump to navigationJump to search
(Created page with '=Description= <!---This functionality is available from MOR x4---> MOR API adds payment to the [http://wiki.kolmisoft.com/index.php/Calling_Card_management Calling Card]. <br…')
 
 
(3 intermediate revisions by 2 users not shown)
Line 5: Line 5:
=Usage=
=Usage=


* From '''MOR X4''' call: '''/api/card_payment_add'''
* From '''MOR X4''' call: '''/api/card_payment_add'''.
* Methods: POST, GET(if allowed, not recomended)
* Methods: POST, GET (if allowed, not recomended).
<br><br>
<br><br>
===Parametres===
===Parameters===


Parameters which are '''included''' into hash:
* description - description of the payment that is visible in [http://wiki.kolmisoft.com/index.php/Payments#Manual_payments Payments list].
* number - Calling Card number. '''Required'''.
* number - Calling Card number. '''Required'''.
* amount - default 0.
* amount - default 0.
* currency - default - system's default.
* currency - if not specified - system's default.
* description - description of the payment that is visible in [http://wiki.kolmisoft.com/index.php/Payments#Manual_payments Payments list].
 
'''Note that parameters are shown in the same order as they have to be when generating the hash. Last parameter in a row is API_Secret_Key'''
<br><br>
Parameters which are '''not included''' into hash:
 
* [[MOR API hash construction | hash]] - SHA1 hash constructed using parameters above and API_Secret_Key ([[MOR API hash construction | More described in Constructing hash]]). '''Required''' (if setting '''Disable hash checking''' is not checked).  
* u - username for authentication. '''Required'''.
* u - username for authentication. '''Required'''.
* [[MOR API hash construction | hash]] - SHA1 hash constructed using '''number''', '''amount''', '''currency''', '''description''' and '''API_Secret_Key''' ([[MOR API hash construction | More described in Constructing hash]]). '''Required'''.
<br><br>
<br><br>
===Request===
===Request===


Line 24: Line 32:
  HTML POST: http://<SERVER_IP>/billing/api/card_payment_add?u=username&number=1111111001&amount=5&currency=EUR&description=text&hash=d6ce58f8a1ea56ff075c16c45b3e1714298a14d7
  HTML POST: http://<SERVER_IP>/billing/api/card_payment_add?u=username&number=1111111001&amount=5&currency=EUR&description=text&hash=d6ce58f8a1ea56ff075c16c45b3e1714298a14d7


'''NOTE that username are not included in hash'''
'''NOTE that username is not included in hash'''
<br><br>
<br><br>
===Returns===
===Returns===
Line 61: Line 69:


* <error>Access Denied</error> - such user was not found.
* <error>Access Denied</error> - such user was not found.
* <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
* <error>Incorrect hash</error> - hash is incorrect.
* <error>Calling Card was not found</error> - such Calling Card does not exist or user is not authorised to use this API or specific card belongs to another user.  
* <error>Calling Card was not found</error> - such Calling Card does not exist or user is not authorised to use this API or specific card belongs to another user.  
* <error>Currency disabled</error> - you can not use disabled currencies with API.  
* <error>Currency disabled</error> - you can not use disabled/not enabled currencies.  
* <error>Feature Disabled</error> - you need to enable API payments in [http://wiki.kolmisoft.com/index.php/API_Configuration API settings].  
* <error>Feature Disabled</error> - you need to enable API payments in [http://wiki.kolmisoft.com/index.php/API_Configuration API settings].  
<br><br>
<br><br>

Latest revision as of 06:48, 30 May 2014

Description

MOR API adds payment to the Calling Card.

Usage

  • From MOR X4 call: /api/card_payment_add.
  • Methods: POST, GET (if allowed, not recomended).



Parameters

Parameters which are included into hash:

  • description - description of the payment that is visible in Payments list.
  • number - Calling Card number. Required.
  • amount - default 0.
  • currency - if not specified - system's default.

Note that parameters are shown in the same order as they have to be when generating the hash. Last parameter in a row is API_Secret_Key

Parameters which are not included into hash:

  • hash - SHA1 hash constructed using parameters above and API_Secret_Key ( More described in Constructing hash). Required (if setting Disable hash checking is not checked).
  • u - username for authentication. Required.



Request

We have card number 1111111001, API Secret Key = 456789 and want to add 5 EUR to the card.

We send:

HTML POST: http://<SERVER_IP>/billing/api/card_payment_add?u=username&number=1111111001&amount=5&currency=EUR&description=text&hash=d6ce58f8a1ea56ff075c16c45b3e1714298a14d7

NOTE that username is not included in hash

Returns

Success

<?xml version="1.0" encoding="UTF-8"?>
<page>
  <status>
    <success>Calling Card balance successfully updated</success>
  </status>
  <calling_card_group>
    <name>Test_cardgroup</name>
  </calling_card_group>
  <calling_card>
    <number>1111111001</number>
  </calling_card>
  <add_payment>
    <currency>EUR</currency>
    <amount_with_tax>5</amount_with_tax>
    <details>
      <current_balance>30.3946220484454</current_balance>
      <converted_to>USD</converted_to>
      <exchange_rate>0.73853104</exchange_rate>
      <amount_with_tax>6.770196145</amount_with_tax>
      <amount_without_tax>6.770196145</amount_without_tax>
      <new_balance>37.1648181934454</new_balance>
      <description>text</description>
    </details>
  </add_payment>
</page>




Errors

  • <error>Access Denied</error> - such user was not found.
  • <error>Incorrect hash</error> - hash is incorrect.
  • <error>Calling Card was not found</error> - such Calling Card does not exist or user is not authorised to use this API or specific card belongs to another user.
  • <error>Currency disabled</error> - you can not use disabled/not enabled currencies.
  • <error>Feature Disabled</error> - you need to enable API payments in API settings.



See also