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, Mastercard, Discover, and Amex Direct (note that at this time, Loon doesn't support Amex OptBlue).
This guide outlines the following Loon processes, from registration to receiving your first update and beyond. Click on each step to navigate to the associated header in this guide:
- Request access to Loon.
- Register your business with the card brands.
- Authenticate with Loon.
- Set up webhooks to receive updates.
- Register encryption keys to send data securely.
- Prepare your data to be sent to Loon.
- Submit update inquiries for your cards on file
- Check the status of a specific update request
- Call Loon for your updated card details
Loon Testing
Check out our Loon Testing guide to learn more about testing in the Loon Sandbox.
Request Access
Contact us 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.
Authenticating
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:
- Log into your Loon account.
- Click Developers in the main navigation.
- Click Create API Key.
- Save the Client Key and Private Key in your secure place for future reference.
Important
This is the only time you can view this Private Key. Be sure to save it, as you need it to both authenticate and decrypt response files from Loon.
You can navigate to the Developers 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 in your Loon Service Panel:
- Click Developers in the main navigation.
- Click the Webhooks tab.
- Click Add Webhook.
- 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.
- Click Save.
You can navigate to the Webhooks page in your Loon Service Panel at any time to review and edit existing webhooks, or add new webhooks as needed.
Keep in Mind:
- If a single webhook has five consecutive failures, we will set the webhook status to inactive. This only happens if the failures are consecutive (not intermittent)
- If a webhook fails or is set to inactive, navigate to the Webhooks page in your Loon Service Panel to edit and re-enable the webhook
Webhook Types
You will receive the following types of webhook notifications from Loon when a job status changes:
- Job Created - The job was successful. This notification includes a associated
job_id
{
"type": "wh_job_created",
"data": {
"job_id": 98765,
"timestamp": "2023-11-16T20:15:45.678Z"
}
}
- Job Complete - The job was successful
{
"type": "wh_job_completed",
"data": {
"job_id": 98765,
"timestamp": "2023-11-16T23:15:45.678Z"
}
}
- Job Failed - The job wasn't successful. Learn more about this webhook in our Loon Error Handling guide.
- Job Status Changed - The job's status has changed (e.g.
InProgress
)
{
"type": "wh_job_status_changed",
"data": {
"id": 12345,
"status": "InProgress",
"timestamp": "2023-11-16T21:00:30.123Z"
}
}
- Network Unprocessable - This notification identifies which card brand was inaccessible at the time the job was run
{
"type": "wh_network_unprocessable",
"data": {
"job_id": 54321,
"network": "SampleNetwork",
"cards_amount": 10,
"timestamp": "2023-11-16T19:30:15.789Z"
}
}
- Network Processed - This notification identifies which card brand was successfully processed
{
"type": "wh_network_processed",
"data": {
"network": "visa",
"job_id": 12345,
"timestamp": "2023-11-16T12:34:56.789Z"
}
}
Register Encryption Keys
Before you submit 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:
- Click Developers in the main navigation.
- Click the PGP Keys tab.
- Click Add PGP key.
- Add a Label and your public key.
- 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.
PGP Key Pairs
Loon requires two different PGP Key pairs, and each pair is comprised of a public and private key:
- Loon’s PGP Key Pair: Once you're registered with Loon, we'll send you Loon's public key directly, which you'll use to encrypt your request file before sending it to Loon. Loon uses its own private key to decrypt the file.
- Your PGP Key Pair: When you register your encryption keys, you upload your public key to Loon’s web portal; Loon uses it to encrypt the response file before making it available for download. You'll use your private key to decrypt Loon’s response file.
Prepare Your Data
To fetch and prepare your data to be sent to Loon securely:
- Fetch the necessary PAN data from your system that you want to send to Loon for updates.
- Save that data in a .csv with the columns as outlined in this example. Keep in mind,
metadata
is optional. Each card brand validates thesub_merchant_id
field differently, so keep the following details in mind when preparing the .csv:- For Visa, American Express, and Discover, the field is optional; it can contain any string value 1-12 characters in length or be
null
- For Mastercard, the field can either be
null
or a valid 15 charactersub_merchant_id
issued by Mastercard
- For Visa, American Express, and Discover, the field is optional; it can contain any string value 1-12 characters in length or be
- 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 via the API. To do so, post the job file to the /inquiries/jobs API endpoint. If the request was successful, you'll receive an HTTP 200 OK status response along with a job ID; if the request fails, you'll receive the corresponding generic API error code.
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. Learn more in our Loon Error Handling guide.
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.
Note
Encrypted .csv response files will be available for download for 90 days from the time the response file is created. The system will automatically purge after this time.
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.
Client Sample
Please refer to the Loon JS example in github for a detailed client sample.