Init
https://{Environment}.payture.com/apim/InitThe command that initializes a one-step or two-step payment. Processing the request creates a payment session and prepares the Customer to be redirected to the Payture payment gateway page to enter their card details.
Request
curl https://sandbox3.payture.com/apim/Init \
-X POST \
-H "Content-Type: application/x-www-form-urlencoded" \
-d Key=Merchant \
--data-urlencode "Data=SessionType=Pay;OrderId=5f63838d-fb03-00c6-c890-c67cfc1c54ea;Amount=12480;Product=Ticket;Total=124.8;Phone=79156783333;Description=MyTestTransaction;Url=https://payture.com/result?orderid={orderid}&result={success};AdditionalField1=Value1;AdditionalField2=Value2"Parameter names in requests are case-sensitive
| Parameter | Description | Format |
|---|---|---|
| Key | Payment terminal name Provided with the test/production access credentials | String Mandatory |
| Data | Payment parameters URL-encoded string of key-value pairs separated by “;” (semicolon). Keys and values are separated by “=” (equals sign) | String Mandatory |
Data parameter structure
The
{success}and{orderid}parameters must be specified in lowercase.
| Parameter | Description | Format |
|---|---|---|
| SessionType | Payment type. Defines the number of payment stages:Pay — one-step paymentBlock — two-step payment | String Mandatory |
| OrderId | Unique payment ID in the Merchant's system Recommended format: GUID/UUID or alphanumeric. Other formats may cause failures in banking services | String [1..50] Mandatory |
| Amount | Payment amount in kopecks (or another minor unit of the terminal currency) Digits only, without decimal or other separators | Integer Mandatory |
| Url | URL the Customer is returned to after completing the payment on the Payture side. The Success and OrderId parameters can also be passed in the return URLGenerally, the return URL can be configured for the payment terminal via Payture support, in which case it does not need to be passed | String Optional |
| Product | Name of the purchase being paid for, displayed to the Customer on the payment page | String [1..50] Optional |
| Total | Order amount displayed to the Customer on the payment page Use this field if you want to change the default amount format | String [1..50] Optional |
| TemplateTag | Name of the payment page template to use Required if the Merchant uses several templates. If the parameter is not passed, the template named “Default” is used. Learn more about payment page templates | String [1..50] Optional |
| Language | Payment page template language Required if the template uses several languages. If the parameter is not passed, the “Default” template language is used. Learn more about payment page templates | String [1..50] Optional |
| Phone | Customer's phone number Digits only, without separators. Format: [country code][carrier code][subscriber number] | String Optional |
| Description | Additional payment description | String Optional |
| IP | Customer's IP address IPv4 or IPv6 | String Optional |
| Cheque | Fiscal receipt data in JSON format, Base64-encoded | String Optional |
| Additional parameters | Any additional Merchant parameters There can be several additional parameters. Each parameter is passed separately | — Optional |
The set of required parameters may vary. Contact Payture support for details.
Example of the Data parameter (decoded):
SessionType=Pay;
OrderId=5f63838d-fb03-00c6-c890-c67cfc1c54ea;
Amount=12480;
Total=124.8;
Product=Ticket;
Phone=79156783333;
Description=MyTestTransaction;
Url=https://payture.com/result?orderid={orderid}&result={success};
AdditionalField1=Value1;
AdditionalField2=Value2Example of the Url parameter (return URL):
https://server.com/result?orderid={orderid}&result={success}Response
XML string with the Init element
Response examples
<Init Success="True" OrderId="5f63838d-fb03-00c6-c890-c67cfc1c54ea" Amount="12480" SessionLifeTime="60" AttemptsCount="5" SessionId="c8cc6c5c-30da-d7e1-e090-46f25ae30626"/>| Parameter | Description | Format |
|---|---|---|
| Success | Operation success flag. Possible values:True — the operation succeededFalse — the operation failed | String Mandatory |
| OrderId | Payment ID in the Merchant's system Matches the value passed in the request | String [1..50] Mandatory |
| Amount | Payment amount in kopecks (or another minor unit of the terminal currency) Returned if “Success=True”. Matches the value passed in the request | Integer Optional |
| SessionLifeTime | Payment session lifetime from the moment it is received in the Init response (in minutes) Returned if “Success=True”. The default is 60 minutes. The value can be changed via Payture support | Integer Optional |
| AttemptsCount | Number of payment attempts available to the Customer on the payment page within the current session Returned if “Success=True”. The default is 5 attempts. The number can be changed via Payture support | Integer Optional |
| SessionId | Payment session ID in the Payture system Returned if “Success=True” | String [36] Optional |
| ErrCode | Error code. See error codes Returned if “Success=False” | String Optional |
