1. Payments
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
      • Payouts
        • Overview
        • Pay out to card
        • Pay out to IBAN
        • Get payout balance
        • Get payout status
      • Transfers
        • 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
        • Save card without a charge
      • Read
        • Get payment status
        • Get request result
      • Edit
        • Capture payment (clearing)
        • Cancel payment (reverse)
        • Refund payment
  • Merchant API
    • Overview
    • Payments
      • Overview
      • Checkout
      • Pay by saved card
        • Overview
        • Create payment
        • Confirm payment with CVC
        • Confirm payment without the client
      • Create payment
        POST
      • Create payment with a payment page template
        POST
      • Create payment in a payment frame
        POST
      • Create payment with any amount
        POST
      • Create recurring payment
        POST
      • Capture payment (clearing)
        POST
      • Cancel payment
        POST
      • Refund payment
        POST
      • Get payment status
        POST
    • Payouts
      • Overview
      • Create payout page
      • Pay out to saved card
      • Pay out to IBAN
      • Get payout status
      • Get payout balance
    • Saved cards
      • Get saved cards
      • Save card
      • Save card for payouts
      • Delete saved card
      • Save card without a charge
    • Mobile balance
      • Overview
      • Create mobile balance payment
      • Charge mobile balance
      • Get mobile balance payment status
      • Confirm payment with SMS code
      • Resend SMS code
    • Invoices
      • Overview
      • Recurring payments
        • Overview
        • Create recurring profile
        • Get recurring profile
        • Charge by recurring profile
        • Cancel recurring profile
        • Recurring profile notification
      • Tips
        • Overview
        • Create
      • Create invoice
      • Get invoice status
      • Get invoice details
      • Cancel invoice
      • Refund invoice
    • SDK
      • JS SDK
      • Merchant SDK
        • 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
      • CS-Cart
        • Overview
        • Installation
        • Configuration
        • Test
        • Live payments
    • Installment
      • Overview
      • Status
        • Get application status
        • Application status notification
        • Change application status
      • Get partners
      • Create application
    • Callbacks
      • Overview
      • Result notify
      • Check request
      • Payout notify
      • Redirect back
  • Partner API
    • Overview
    • 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. Payments

Create payment

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 Freedom Pay payment page: pg_redirect_url. Redirect the client to it: the client chooses the payment method and pays on the page.
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_.
To open the payment on a payment page made by a template, see Create payment with a payment page template. If your account manager enabled a template for the merchant, the payment opens on it even without pg_template.
To embed the bank card form in your page, see Create payment in a payment frame.
The same parameters can be sent from the client's browser to /payment.php with GET or POST: the client goes to the payment page at once. Sign such a request with the script name payment.php; errors are shown to the client as a page.
Test cards: see Merchant API Overview.

Payment page flow#

Recurring payments#

To charge the card later without the client, create a recurring profile with this payment: pass pg_recurring_start = 1, pg_recurring_lifetime (months) and pg_user_id.
After a successful payment the profile ID comes in pg_recurring_profile_id of Result notify. Pass it in Create recurring payment.
If pg_recurring_lifetime ends after the card expiry date, the profile is valid until the card expires.
Works for bank cards, Apple Pay and Google Pay.
Recurring payments are available after Freedom Pay enables them for the merchant: contact your account 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>1022123803884</pg_payment_id>
    <pg_redirect_url>https://customer.freedompay.kz/pay.html?customer=01a164ba-258a-73d8-a674-dbca94c7f165</pg_redirect_url>
    <pg_redirect_url_type>need data</pg_redirect_url_type>
    <pg_salt>30mVYG1WPelmyIT6</pg_salt>
    <pg_sig>31ead9b4469cd81d377685be79fb6e66</pg_sig>
</response>
🟢200Error
Previous
Confirm payment without the client
Next
Create payment with a payment page template