Loon API Overview

About 30% of the issued payment cards globally are re-issued every year due to account closures, cards reported lost or stolen, expiration date changes, product upgrades, and fraud. Each time a customer replaces their card, you’re left with outdated stored card information in your vault. This can lead to checkout friction, declined transactions, and ultimately, customer churn.

Loon is an account lifecycle management service for card-on-file (COF) account information. Through a single API integration, you can securely update your customers’ payment card account information in a timely and efficient manner. At this time, Loon provides account updater support for Visa, Amex, and Discover, with Mastercard coming soon.

This guide outlines the following Loon processes, from registration to receiving your first update and beyond:

  1. Request access to Loon.
  2. Register your business with the card brands.
  3. Authenticate with Loon.
  4. Set up webhooks to receive updates.
  5. Register encryption keys to send data securely.
  6. Prepare your data to be sent to Loon.
  7. Submit update inquiries for your cards on file
  8. Check the status of a specific update request
  9. Call Loon for your updated card details
  10. (Coming soon) Optionally send updates via Secure File Transfer Protocol (SFTP)


Loon Testing

Check out our Loon Testing guide to learn more about testing in the Loon Sandbox.

Request Access

Complete our registration form if you’re interested in Loon. Once onboarded, you'll have access to our Loon Service Panel.

Register With Card Brands

Before you can start requesting and receiving updated card details from the card brands , Pagos must first register your business with Visa, Mastercard, Amex, and Discover individually. Pagos will work with you directly to collect the necessary business details and complete this registration process. This process is mandatory and required by each card brand.

You can check the status of your enrollment on the Card Brand page in your Loon Service Panel.


To ensure only authorized entities can access our services, we authenticate the identity of each client that submits requests to Loon services. Learn more in our Loon Authentication guide.

To locate your API keys in the Loon Service Panel:

  1. Log into your Loon account.
  2. Click the Developers in the main navigation.
  3. Click Create API Key.
  4. Save the Client Key and Private Key in your secure place for future reference.



This is the only time you can view this Private Key.

You can navigate to the Manage API Keys page at any time to review, add, or deactivate API keys as needed.

Set Up Webhooks

Webhooks are a system of automated notifications that push information to your designated destination when important events occur. They’re essential for receiving notifications such as account updates or errors that occur in your Loon updater job.

To create a webhook:

  1. Click Developers in the main navigation.
  2. Click the Webhooks tab.
  3. Click Add Webhook.
  4. Create a Name for the webhook and input your webhook endpoint URL. This webhook will be marked as active by default; click the Active checkbox to deactivate it if preferred.
  5. Click Save.

You can navigate to the Webhooks page at any time to review and edit existing webhooks, or add new webhooks as needed.

Webhook Types

You will receive the following types of webhook notifications from Loon when a job status changes:

  • Job Created
  • Job Complete
  • Job Failed - This notification will always include one of the following values in the reason field:
    • validation_failed
    • invalid_format
    • internal_import_error
  • Job Status Changed
  • Network Unprocessable - This notification identifies which card brand was inaccessable at the time the job was run
  • Network Processed - This notification identifies which card brand was successfully processed

Register Encryption Keys

Regardless of how you send a file of primary account numbers (PANs) to Loon for updates, you must first encrypt that file. Loon will similarly encrypt any file we transfer back to you. For Loon to send you an encrypted file with your updates, you’ll need to first register your encryption keys with Loon. To do so:

  1. Click Developers in the main navigation.
  2. Click the PGP Keys tab.
  3. Click Add PGP key.
  4. Add a Label and your public key.
  5. Click Save.

You can navigate to the PGP Keys page at any time to review and manage existing PGP keys, or add new keys as needed.



Once you're registered with Loon, Pagos will send our public key to you directly for use with any file(s) you intend to transfer to Loon.

Prepare Your Data

After you encrypt your file of PANs, fetch and prepare your data to be sent to Loon securely. To do so:

  1. Fetch the necessary PAN data from your system that you want to send to Loon for updates.
  2. Save that data in a .csv with the columns as outlined in this example. Keep in mind, sub_merchant_id and metadata are optional.
  3. Encrypt the .csv file using PGP encryption keys established in the Encryption Keys tab.

Submit Cards for Updates

After you've prepared your card data to be transferred, you have the option to send your secure file to Loon in one of two different ways: via the API or by Secure File Transfer Protocol (SFTP).

If you are sending your job file via the API, post the job file to the /inquiries/jobs API endpoint. After doing so, you’ll receive a job ID in response.

If you’re sending the file via SFTP, upload your job to the designated SFTP endpoint and receive a webhook notification containing the job Id as a reference. More information on this process is coming soon.

Check the Status of an Inquiry

After your inquiry has been submitted, you can poll the status of your job at any time by calling the /inquiries/jobs/{JobId} endpoint and specifying the respective job id. Possible status responses include:

  • Pending - Your job was successfully received
  • Processing - Your job is processing
  • Processed - Your job is complete and your updates are available
  • Error - There was an issue receiving and processing your job. The possible errors include:
    • file_format_error - There is an error in the file's formatting
    • file_decryption_failed - Your file is not encrypted with Pagos' public PGP key, or is corrupted
    • file_validation_network_invalid - Your file contains an invalid value in the network field; the only possible values in this field are visa, mastercard, discover, and american express
    • file_validation_month_invalid - Your file contains an invalid value in the expiry_month field; this value must be in the format of MM
    • file_validation_year_invalid - Your file contains an invalid value in the expiry_year field; this value must be in the format of YYYY
    • file_validation_account_number_invalid - Your file contains an invalid value in the account_number field; this value must be 15-16 digits
    • file_validation_sub_merchant_invalid - Your file contains an invalid value in the optional sub_merchant_id field; this value must be alphanumeric
    • file_validation_metadata_too_big - Your file contains a metadata value that exceeds the length maximum of 50 characters
    • file_uniqueness_check_failed - Your file contains repeated account_numbers

Receive Updated Card Details

After you send a list of PANs to Loon for updates, you'll receive updated card details in waves over the next few days from the card brands, with the responses from each arriving asynchronously.

When the card brands have processed and returned your updates, you’ll receive a webhook notification. Retrieve an encrypted .csv file with your updates by calling the inquiries/jobs/{JobId}/download API.

Network Processed Webhooks

Pagos receives updated PANs from each of the different card brands at different times. Instead of making you wait until all card updates are ready, we’ll push them to you in waves as soon as we process them. Whenever a card brand’s PANs are ready, you’ll receive a network processed webhook notification. This webhook notification alerts you that updates from one card brand—a portion of your overall job—are available to you, and even identifies the card brand that provided the update.

Network processed updates don’t necessarily require any action from you. If you want to retrieve the partial job update after receiving this notification, you can do so. Otherwise, Loon will continue to add all of your updates to the same .csv file until all updates are processed and the job is completed; at that point, you’ll receive a job completed webhook notification and you can retrieve all your updates at once.

(Coming Soon) Send for Updates Via SFTP

With Loon, you'll soon have the ability to send bulk sets of primary account numbers to be updated via SFTP instead of a bulk API call. This feature is optional and coming soon! Check back for more details.

Client Sample

Please refer to the Loon JS example in github for a detailed client sample.