Skip to content

invoice

endpoint

https://sci.any.money/invoice.

invoice module is intended for processing the merchant's balance replenishment operations by customers. Customers are by generated invoice, which can be paid in two ways: - fully in the invoice currency; - or, by arbitary parts and various currencies with convertation to merchant's credit balance currency. Customers can return the overpaid amount for the specific invoice. Or, they may reverse the base insuficient payment in case they do not plan to proceed with the surcharge by the invoice. The balance is replenished only after receiving an amount equal or greater than invoiced. The basic payment fee is paid by the merchant, but surcharges or refunds costs are beared by payers only.

Query form requires the next arguments:

Caution!

For typed merchants the transmitted payway have to match the merchant type otherwise the error will be returned

Caution!

Please note that the values of boolean argument is_multipay are transmitted exactly in string (!) format

and in lower case letters. In this case, transmitting the value "true" is equivalent to True, and "false" - to False.

Input method arguments
param required example description
amount yes "1000,25" invoice payment amount
callback_url no "https://callback_example.com" url-address for server-server messages about oprder's status changes. Messages format
client_email no "[email protected]" payer email-address for invoice-payment status change notifications
externalid yes "123" unique ID specified by the merchant
in_curr yes "UAH" credit currency
is_multipay no "false" flag for providing the making a surcharge and receiving a refund possibility ("true" = surcharge and return are possible, "false" = blocked). default = "false"
lifetime no "1d12h" order lifetime, in the seconds or in the timedelta format (the string like "1w1d1h1m1s1ms"). The valid value range is: "7d".."3600s". default="7d"
merchant yes "13" string display of the local merchant's system ID
merchant_payfee no "0,35" the share of the total fee amount for incoming payments paid by the merchant (value in the interval [0..1] with an accuracy of two decimal places)
out_curr no "USD" optional invoice-payment debit currency
payway no "card" payway of the replenishment (possible values: "btc", "perfect", "qiwi"... etc.). For the typed merchant only linked payway is available
redirect_url no "https://example.com/order_page/" url-address for redirecting the user method executing or pressing the "Back" button
sign yes 128-digits secuence unique hash signature of the SCI-request

lifetime is set to "7d" by default.
If the payway volume was not transmitted in the query, the user can access all payways activated in the merchant's settings.

Time type values in the timedelta format are transmitted in pairs: ... without spaces in pairs.
Only seconds can be transmitted as a keyless value. If, at least, one key is applied to the timedelta line, it must be ended by a key (not a digit), otherwise an error wiil be returned.

In the exception event, the user will be redirected to the exception page with the relevant information about it.

web form

HTML
<form name="payment" method="post" action="https://sci.any.money/invoice" accept-charset="UTF-8">
    <input type="hidden" name="sign" value=""/>
    <input type="hidden" name="merchant" value=""/>
    <input type="hidden" name="amount" value="100.25"/>
    <input type="hidden" name="in_curr" value="UAH"/>
    <input type="hidden" name="payway" value="card"/>
    <input type="hidden" name="externalid" value="123"/>
    <input type="hidden" name="expiry" value="600"/>
    <input type="hidden" name="client_email" value="[email protected]"/>
    <input type="hidden" name="callback_url" value="https://example.com/order_handler"/>
    <input type="hidden" name="redirect_url" value="https://example.com/order_page/"/>
    <input type="submit" value="Pay">
</form>

signature

The SCI-requests sent to the invoice module are authenticated by a signature, formed by the HEX algorithm (HMAC-SHA512 (data, sci_key)), where:
- data - a string, composed from parameters values. They are added to the query in order of the following keys, sorted alphabetically;
- sci_key - merchant's invoice-key.

Signature formation example

Python
import hashlib
import hmac

def sign_form_data(key: str, data: dict) -> str:
    if data: sorted_data = sorted(data.items())
    else: sorted_data = {}

    msg = ''.join(
        str(v) for k, v in sorted_data
        if not isinstance(v, (dict, list, type(None)))
    )
    msg = msg.lower()

    return hmac.new(key.encode(), msg.encode(), hashlib.sha512).hexdigest()
PHP
<?php
function sign_form_data(string $key, array $data) : string {
    ksort($data);
    $s = '';
    foreach($data as $k=>$value) {
      if (in_array(gettype($value), array('array', 'object', 'NULL')) ){
          continue;
        }
        if(is_bool($value)){
            $s .= $value ? "true" : "false";
        } else {
            $s .= $value;
        }
    }
    return hash_hmac('sha512', strtolower($s), $key);
}
?>