Create a multi-consent
The CreateMultiConsent mutation allows you to combine multiple individual consents for sensitive operations into a single consent. This allows your users to approve several sensitive operations simultaneously, reducing the number of consent prompts and improving their experience. You can merge up to 100 individual consents into a single mutation.
Guide​
- For each sensitive operation the user initiates, retrieve the
consentId. - Confirm that all child consents must have the status
Created. Otherwise, the API returns aConsentsNotAllInCreatedStatusRejectionrejection. - Call the
CreateMultiConsentmutation. - Send the
consentUrlto your user to grant multiple consent. - Your end user now needs to perform Strong Customer Authentication.
All child consents must be from the same user represented by a user access token, or with the same project access token impersonating that user.
Mutation​
Open in API Explorermutation MultipleConsent {
createMultiConsent(
input: {
redirectUrl: "$YOUR_REDIRECT_URL"
orderedConsentIds: [
{ consentId: "$CONSENT_ID_1" }
{ consentId: "$CONSENT_ID_2" }
{ consentId: "$CONSENT_ID_3" }
]
}
) {
... on CreateMultiConsentSuccessPayload {
__typename
consent {
consentUrl
}
}
}
}
Payload​
Make sure to send the consentUrl (line 6) to your user.
{
"data": {
"createMultiConsent": {
"__typename": "CreateMultiConsentSuccessPayload",
"consent": {
"consentUrl": "$YOUR_CONSENT_URL"
}
}
}
}
Choose order of consents​
You can choose the order in which to perform child consents with the order parameter.
The order begins with 0 and continues 1, 2, and so forth.
mutation ChooseOrder {
createMultiConsent(
input: {
orderedConsentIds: [
{ consentId: "$CONSENT_ID_1", order: 1 }
{ consentId: "$CONSENT_ID_2", order: 1 }
{ consentId: "$CONSENT_ID_3", order: 1 }
{ consentId: "$CONSENT_ID_4", order: 1 }
{ consentId: "$CONSENT_ID_5", order: 1 }
{ consentId: "$CONSENT_ID_6", order: 0 }
{ consentId: "$CONSENT_ID_7", order: 2 }
{ consentId: "$CONSENT_ID_8", order: 1 }
{ consentId: "$CONSENT_ID_9", order: 1 }
]
redirectUrl: "$YOUR_REDIRECT_URL"
}
) {
... on CreateMultiConsentSuccessPayload {
__typename
consent {
consentUrl
}
}
... on ConsentsNotAllInCreatedStatusRejection {
__typename
consentIds
message
}
... on ConsentsNotFoundRejection {
__typename
ids
message
}
... on ValidationRejection {
__typename
message
}
... on ConsentsAlreadyLinkedToMultiConsentRejection {
__typename
consentIds
message
}
}
}