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 in a payment frame

KZ
https://api.freedompay.kz
KZ
https://api.freedompay.kz
POST
https://api.freedompay.kz
/init_payment
Creates a payment and returns the link to the payment frame: pg_redirect_url. Show it in an iframe on your page: the frame contains the bank card form, the client pays without leaving your page.
The payment frame is available after Freedom Pay enables it for the merchant: contact your account manager. If it is not enabled, pg_payment_route is ignored and the payment opens on the standard payment page, see Create payment.
The look of the frame (colours, font, Apple Pay and Google Pay buttons, phone and email fields) is set for the merchant by Freedom Pay: contact your account manager.
If a template is enabled for the merchant or pg_template is passed, the payment opens on the template page, not in the frame, see Create payment with a payment page template.
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 «Return of the client» below.
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_.
The frame accepts only card numbers that pass the Luhn check. Test cards for the frame: 4111111111111111 — success without 3DS, 4916307416334310 — success with 3DS, 5335215945367703 — declined.
pg_payment_method and pg_timeout_after_payment are not used in the frame.

Payment frame flow#

Return of the client#

After a successful payment the client is returned to pg_success_url with pg_order_id, pg_payment_id, pg_salt and pg_sig. pg_sig is calculated with the script name equal to the last segment of the pg_success_url path.
After a declined payment the client is returned to pg_failure_url with pg_order_id, pg_failure_code, pg_failure_description and your parameters without the pg_ prefix. These parameters are not signed: confirm the result with pg_result_url or Get payment status.
If pg_success_url or pg_failure_url is not passed, the URL from the merchant settings is used. If there is none, the result is shown in the frame.
A declined payment is closed: to let the client pay again, create a new payment.
The HTTP method of the return is set by pg_success_url_method and pg_failure_url_method.

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.Show pg_redirect_url in an iframe 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

Example
<?xml version="1.0" encoding="utf-8"?>
<response>
    <pg_status>ok</pg_status>
    <pg_payment_id>1023122203573</pg_payment_id>
    <pg_redirect_url>https://customer.freedompay.kz/v1/merchant/12345/card/payment?pg_payment_id=01a169e4-0f7d-72be-b225-19fed7fcfcba</pg_redirect_url>
    <pg_redirect_url_type>need data</pg_redirect_url_type>
    <pg_salt>qDuCuUT8UKAL6DXB</pg_salt>
    <pg_sig>a4951edf295f6b664383575f0f6ddddf</pg_sig>
</response>
🟢200Error
Previous
Create payment with a payment page template
Next
Overview