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 for payouts

KZ
https://api.freedompay.kz
KZ
https://api.freedompay.kz
POST
https://api.freedompay.kz
/v1/merchant/{merchant_id}/cardstoragepayout/add
Creates a page on which the client enters the card number, and returns its URL pg_redirect_url. Redirect the client to it.
The card is saved for payouts only: pass its token pg_card_token in Pay out to card token. It cannot be used for payments.
The page asks only for the card number. No money is blocked on the card.
The result comes to pg_post_link in both cases: the card is saved or not. After a successful saving the client returns to pg_back_link.
Available after Freedom Pay enables it for the merchant: contact your account manager.
To see and delete saved cards, use Get saved cards and Delete saved card: payout cards have pg_is_full = 0 there.

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_bankIssuing bank.
pg_countryCountry of the issuing bank.
pg_statussuccess — the card is saved, error — the card is not saved.
pg_user_idpg_user_id from the request.
pg_typeadd_payout_card.
pg_card_tokenCard token for Pay out to card token. Only if pg_status = success.
pg_card_idCard ID. Deprecated: use pg_card_token. Only if pg_status = success.
pg_error_code, pg_error_descriptionError code and text. Only if pg_status = error.
pg_saltRandom string.
pg_sigSignature.
<?xml version="1.0" encoding="utf-8"?>
<response>
    <pg_payment_id>789</pg_payment_id>
    <pg_order_id></pg_order_id>
    <pg_card_hash>4939-77XX-XXXX-4989</pg_card_hash>
    <pg_bank>UNKNOWN</pg_bank>
    <pg_country></pg_country>
    <pg_status>success</pg_status>
    <pg_user_id>loc-user-po</pg_user_id>
    <pg_type>add_payout_card</pg_type>
    <pg_card_token>e7867978-8062-4a88-9235-a453e39bcbd2</pg_card_token>
    <pg_card_id>108</pg_card_id>
    <pg_salt>LvljjGrT</pg_salt>
    <pg_sig>f9df4383080f0b1258e5a40db1fc3600</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.

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>1023122203682</pg_payment_id>
    <pg_merchant_id>13991</pg_merchant_id>
    <pg_order_id></pg_order_id>
    <pg_redirect_url>https://customer-regress.freedom-pay.dev/v1/merchant/13991/cardstoragepayout/view?pg_payment_id=01a16a31-7b0b-716d-9c5c-33721a2d53d5</pg_redirect_url>
    <pg_status>ok</pg_status>
    <pg_type>init</pg_type>
    <pg_salt>Ms996Nlg</pg_salt>
    <pg_sig>331bdb4fda4f368bc01fc936b1e91f23</pg_sig>
</response>
🟢200Error
🟠401Unauthorized
Previous
Save card
Next
Delete saved card