Difference between revisions of "MOR API payment create"

From Kolmisoft Wiki
Jump to navigationJump to search
 
(15 intermediate revisions by 6 users not shown)
Line 1: Line 1:
'This functionality is available from [[MOR 12| MOR 12]]''
=Description=
<!---This functionality is available from MOR 12--->
[[MOR API]] Create Payment


Create new payment from params. '''User balance will change''' if new payment is completed and admin confirmation is off in the settings (SETTINGS > Setup > Settings > API, option "API Payment Confirmation").


[[MOR API]]
=Configuration=


Create new payment from params. '''User balance will change''' if new payment is completed and admin confirmation is off in the settings (Settings->Payments or Payment gateways).
Go to SETTINGS -> Setup -> Settings->API tab and check '''API allow Payments'''
<br><br>
=Usage=


To turn on : Settings->Api->API allow Payments
* From '''MOR X4''' call: '''/api/payment_create'''
* For Backwards-compatibility old name 'create_payment' is also usable. Call: '''/api/create_payment'''
* Methods: POST, GET(if allowed, not recomended)
<br><br>
===Parameters===


* user_id - User ID in MOR database, whose payment have to be done. '''Required'''.
* p_currency - Currency code.'''Required'''.
* paymenttype - payment getaway name. '''Optional'''.
* tax_in_amount - [0/1] default 0.  '''Optional'''.
* amount - amount. '''Required'''.
* transaction - transaction ID.  '''Optional'''.
* payer_email - payer email.  '''Optional'''.
* comments_for_user - Comment for User. '''Optional'''.
* u - username (admin/reseller) for authentication. '''Required'''.
* [[MOR API hash construction | hash]] - SHA1 hash constructed using '''params''' and '''API_Secret_Key''' ([[MOR API hash construction | More described in Constructing hash]]). '''Required''' (if setting '''Disable hash checking''' is not checked).
<br><br>


<br><br>
===Request===
----
 
We have user_id = 123, API Secret Key = 456789
We send:
HTML POST: http://<SERVER_IP>/billing/api/payment_create?u=admin&user_id=123&p_currency=EUR&paymenttype=Myname&tax_in_amount=1&amount=100&transaction=2S5sdf77&payer_email=bla&u=username&hash=687a2cee0a61dee0bffa3bc8837e201a6a31af5d
 
'''NOTE that username and password are not included in hash'''
<br><br>
<br><br>


* Call: /api/create_payment
===Returns===
* Methods: POST, GET(if allowed, not recomended)
* Params:
** user_id - User ID in MOR database, whose financial statement we want to see. '''Required'''.
** p_currency - Currency code.'''Required'''.
** paymenttype - payment getaway name. '''Optional'''.
** tax_in_amount - [0/1] default 0.  '''Optional'''.
** amount - amount. '''Required'''.
** transaction - transaction ID.  '''Optional'''.
** payer_email - payer email.  '''Optional'''.
** u - username (admin/reseller) to login. '''Required'''.
** p - password (admin/reseller) to login. '''Required'''.
** [[MOR API hash construction | hash]] - SHA1 hash constructed using '''user_id''' and '''API_Secret_Key''' ([[MOR API hash construction | More described in Constructing hash]]). '''Required'''.
**


* Returns:
'''Success'''
**Success
*** <response>
****  <status>ok</status>
****  <payment currency="...">
*****    <payment_id>...</payment_id>
*****    <tax>...</tax>
*****    <amount>...</amount>
*****    <gross>...</gross>
****  </payment>
*** </response>


** Errors:
<?xml version="1.0" encoding="UTF-8"?>
*** <error>Bad login</error> - User supplied bad login or password.
<page>
*** <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
  <response>
*** <error>No currency</error> - Currency not found in system.
  <status>ok</status>
*** <error>Payment was not saved</error>
  <confirmed>No</confirmed>
**** <message>Error message</message>
  <payment currency="...">
    <payment_id>...</payment_id>
    <tax>...</tax>
    <amount>...</amount>
    <gross>...</gross>
  </payment>
  </response>
</page>
<br><br>
<br><br>
----
----
*Example:
 
**We have user_id = 123, API Secret Key = 456789
'''Errors'''
**Hash string to be converted: "123456789"
 
**We might send:
* <error>Bad login</error> - User supplied bad login.
***//api/create_payment?user_id=123&p_currency=EUR&paymenttype=Myname&tax_in_amount=1&amount=100&transaction=2S5sdf77&payer_email=bla&u=admin&p=admin&hash=687a2cee0a61dee0bffa3bc8837e201a6a31af5d
* <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
'''* Note that username and password are not included in hash'''
* <error>No currency</error> - Currency not found in system.
* <error>Access Denied</error> - User was not found or the current user(username (admin/reseller) for authentication) is not an owner of user which payment have to be done for.
* <error>Payment was not saved</error>
** <message>Error message</message>
<br><br>
 
=See also=
 
* [[MOR API]]
* [[Payment Gateway Integration]]

Latest revision as of 16:04, 20 June 2023

Description

MOR API Create Payment

Create new payment from params. User balance will change if new payment is completed and admin confirmation is off in the settings (SETTINGS > Setup > Settings > API, option "API Payment Confirmation").

Configuration

Go to SETTINGS -> Setup -> Settings->API tab and check API allow Payments

Usage

  • From MOR X4 call: /api/payment_create
  • For Backwards-compatibility old name 'create_payment' is also usable. Call: /api/create_payment
  • Methods: POST, GET(if allowed, not recomended)



Parameters

  • user_id - User ID in MOR database, whose payment have to be done. Required.
  • p_currency - Currency code.Required.
  • paymenttype - payment getaway name. Optional.
  • tax_in_amount - [0/1] default 0. Optional.
  • amount - amount. Required.
  • transaction - transaction ID. Optional.
  • payer_email - payer email. Optional.
  • comments_for_user - Comment for User. Optional.
  • u - username (admin/reseller) for authentication. Required.
  • hash - SHA1 hash constructed using params and API_Secret_Key ( More described in Constructing hash). Required (if setting Disable hash checking is not checked).



Request

We have user_id = 123, API Secret Key = 456789 We send:

HTML POST: http://<SERVER_IP>/billing/api/payment_create?u=admin&user_id=123&p_currency=EUR&paymenttype=Myname&tax_in_amount=1&amount=100&transaction=2S5sdf77&payer_email=bla&u=username&hash=687a2cee0a61dee0bffa3bc8837e201a6a31af5d

NOTE that username and password are not included in hash

Returns

Success

<?xml version="1.0" encoding="UTF-8"?>
<page>
 <response>
  <status>ok</status>
  <confirmed>No</confirmed>
  <payment currency="...">
    <payment_id>...</payment_id>
    <tax>...</tax>
    <amount>...</amount>
    <gross>...</gross>
  </payment>
 </response>
</page>




Errors

  • <error>Bad login</error> - User supplied bad login.
  • <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
  • <error>No currency</error> - Currency not found in system.
  • <error>Access Denied</error> - User was not found or the current user(username (admin/reseller) for authentication) is not an owner of user which payment have to be done for.
  • <error>Payment was not saved</error>
    • <message>Error message</message>



See also