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

Cancel payment

KZ
https://api.freedompay.kz
KZ
https://api.freedompay.kz
POST
https://api.freedompay.kz
/cancel
Cancels a successful payment in full.
For a two-step payment that is not captured yet (pg_auto_clearing = 0), the blocked amount is released to the client.
For a captured payment (one-step, or two-step after the full clearing), the full amount is refunded. To refund a part of the amount, use Refund payment.
After a partial clearing the payment cannot be cancelled: refund the captured amount with Refund payment.
The response comes in two forms: the cancel was performed or declined (pg_cancel_payment_id, signed), or the request was rejected (pg_error_code, not signed). See «Errors» below.
Test cards: see Merchant API Overview.

Cancel flow#

Result#

pg_statusMeaningNext step
okThe payment is cancelled: the amount is released or refunded to the client.—
error with pg_failure_codeThe cancel is declined.See «Errors» below.
error with pg_error_codeThe request is rejected.See «Errors» below.

Errors#

The HTTP status is always 200. A declined cancel returns pg_failure_code and pg_failure_description in a signed response with pg_cancel_payment_id; a rejected request returns pg_error_code and pg_error_description in a response that is not signed.
CodeFieldWhenWhat to do
94031pg_error_codeA parameter is missing or invalid, or a payment with this pg_payment_id does not exist.Fix the request.
1100pg_error_codeThe signature is missing or invalid.Check the signature: see Merchant API Overview.
340pg_error_codeThe payment belongs to another merchant.Check pg_payment_id and pg_merchant_id.
9994pg_error_codeCancelling is disabled in the merchant settings.Contact Freedom Pay.
91021, 91031pg_error_codeA refund or a cancel of this payment is already being processed.Wait for the result and check the payment with Get payment status.
10033pg_failure_codeThe payment has already been cancelled.Do not repeat the call.
90131pg_failure_codeThe payment is not successful: there is nothing to cancel.—
900811pg_failure_codeThe amount cannot be refunded in full, for example after a partial clearing.Use Refund payment with the amount.
Other codespg_failure_codeThe payment system declined the cancel.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_cancel_payment_id>1023122203626</pg_cancel_payment_id>
    <pg_salt>H4MZ6LcXQdxmYsE5</pg_salt>
    <pg_sig>ac7cd93dbdea37afd0ddb5a0c8d52ee9</pg_sig>
</response>
🟢200Error
Previous
Create recurring payment
Next
Capture payment (clearing)