Creating a payment form
To create a payment form, you need to send a request to https://api.1payment.com/init_form
with the following parameters:
partner_id
- 1234 (Partner ID)project_id
- 5678 (Project ID)amount
- 50 (amount in project currency)description
- payment description (optional)success_url
- https://test.com/success (url the payer's return after successful payment, optional)failure_url
- https://test.com/failure (url of payer return after payment error, optional)user_data
- a unique value, e.g. payment identifier on the partner sidetoken
- token id to display the saved card (optional)sign
- (sign)
Example:
https://api.1payment.com/init_form?partner_id=1234&project_id=5678&amount=50&description=test_payment&sign=d724e1e6453a43397bb2aa6d6be9cc06
sign
(sign)
calculated as follows: md5 from the string "init_form + concatenation of all
parameters = value in alphabetical order in ascending order with separator
& + secret API Key" (except the sign parameter)
For the query above, the string from which the md5 will be taken, is of the following form:
init_formamount=50&description=test_payment&partner_id=1234&project_id=5678[API_Key]
The system will respond in JSON:
{"url":"https:\/\/merchant.1payment.com\/xZ5g7F"}
Where:
url
- link to the form to which the payer should be directed.
After receiving final payment status on your notify_url, specified in the project settings, payment status notification will be sent . POST JSON notification format with the following parameters:
payment_type
- type of payment (see table payment types)order_id
- payment identifierproject_id
- Project IDstatus
- payment status (3 - successful payment, 4 - denial of payment)status_description
- text description of the status (SUCCESS or FAILURE, respectively)init_time
- payment creation timestatus_time
- the time of receipt of the payment statusmerchant_price
- payment amountuser_price
- partner contributionscurrency
- payment currency (three-letter code ISO 4217 )account
- card number maskstatus_code
- the field will contain an error code (if possible) if the payment is refused (optional)token
- contains the saved card ID on a successful payment (contact your manager to enable this option)user_data
- identifier given when the form was createdtest
- is present in the case of testing, takes the value 1