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…')
 
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===


* 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].
* description - description of the payment that is visible in [http://wiki.kolmisoft.com/index.php/Payments#Manual_payments Payments list].
* u - username for authentication. '''Required'''.
* u - username for authentication. '''Required'''.
Line 24: Line 24:
  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 61:


* <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>

Revision as of 08:39, 20 August 2013

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

  • number - Calling Card number. Required.
  • amount - default 0.
  • currency - if not specified - system's default.
  • description - description of the payment that is visible in Payments list.
  • u - username for authentication. Required.
  • hash - SHA1 hash constructed using number, amount, currency, description and API_Secret_Key ( More described in Constructing hash). 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