# Pending Actions
Pending actions are a generic mechanism for notifying individuals of required actions that need to be taken. All types of pending actions are consent flows, with some types being subject to expiration.
# Retrieving pending actions
Pending actions are accessible from GET /v3/pending_actions
and GET /v3/pending_actions/:id
.
Example response for retrieving a list of all pending actions:
GET /v3/pending_actions
Content-Type: application/json
Authorization: Bearer <access_token>
Response:
{
"data": [
{
"id": "d22e6434-b503-4066-9f7f-83b47b191639",
"type": "AuthenticateCardOperation",
"description": "Please authenticate your payment",
"payload": {
"individual_id": "861d020e-7f30-4e6c-a40d-7a5a64ffccd9",
"consent_id": "cd221b0f-acdf-4942-8c47-36cd86b50e25"
},
expires_at: "2022-07-29T13:12:45.000Z",
created_at: "2022-07-29T13:12:30.000Z"
}
]
}
As can be seen in the example response, a pending action has a type
, description
and a payload
object. The description
must be displayed as part of the prompt or notification to the user. The individual_id
in the payload object denotes the ID of the individual that the action is required from.
Before displaying a pending action to the user, consent must first be requested from the Consent API endpoint POST /v3/consents/:id
, using the consent_id
from the payload object. The user should be then redirected to the consent view available at the the redirect_url
from the requested consent response.
As previously stated, a pending action may have an expiry date. The expires_at
field will be null
in the case of no expiration. Furthermore, the list of pending actions can be filtered using the query parameters individual_id
, event_id
and completed
.
# Pending actions from events and webhooks
When a new pending action is instantiated in the system, a PendingActionCreated
event is dispatched. When a user completes the consent flow of a pending action, a PendingActionCompleted
event is dispatched. The events are accessible from the Event API and by webhooks.
Example PendingActionCreated
event webhook payload:
{
"id": "927bf478-e246-477f-b3ef-dfa4b806a640",
"name": "PendingActionCreated",
"created_at: "2022-07-29T13:12:30.500Z"
}
The id
of the event can be used to query the pending action associated with the event. Two different approaches can be used to accomplish this:
- Querying
GET /v3/pending_actions
using theevent_id
query parameter - Accessing the payload of the event using the Event API endpoint
GET /v3/events/:id
, and then using theindividual_id
from the payload object in the response to queryGET /v3/pending_actions
using theindividual_id
query parameter
Note that the second approach is suboptimal to the first approach and requires an additional request.
Example of the first approach using the event_id
query parameter:
GET /v3/pending_actions?event_id=927bf478-e246-477f-b3ef-dfa4b806a640
Content-Type: application/json
Authorization: Bearer <access_token>
Response:
{
"data": [
{
"id": "d22e6434-b503-4066-9f7f-83b47b191639",
"type": "AuthenticateCardOperation",
"description": "Please authenticate your payment",
"payload": {
"individual_id": "861d020e-7f30-4e6c-a40d-7a5a64ffccd9",
"consent_id": "cd221b0f-acdf-4942-8c47-36cd86b50e25"
},
expires_at: "2022-07-29T13:12:45.000Z",
created_at: "2022-07-29T13:12:30.000Z"
}
]
}
← Events Customization →