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

# Initialize the SDK

Use the following function to initialize the SDK:

```csharp C# theme={"system"}
PaymentLinksController.Instance.Init(callback)
```

| Argument | Type | Description |
| - | - | - |
| Callback | `ICheckoutPurchase` | Implementation of the callback interface. |

> [!NOTE]
>
> This initialization method is sufficient if you've already set the **Environment** and **Checkout Public Key** fields in the configuration file. If you prefer to set these values programmatically, use the initialization method described in the next section.

## Re-initialize the SDK

You may need to re-initialize the SDK in the following cases:

1. When switching environments at runtime, for example, when testing the SDK.
2. When certain configuration details are managed manually instead of being defined in the configuration file.

In such cases, re-initialize the SDK using the extended method below:

```csharp C# theme={"system"}
PaymentLinksController.Instance.Init("CHECKOUT_PUBLIC_KEY", "ENVIRONMENT", callback)
```

| Argument | Type | Description |
| - | - | - |
| Environment | `string` | The checkout environment. One of: - `sandbox`: For testing. - `production`: For live operations. |
| Checkout Public Key | `string` | The public key from the Publisher Dashboard.Go to Settings → Integration and copy the Checkout Public Key. |
| Callback | `ICheckoutPurchase` | Implementation of the callback interface. |

> [!WARNING]
>
> Always ensure the correct `environment` and `checkoutPublicKey` are used when re-initializing. Incorrect values can cause failed checkout validations.
