Card Switch Events

The CARD SWITCH webhook event type provides real-time notifications related to card switch activities within the Sunlight Connect SDK. This event type includes two specific events:

  • CARD_UPDATED
  • CARD_UPDATE_FAILED

CARD_UPDATED

The CARD_UPDATED event is triggered when a card is successfully saved as the new card-on-file in a service. This event provides essential details about the successful card update:

{
  "event": "CARD_UPDATED",
  "description": "card updated successfully",
  "data": {
    "service_id": "6dae3736a9e8-527d-4e9f-8b5a-6dff6ff3",
    "service_name": "aws",
    "user_external_id": "417b2e5495ba-6b65-4181-8fef-bcad13cc",
    "card_id": "visa1",
    "last_four_digits": "8949",
    "update_time": "2022-05-12 14:23:11.804474"
  }
}

CARD_UPDATE_FAILED

The CARD_UPDATE_FAILED event is triggered when there is a failed attempt to save a card as the new card-on-file in a service. This event provides information about the reason for the failure:

{
  "event": "CARD_UPDATE_FAILED",
  "description": "Card Not Accepted",
  "data": {
    "service_id": "jd52c1fe-ce07-4bc5-a010-eb090f533e01",
    "service_name": "Netflix",
    "user_external_id": "6daccd23-33fc-4ff4-aca3-722aec1d88e4",
    "card_id": "visa1",
    "last_four_digits": "9299",
    "update_time": "2023-01-29 08:07:23.279"
 }
}

The description field provides information on why the card update attempt failed. Here are the potential reasons:

DescriptionPotential reasons
Card Not Accepted- Card expired
- Card is the merchant's sandbox list
- Merchant marked the card as fraudulent
No Card-On-File- A merchant requires a some preconditions from the user before adding a card
No Permission- Connected account doesn't have permissions to set a new card
Undetermined- Additional account verification is needed
- Merchant flagged or blocked the account
- Internal error