1. Saved cards
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
      • 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
      • Cancel payment
      • Capture payment (clearing)
      • Refund payment
      • Get payment status
    • Payout
      • Overview
      • Create payment
      • IBAN
      • Balance status
      • Create payment
      • 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
    • Saved cards
      • Get saved cards
        POST
      • Save card
        POST
      • Save card for payouts
        POST
      • Delete saved card
        POST
      • Save card without a charge
        POST
    • 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. Saved cards

Save card without a charge

KZ
https://api.freedompay.kz
KZ
https://api.freedompay.kz
POST
https://api.freedompay.kz
/v1/merchant/{merchant_id}/cardstorage/add2
Creates a page on which the client enters the card data, and returns its URL pg_redirect_url. Redirect the client to it.
The card is checked without blocking money on it.
After the card is saved, the client returns to pg_back_link, and the card token pg_card_token comes to pg_post_link.
No recurring profile is created: to charge the card without the client, use Create payment and Confirm payment without the client.
With pg_template = tips the page also asks for the recipient's personal data: this is used to save the card of a tips recipient.
Up to 10 saved cards per pg_user_id. To see and delete them, use Get saved cards and Delete saved card.
Test cards: see Merchant API Overview.

Card saving flow#

Notification to pg_post_link#

The notification is sent as POST with one form field pg_xml that contains the XML below.
It is signed: the script name for the signature is the last part of the pg_post_link path.
FieldDescription
pg_payment_idID of the card saving operation.
pg_order_idpg_order_id from the request.
pg_card_hashMasked card number.
pg_card_monthCard expiry month.
pg_card_yearCard expiry year, 2 digits.
pg_bankIssuing bank.
pg_countryCountry of the issuing bank.
pg_card_3ds1 — the client passed 3DS, 0 — without 3DS.
pg_statussuccess — the card is saved.
pg_card_idCard ID. Deprecated: use pg_card_token.
pg_card_tokenCard token: pass it in Create payment.
pg_user_idpg_user_id from the request.
pg_typeapprove.
brand_alias, bank_aliasCard brand and bank. Only with pg_extend_data = 1.
pg_card_holderCardholder name. Only if enabled for the merchant.
pg_saltRandom string.
pg_sigSignature.
<?xml version="1.0" encoding="utf-8"?>
<response>
    <pg_payment_id>1023122203687</pg_payment_id>
    <pg_order_id>ct2-add2</pg_order_id>
    <pg_card_hash>4716-04XX-XXXX-1981</pg_card_hash>
    <pg_card_month>12</pg_card_month>
    <pg_card_year>30</pg_card_year>
    <pg_bank>innforunionpaycardnetwork</pg_bank>
    <pg_country>CN</pg_country>
    <pg_card_3ds>0</pg_card_3ds>
    <pg_status>success</pg_status>
    <pg_card_id>322</pg_card_id>
    <pg_card_token>fbf5aa8b-3780-47f8-809a-e61a94c69b47</pg_card_token>
    <pg_user_id>ct-user-2</pg_user_id>
    <pg_recurring_profile_id></pg_recurring_profile_id>
    <pg_type>approve</pg_type>
    <pg_salt>YERmq2i0</pg_salt>
    <pg_sig>c715adf1232cc395ebe969354bc496b5</pg_sig>
</response>

Result#

ResponseMeaningNext step
pg_status = okThe card saving page is created.Redirect the client to pg_redirect_url.
pg_status = errorThe request is rejected.See «Errors» below.
If the card is not saved (for example, the payment system declined the check), the client is redirected to the failure URL from the merchant settings with pg_failure_code and pg_failure_description, and no notification is sent.

Errors#

The error is returned in pg_error_code and pg_error_description; the HTTP status depends on the error. Error responses are not signed.
HTTPpg_error_codeWhenWhat to do
2000A parameter is missing or invalid: pg_error_description names it.Fix the request.
4011100The signature is missing or invalid.Check the signature: see Merchant API Overview.
2001826The client already has 10 saved cards.Delete a card with Delete saved card.

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

Path Params

Body Params multipart/form-data

Responses

🟢200Success
application/xml
Bodyapplication/xml

Example
<?xml version="1.0" encoding="utf-8"?>
<response>
    <pg_payment_id>1023122203687</pg_payment_id>
    <pg_merchant_id>13991</pg_merchant_id>
    <pg_order_id>ct2-add2</pg_order_id>
    <pg_redirect_url>https://customer-regress.freedom-pay.dev/v1/merchant/13991/cardstorage/view?pg_payment_id=01a173c7-1d44-73a2-8e90-32bdca42e1bd</pg_redirect_url>
    <pg_status>ok</pg_status>
    <pg_type>init</pg_type>
    <pg_salt>6Xaom9Ku</pg_salt>
    <pg_sig>f7b340510666af7d9f827e9b6dcb4637</pg_sig>
</response>
🟢200Error
🟠401Unauthorized
Previous
Delete saved card
Next
Redirect back