Multiple consent
This feature enables you to group multiple consents for sensitive operations into one. It's obvious why this is great for your user experience; an end-user can consent to adding a card, adding an account membership, and initiating a credit transfer, all at once!
For each sensitive operation the user initiates, you will need to retrieve the
consentId.
And then you will call the CreateMultiConsent
mutation. All child consents must be from the same user, represented by the user access token. Just like when you handle a basic consent, you will need to forward the
consentUrl
to your end-user to grant multiple consent. Request
Response
mutation MyMutation {
createMultiConsent(
input: {
redirectUrl: "{{YOUR_REDIRECT_URL}}"
orderedConsentIds: [{ consentId: "{{CONSENT_ID_#1}}" },
{ consentId: "{{CONSENT_ID_#2}}" },
{ consentId: "{{CONSENT_ID_#3}}" },
]
}
) {
... on CreateMultiConsentSuccessPayload {
__typename
consent {
consentUrl
}
}
}
}
{
"data": {
"createMultiConsent": {
"__typename": "CreateMultiConsentSuccessPayload",
"consent": {
"consentUrl": "{{YOUR_CONSENT_URL}}"
}
}
}
}
As granting a multiple consent is an asynchronous operation, you will be able to group up to 100 child consents for one sole user.
When the consent is granted, the consent status becomes
OperationComitting
; the child consents are not immediately processed. As soon as the consent status becomes
OperationComitting
, the end-user is informed their multi-consent is Done. Since execution is asynchronous, we suggest you subscribe to consent webhooks so you can keep your user updated on the progress of the execution of each child consent. If any child consent fails, the status of the multi-consent is set to
Failed
. Any child consents which were executed before this failure remain in accepted
status and those which are still to be executed are canceled. If any of the child consents is not in
Created
status, we return a rejection called ConsentsNotAllInCreatedStatusRejection
.You can choose the order of execution for child consents by using the
order
parameter. Below you'll find an example: first, any child consents with the order 0 will executed, following by those with order 1, and so on.Request
Response
mutation MyMutation {
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
}
}
}
{
"data": {
"createMultiConsent": {
"__typename": "CreateMultiConsentSuccessPayload",
"consent": {
"consentUrl": "{{YOUR_CONSENT_URL}}"
}
}
}
}
Last modified 5mo ago