> ## Documentation Index
> Fetch the complete documentation index at: https://docs.m1amdocs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Existing user accepts invitation

This use case is similar to the "[New user accepts invite](c_useCaseAcceptInviteNewUser)" scenario. One user invites another user to share access to one of their associated accounts or services. The client application for the service uses the [Share Access to an Account/Subscription/Feature](c_shareAccessASF) Process. At the end of that Process, Storefront Gateway sends an invitation to the invitee's email or mobile number (whichever the inviting user provided to the previous Process). The invitee then uses that link to redirect to the application, and explicitly accepts the invitation.

In this scenario, the invitee is already an existing (i.e., fully onboarded and activated) Storefront Gateway User.

<img src="https://mintcdn.com/amdocs-spbu/0TZ9XF1Mst_2ATcV/marketONE/sgProcessGuide/images/sfgw_umlAcceptDeclineExisting.png?fit=max&auto=format&n=0TZ9XF1Mst_2ATcV&q=85&s=55cab206a3c1f9fabbda21d0e1c8b84b" alt="" width="687" height="824" data-path="marketONE/sgProcessGuide/images/sfgw_umlAcceptDeclineExisting.png" />

## Initial Request

The invitee clicks the invitation link, which then redirects them back to a dedicated landing page in your application. Your client takes the action token value directly from the redirect URL, and calls the [Session Token](c_sessionToken) API with the token value as a URL parameter. This initializes the Process:

```
**GET https://\{your.url\}/session/token?value=681e508b-aa16-48db-a9f7-3d58d464e7c3**
<no body>
```

## Response: Accept or Decline

Storefront Gateway responds with a prompt for the user to explicitly accept or decline the invitation:

```
**RESPONSE - body**
{
   "processId": "de4f55a4-e9df-4142-98b4-5de739c82188",
   "processName": "entitlementManagement.UserAcceptDeclineInvite.v1.0",
   "stepName": "AcceptPrompt",
   "displayMessage": "Please input required information",
   "parameters": {
      "accept": "Boolean"
   }
}
```

| `processId` | Unique identifier for the current instance of this Process. |
| - | - |
| `processName` | Full name of the Process, including the category and version number. |
| `stepName` | Name of the specific step that the Process is currently on. |
| `displayMessage` | Optional message that the UI can display to the user. |
| `parameters` | Object that specifies the info this Process requires to continue its task. |
| `accept` | Boolean that indicates if the user accepts the service invitation. |

## Final Request: User Accepts

The user explicitly accepts, and your client passes this choice back to the Process through the [Process Step](c_processStep) API:

```
**PUT https://\{your.url\}/process/step**
{
   "processId": "c18d8e7b-6817-4a0c-9ca8-76036b82b0fc",
   "parameters": {
      "accept": **true**
   }
}
```

| `processId` | Unique identifier for the current instance of this Process. |
| - | - |
| `parameters` | Object that contains the data requested in the previous Process response. |
| `accept` | Boolean that indicates if the user accepts the service invitation. |

## Process Complete

The Process activates the following:

* The association(s) between the invitee's User entity and the shared account, subscription, or feature entity (or entities).
* The association between the invitee's User entity and the Group entity (if the invitee was not already a Group member)

The Process then authenticates the current user, and returns a `200 HTTP` status code:

```
**RESPONSE - body**
{
   "processId": "de4f55a4-e9df-4142-98b4-5de739c82188",
   "processName": "entitlementManagement.UserAcceptDeclineInvite.v1.0",
   "lastStep": **true**,
   "runtimeId": 5010,
   "userId": **6014**,
   "userAuthenticated": **true**
}
```

The current user now has access to any of the accounts/services that were shared with them by the inviting user.

| `processId` | The unique identifier for this instance of the Process. |
| - | - |
| `processName` | Full name of the Process, including the category and version number. |
| `lastStep` | Boolean that indicates whether or not this was the last step in the Process. |
| `runtimeId` | Identifier of the Storefront Gateway Runtime entity currently associated to the Storefront Gateway User entity. \*\*About Runtime Entities:\*\*Upon user creation or authentication, Storefront Gateway looks for a JRUNTIMEID cookie in the end user's browser or application. If no cookie is found, Storefront Gateway creates a Runtime Entity with a unique ID and associates it to the user during the login phase. Storefront Gateway will generate and pass a corresponding JRUNTIMEID cookie for clients to store and return with subsequent requests. |
| `userId` | The unique identifier of the current user. |
| `userAuthenticated` | Boolean that indicates if the user was authenticated into Storefront Gateway. |
| **Parent topic:**[Accept or Decline Service Invitation Process](c_acceptDeclineServiceInvitation) | |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.