Cancelling a Benefit
Use cancelBenefit to close a Benefit that should no longer be offered, for example a Benefit created by mistake. Cancellation cannot be undone.
When you cancel a Benefit:
- Every Individual enrolled in it is unenrolled.
- The Benefit is closed to new enrollment and funding. Later
fundBenefitForIndividualcalls for it returnBadRequestError. - If the Benefit belongs to an Organization with Divisions, the Benefit is cancelled for every Division too. The Divisions' members are unenrolled after the call returns.
- Funds already in Individuals' accounts are not reversed.
Before you cancel, reverse any fundings that you need to undo. See Reversing a funding. After cancellation, the Individuals' accounts for the Benefit no longer appear in the Partner API, so you cannot look up their transactions there.
Cancel a Benefit
Pass the parent Organization's Benefit id. A Division's Benefit id is rejected.
mutation CancelBenefit($input: CancelBenefitInput!) {
cancelBenefit(input: $input) {
... on CancelBenefitResult {
benefit {
id
name
}
}
... on BadRequestError {
code
message
}
}
}
{
"input": {
"benefitId": "<benefitId>",
"idempotencyKey": "<your unique key>"
}
}
idempotencyKey is required. A repeated call with the same key, the same input and the same selected fields returns the first result and does not cancel again. Reusing a key with different input or different selected fields returns a top-level error. Use a new key only for a different request.
Confirm the cancellation
The Benefit type has no status field, and benefit(where: { id }) still returns a cancelled Benefit. To confirm that a Benefit is cancelled:
- It no longer appears in the
benefitsof its BenefitsProgram. - Its accounts no longer appear in the Individuals'
healthWallet.
Errors
cancelBenefit returns BadRequestError with one of these codes:
code | Meaning |
|---|---|
NOT_FOUND | No Benefit of yours has this benefitId. |
BAD_REQUEST | The Benefit belongs to a Division, it is already cancelled, or it is terminated. The message says which. |
If the call returns a top-level GraphQL error instead, check whether the Benefit is cancelled, as described in Confirm the cancellation. If it is, contact [email protected] so that First Dollar can complete the cancellation. Repeating the call does not complete it.