code
The code model methods are used to provide the merchant with the possibilities of receiving and paying out funds through code payment obligations. Using code model methods, merchant can:
- Create a payment code - method code.create;
- Check (verify) the payment code - method code.verify;
- Use (accept) the payment code - method code.redeem;
- Get information about the code used for payment - method code.get.
endpoint
Queries for the model's methods are sent to endpoint https://api.any.money/.
code.create
A method for creating a code for a transmitted check payment system, where the payment amount and currency are counted.
Input method arguments
| Param | Required | Example | Description |
|---|---|---|---|
| amount | yes | "655" | payment amount (the amount fixed in the code, but not took from the merchant's balance) |
| curr | yes | "UAH" | name of the payment code currency |
| externalid | yes | "235" | unique ID specified by the merchant |
| payway | yes | "anycash" | payment payway name |
Caution!
For typed merchants the payway should match with the merchant's type, otherwise, an exception would be raised
Caution!
Right after the query receival - order is created and the its processing is called. After the method execution, funds will be immediately debited from the merchant's balance
Method response data
- code
- generated code
Exceptions
- EParamAmountFormatInvalid
- wrong amount value or format
- EParamAmountTooBig
- amount is more than the maximum transaction amount
- EParamAmountTooSmall
- amount is less than the minimum transaction amount
- EParamCurrencyInvalid
- debit and/or credit currency not present in the system, the currency is prohibited to use by this merchant in the transmitted payway
- EParamInvalid
-
- invalid amount value
- one of the arguments externalid, payway, amount, curr is not sent
- payway is not equals to the type of typed merchant
- EParamOffLimits
- transmitted argument exceeds the limits
- EParamPaywayInvalid
- transmitted an incorrect payway, not a cheque type payway
- EParamType
- invalid externalid format
- EParamUnique
- an order with transmitted externalid is already exists
- EStateCurrencyInactive
- inactive currency is transmitted
- EStateCurrencyUnavail
- transmitted currency is unavailable in the transmitted payway
- EStateInsufficientFunds
- amount is more than the merchant balance in the credit currency
- EStateOutPayUnavailable
- payments are blocked in the entire Any.Money system or for the current merchant
- EStatePaywayInactive
-
- the payway is currently inactive
- this payway is administratively blocked in Any.Money
- EStatePaywayUnavail
- the payway is unavailable for this merchant
- EStateUnavailable
- cannot get code from an external system
code.verify
Method to obtain the incoming payment code data by its full number.
Input method arguments
| Param | Required | Example | Description |
|---|---|---|---|
| code | yes | "3453464745t8t8" | full code number |
Method response data
Representation of billing code data
- amount
- the amount of the not redeemed code (empty field for the "EXMO" payway)
- can_be_accepted
- is it possible to redeem the code? (possible values:"yes", "no", "unknown")
- currency
- payment currency name
- fee
- code redemption fee representation
- add - fixed fee amount
- max - max fee amount
- min - min fee amount
- mult - fee rate
- method - fee method
- fee_value
- fee amount in the code payment currency if the payment amount is present in the payway response. Else would set to "unknown"
- payway
- cheque payway name
Exceptions
- EParamInvalid
- the wrong code transmitted
- EParamCodeInvalid
-
- code can't be accepted by the system
- wrong payment currency
- transfer cannot be made - transfer's currency is inactive in the payway
- the code is invalid or its payway is not supported in Any.Money
- unable to verify payment code
code.redeem
Method for cashing a code payment by creating a code redeem order.
Input method arguments
| Param | Required | Example | Description |
|---|---|---|---|
| code | yes | "3453464745t8t8" | full code of external payway |
| externalid | yes | "123" | unique ID specified by the merchant |
Method response data
Exceptions
- EParamAmountTooBig
- code payment amount exceeded the max convertation summ
- EParamAmountTooSmall
- code payment amount is less than the min transaction summ
- EParamCodeInvalid
-
- code can't be accepted by a system
- code cannot be redeemed in any of the available payway
- EParamCurrencyInvalid
- the code is created in a currency that is not available in Any.Money
- EParamInvalid
- externalid is not transmitted
- EParamType
- externalid has an incorrect format
- EStatePaywayInactive
-
- code payway is not active now
- code payway is blocked in Any.Money by admin
- EStatePaywayUnavail
- code payway is unavailable for current merchant
code.get
The method for obtaining information about the code by the transmitted order identifier (externalid).
Input method arguments
| Param | Required | Example | Description |
|---|---|---|---|
| externalid | yes | "123" | order identifier in the store's system |
Method response data
- amount
- payment amount
- code
- generated code
- currency
- payment currency
Exceptions
- EParamInvalid
- externalid invalid value
- EParamNotFound
- no order was found with transmitted externalid
- EParamType
- invalid data type of externalid
- EStateUnavailable
- it is impossible to get information from an external system