1. Purchase
Freedom Pay
  • Overview
  • Gateway API
    • Overview
    • Sync API
      • Overview
      • Card data encryption
      • Payments
        • Overview
        • Pay by card
        • Pay by card: complete 3DS
        • Pay with Apple Pay
        • Pay with Google Pay
        • Pay by recurring profile
        • Create payment page
        • Create payment page with any amount
        • Capture payment (clearing)
        • Cancel payment
        • Refund payment
        • Get payment status
      • Payout
        • Overview
        • Pay out to card
        • Pay out to IBAN
        • Get payout balance
        • Get payout status
      • Transfer
        • Overview
        • Transfer from card to card
        • Transfer from card to card: complete 3DS
        • Get exchange rates
        • Get transfer status
      • Saved cards
        • Overview
        • Save card
        • Save card: complete 3DS
        • List saved cards
        • Remove saved card
        • Pay by card token
        • Pay out to card token
        • Get payment status
    • Async API
      • Overview
      • Create
        • Create payment
      • Read
        • Get payment status
        • Get request result
      • Edit
        • Capture payment (clearing)
        • Cancel payment (reverse)
        • Refund payment
  • Merchant API
    • Overview
    • Purchase
      • Overview
      • Checkout
      • Card token
        • Overview
        • Tokenize card
        • Delete token
        • Card token list
        • Create payment (with CVC)
        • Confirm payment (with CVC)
        • Create payment
        • Confirm payment
      • Create payment
        POST
      • Create payment with any amount
        POST
      • Create recurring payment
        POST
      • Cancel payment
        POST
      • Capture payment (clearing)
        POST
      • Refund payment
        POST
      • Get payment status
        POST
      • Create payment with a payment page template
        POST
      • Create payment in a payment frame
        POST
    • Payout
      • Overview
      • Card token
        • Tokenize card
        • Delete token
        • Card token list
        • Create payment
      • Create payment
      • IBAN
      • Balance status
      • Status
    • Mobile balance
      • Overview
      • Init
      • Pay
      • Approve
      • Resend code
      • Status
    • Invoice
      • Overview
      • Recurring profile
        • Overview
        • Create
        • Cancel
        • Info
        • Notify
      • Tips
        • Overview
        • Create
      • Create
      • Execute
      • Info
      • Refund
      • Status
      • Cancel
    • SDK
      • JS SDK
      • Merchant SDK
        • Google Pay
        • Android
        • IOS
    • CMS
      • Overview
      • Get Merchant ID and key
      • WordPress
        • Overview
        • Installation
        • Configuration
        • Test
        • Live payments
        • Update
      • Tilda
        • Overview
        • Installation
        • Configuration
        • Test
        • Live payments
      • InSales
        • Overview
        • Installation
        • Configuration
        • Test
        • Live payments
      • Ecwid
        • Overview
        • Installation
        • Configuration
        • Test
        • Live payments
      • Bitrix
        • Overview
        • Installation
        • Configuration
        • Test
        • Live payments
      • PrestaShop
        • Overview
        • Installation
        • Configuration
        • Test
        • Live payments
      • OpenCart
        • Overview
        • Installation
        • Configuration
        • Test
        • Live payments
    • Installment
      • Overview
      • Status
        • Application Status
        • Application Callback Status
        • Application Change Status
      • Get partners
      • Create application
    • Redirect back
      POST
    • Result notify
      POST
    • Payout notify
      POST
    • Check request
      POST
  • Partner API
    • Rates
      • Overview
      • Rates
    • Products
      • Overview
      • Dictionaries
      • Add client with product
      • Client request status
      • Create terminal
      • Update terminal limits
      • Product request status
    • E-Money
      • Overview
      • Add
      • Owner identification
      • Info
      • Close
      • Block
      • Balance
      • Statement
      • Request Status
    • Device ID
      • Android SDK
      • iOS SDK
    • Implement SuperApp
      • Overview
      • Pay
      • Refund
      • Status
    • Account
      • Overview
      • Create payment
      • Payment status
      • Batch statuses
      • Statement
      • Statement status
      • Balance
      • Balance status
    • Invoices
      • Info
  1. Purchase

Create payment with a payment page template

KZ
https://api.freedompay.kz
KZ
https://api.freedompay.kz
POST
https://api.freedompay.kz
/init_payment
Creates a payment on a payment page made by a template and returns the link to it: pg_redirect_url. Redirect the client to it: the client pays by bank card, Apple Pay or Google Pay, as connected for the merchant.
The template is enabled for the merchant by your account manager or set in the request by pg_template. If the template is enabled for the merchant, pg_template can be omitted; a value passed in the request takes priority.
An unknown pg_template value is ignored: the template enabled for the merchant is used, or, if there is none, the payment opens on the standard payment page, see Create payment.
The result of the payment comes to pg_result_url, see Result notify. After the payment the client is returned to pg_success_url or pg_failure_url, see Redirect back.
If the payment result is not received, get it with Get payment status.
Parameters without the pg_ prefix are passed back to pg_check_url and pg_result_url unchanged. Give them unique names that do not start with pg_.
If the payment system declines the payment, the client can pay again on the same page: see «Repeated payment attempts» below.
pg_payment_method and pg_timeout_after_payment are not used with a template.
The template takes priority over the payment frame: with a template, pg_payment_route is ignored.
Test cards: see Merchant API Overview.

Payment page flow#

Repeated payment attempts#

If the payment system declines the payment, the payment is not closed. The client sees the error and can pay again on the same page, with the same or another card.
The number of attempts is limited only by pg_lifetime. All attempts belong to one payment with the same pg_payment_id.
Between attempts Get payment status returns pg_payment_status = waiting without the decline code of the attempt.
Only the final result comes to pg_result_url: pg_result = 1 after an approved attempt, or pg_result = 0 when pg_lifetime expires without one.

Recurring payments#

Recurring payments are repeat payments where a recurring profile is created during the first payment. Subsequent payments are made according to this profile.
To create a profile, the following parameters are passed in init_payment: pg_recurring_start — profile creation, pg_recurring_lifetime — validity period. If pg_recurring_lifetime exceeds the card's expiration date, the profile remains active until the card expires.
The profile number (pg_recurring_profile_id) is passed in the Result URL. It is also supported for Apple Pay and Google Pay.
For connection, please contact the manager.

Result#

pg_statusMeaningNext step
okThe payment is created.Redirect the client to pg_redirect_url and wait for the result at pg_result_url.
errorThe request is rejected.See «Errors» below.

Errors#

The HTTP status is always 200; the error is returned in pg_error_code and pg_error_description. Error responses are not signed.
See Error codes.

Request example#

Required fields only. pg_sig is calculated with the secret key test_secret_key.
Line breaks in the body are added for readability: send the body as one line.

Request

Body Params multipart/form-data

Responses

🟢200Success
application/xml
Bodyapplication/xml

Examples
<?xml version="1.0" encoding="utf-8"?>
<response>
    <pg_status>ok</pg_status>
    <pg_payment_id>1022123803917</pg_payment_id>
    <pg_redirect_url>https://customer.freedompay.kz/main/pay.html?customer=01a164ec-1fcd-7321-95c4-c3ba5c4fa0e2</pg_redirect_url>
    <pg_redirect_url_type>payment system</pg_redirect_url_type>
    <pg_salt>ijqWYTNu6P5q4HSb</pg_salt>
    <pg_sig>a33f72fe861d8c9b0d0b801f6ac17b09</pg_sig>
</response>
🟢200Error
Previous
Get payment status
Next
Create payment in a payment frame