Skip to main content
POST
/
withdraw
/
try
Payout preliminary calculation
curl --request POST \
  --url https://api.m4solutions.io/gateway/v1/withdraw/try \
  --header 'Content-Type: application/json' \
  --data '
{
  "shop_id": 1520,
  "shop_currency": 840,
  "payway": "card_payway_usd",
  "amount": "6320.91",
  "amount_type": "ps_amount",
  "account_details": {},
  "account": "150010000097"
}
'
{
  "result": true,
  "message": "Ok",
  "error_code": 0,
  "data": {
    "account_info_config": {
      "account": {
        "regex": "\\d{9,15}$",
        "title": "Account number, for example: 150010000097"
      }
    },
    "payee_receive": 150,
    "ps_currency": 840,
    "shop_currency": 840,
    "shop_write_off": "160"
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.m4psp.com/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

sign
string
requestBody
required

Every API request must be signed so that we can identify your account.

The signature is transferred in the request body through the sign parameter, for example:

{
"shop_id": 1520,
"shop_order_id" : "5b0efa8a-153b-4421-abac-2aba4d772a86",
"amout": "6320.91",
"currency": 840,
"payway": "card_invoice_usd",
"description": "Payment for shop_id=1520",
"sign": "77a6f7a30876d480d4e771d08cb83800dd5cb874664c77e515ffc052b20293c6"
}
All further request examples do not include the "sign" parameter, nevertheless your real requests must include it in the request body where required.

Signature line is generated according to the following algorithm: all request parameters involved in signature generation are ordered in the alphabetical order of keys, the values are concatenated with a colon (":") and the account secret key is added at the end (without the: sign), a sha256 hash is generated from the resulting line and its hex representation is passed in the sign request parameter.

Example of signature generation for a method invoice/create:

  1. Determining the list of parameters. It looks as follows for the method in consideration:

Fields involved in request signature generation:

  • shop_id
  • shop_order_id
  • amount
  • currency
  • payway
  1. Let's sort keys in alphabetical sequence:

"amount", "currency", "payway", "shop_id", "shop_order_id"

  1. The line for generating the SHA256 hash will be as follows:

"6320.91:840:card_invoice_usd:1520:5b0efa8a-153b-4421-abac-2aba4d772a86account-secret-key"

Where account-secret-key is the secret identification key for your account. You can request a key from the support service.

  1. Let's get a hash expression of the generated line using Python code:
>>> string_to_sign = '6320.91:840:card_invoice_usd:1520:5b0efa8a-153b-4421-abac-2aba4d772a86account-secret-key'
>>> import hashlib
>>> sign = hashlib.sha256(string_to_sign.encode()).hexdigest()
>>> print(sign)
'77a6f7a30876d480d4e771d08cb83800dd5cb874664c77e515ffc052b20293c6'
You can check whether you have generated the signature correctly using the service https://www.xorbin.com/tools/sha256-hash-calculator.

Body

application/json
shop_id
integer
required

Unique shop identifier in the M4 system.

Example:

1520

shop_currency
enum<number>
required

Currency of the shop balance from which the funds will be debited (in accordance with ISO 4217).

Available options:
840,
978
Example:

840

payway
string
required

Payment direction for payout. Currency of receipt depends on the specified payment way.

There are two ways to get a list of all payment ways available to the shop:

  • Execute the API request "Receiving payment methods for payouts" shop_output_config/shop.
  • Request a register from the support service.
Maximum string length: 150
Pattern: ^[A-Za-z_,\[\]]+$
Example:

"card_payway_usd"

amount
string
required

Amount received or withdrawn. Example: "227.34"

Example:

"6320.91"

amount_type
enum<string>
required

Indicates the amount type, possible values:
ps_amount – the exact amount indicated in the amount will be sent to a beneficiary card or wallet. Credit currency will correspond to the currency of the payway,
shop_amount – the exact amount indicated in the amount will be written off from the shop balance, beneficiary will receive this amount minus transaction fees. Debit currency will correspond to the currency of the shop_currency.

Available options:
ps_amount,
shop_amount
Example:

"ps_amount"

account_details
object

Detailed account information. If additional parameters were transferred in the shop_output_config/shop response in the account_info_config field, they must be transferred in the account_details field.

account
string

Account of the recipient of funds in the payment system or service. For example, phone, card number or steam login.

Example:

"150010000097"

Response

200 - application/json

OK

result
boolean
required

Boolean value, in case of successful response it will be true, in case of error – false

Example:

true

message
string
required

A textual description of the error, in case of success - simply Ok

Example:

"Ok"

error_code
number
required

If this value is greater than 0, then the request ended with an error. Description of error codes

Example:

0

data
Result of a preliminary calculation of the payout · object
required