MOR API card payment add

From Kolmisoft Wiki
Jump to navigationJump to search

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