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

# Registering a User in SynchPay

> Follow these steps to register a user in SynchPay

To register a user in the SynchPay API, you need to create a registration object that defines conditional payment details, such as the amount and frequency. This is done using the `/user/register` endpoint. The process involves the following steps:

<Steps>
  <Step title="Create a Registration Object">
    Make a `POST` request to `/user/register` with the required parameters.
  </Step>

  <Step title="Redirect the User">
    Use the `RegistrationUrl` returned in the response to send the user to complete their registration, where they will provide payment information and undergo KYC verification.
  </Step>

  <Step title="Request Money">
    Optionally, request money from the user during registration or at a later time.
  </Step>
</Steps>

## Creating a Registration Object

The `/user/register` endpoint initiates the user registration process. Below are the specifics of the API call.

### Endpoint

* **URL**: [https://api.synchpay.com/user/register](https://api.synchpay.com/user/register)
* **Method**: `POST`
* **Authorization**: `Bearer <AccessToken>`

<Tip>
  The access token is obtained from [/auth/token](https://apidocs.synchpay.dev/api-reference/authentication/authenticate) using your `ClientId` and `ClientSecret`.
</Tip>

### Request Parameters

The request body or headers must include the following parameters, all formatted in PascalCase:

| Parameter          | Type    | Description                                                                                                                                                  | Required |
| ------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
| `Period`           | string  | The frequency of the payment. Set to "once" for a one-time payment during registration.                                                                      | No       |
| `Amount`           | integer | The payment amount expressed in cents. For example, \$50.00 should be provided as `5000` (if applicable).                                                    | No       |
| `ShortDescription` | string  | A brief description of the payment purpose (for AML purposes).                                                                                               | No       |
| `RedirectUrl`      | string  | The URL to redirect the user after completing registration.                                                                                                  | Yes      |
| `MobileNumber`     | string  | The user's mobile number (optional, speeds up onboarding). Needs to be a [valid E.164](https://www.twilio.com/docs/glossary/what-e164) format mobile number. | No       |
| `Email`            | string  | The user's email address (optional, speeds up onboarding).                                                                                                   | No       |

<Warning>
  Ensure you're using an [E.164 formatted mobile number](https://www.twilio.com/docs/glossary/what-e164) (e.g. `"+12345678901"`). E.164 has a 15 digit limit.
</Warning>

### Response

Upon successful creation of the registration object, the endpoint returns a JSON object with the following fields:

| Field             | Type   | Description                                                |
| ----------------- | ------ | ---------------------------------------------------------- |
| `RegistrationId`  | string | The unique ID of the user registration.                    |
| `RegistrationUrl` | string | The URL for the user to complete the registration process. |

**Example Response:**

```json theme={null}
{
  "RegistrationId": "6e8d9257-bd5f-45cf-8f29-6d0ae8a6d991",
  "RegistrationUrl": "https://app.synchpay.com/register/6e8d9257-bd5f-45cf-8f29-6d0ae8a6d991"
}
```

## Completing the Registration

After receiving the `RegistrationId` and `RegistrationUrl`, direct the user to the `RegistrationUrl` to complete their registration. This can be done in two ways:

1. **Redirect the User**: Send the user to the `RegistrationUrl`, where they will be guided through the SynchPay app to link their account via Plaid and complete the KYC process.
2. **Display a Webview**: Keep the user within your app by displaying the `RegistrationUrl` in a webview component.

Once the user completes the registration process, they will be redirected to the `RedirectUrl` you provided in the request.

## Checking User Status

To monitor the registration status, use the `GET /user/{registrationId}/status` endpoint:

* **URL**: [https://api.synchpay.com/user/\{registrationId}/status](https://api.synchpay.com/user/\{registrationId}/status)
* **Method**: `GET`
* **Authorization**: `Bearer <AccessToken>`

The response will indicate the current status (e.g., "Pending", "Registered") as well as account mask if user has linked an account.

**Example Responses:**

```json theme={null}
{
  "Status": "Pending",
  "AccountMask": null
}
```

```json theme={null}
{
  "Status": "Registered",
  "AccountMask": "1234"
}
```
