1. Callbacks
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
      • Create payment with a payment page template
      • Create payment in a payment frame
      • Create payment with any amount
      • Create recurring payment
      • Capture payment (clearing)
      • Cancel payment
      • Refund payment
      • Get payment status
    • 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
        POST
      • Check request
        POST
      • Payout notify
        POST
      • Redirect back
        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. Callbacks

Overview

Callbacks are requests from Freedom Pay to your server: they report the result of a payment or a payout, or ask whether an order can be paid.
You pass the URLs in the payment request (pg_result_url, pg_check_url, pg_success_url, pg_failure_url) or set them in the merchant settings: a URL from the request takes priority.
For payouts, pass pg_post_link in every payout request.
All callbacks are signed by the same rules as the requests: see «Signature» in Merchant API Overview.

Callbacks#

CallbackURLWhenSigned withDelivered whenRetries
Result notifypg_result_urlThe payment is final: successful or failed.payment secret keyHTTP 2xxafter 15 min, then twice every 30 min
Check requestpg_check_urlBefore the money is charged, only if Freedom Pay enabled the check.payment secret key—no
Redirect backpg_success_url, pg_failure_urlThe browser of the client returns to your site after the payment.payment secret key, depends on the payment page—no
Payout notifypg_post_linkThe payout is final: successful or failed.payout secret keyHTTP 200 or <pg_status>ok</pg_status>about every 4 min, 3 attempts in total
Card saving notificationpg_post_link of Save card, Save card without a charge, Save card for payoutsThe card is saved (for payouts: saved or not).payment secret key—no: sent once
 Notifications in JSON with a JWS signature are described on their own pages:
Invoice recurring profiles: Notify.
Installment applications: Application status notification, not available yet.

Method and format#

Result notify and Check request use the method pg_request_method of the payment request, or the method from the merchant settings, POST by default:
POST: the fields in the body, application/x-www-form-urlencoded.
GET: the fields in the query string.
XML: POST with one field pg_xml, an XML document with the root request.
Payout notify is always POST with one field pg_xml, an XML document with the root response.
Redirect back is a redirect of the browser of the client: GET or a form submitted by the browser.
Freedom Pay waits for the answer for 30 seconds.

Signature check#

The signature is pg_sig, the random string is pg_salt: see «Signature» in Merchant API Overview.
The script name is the last segment of the path of your URL: https://merchant.example.com/payment/result → result. A URL ending with / gives an empty script name.
Take all the fields that you received, except pg_sig, including your own parameters and the parameters of the query string of your URL.
Callbacks may get new fields: do not reject a callback because of a field that you do not know.

Rules for your server#

The URLs must be public: without authorization, reachable from the internet.
Check the signature, then the order: pg_order_id, the amount and the currency.
The same callback can come more than once: process it by pg_payment_id only once, and give the same answer.
Answer quickly: do the long work after the answer.
If a callback does not come, request the status: Get payment status for payments, Get payout status for payouts.
Previous
Create application
Next
Result notify