# MagicPay SDK

Canonical URL: https://magiccard.ai/docs/integrations/sdk
Markdown URL: https://magiccard.ai/docs/integrations/sdk.md
Summary: The SDK is the right entry point when you own the surrounding agent, browser, or backend runtime and need MagicPay as the Memory request layer.
Description: Integrate MagicPay sessions, requests, Memory, data resolution, actions, and choices from trusted TypeScript code.

## Canonical Answer

The SDK is the right entry point when you own the surrounding agent, browser, or backend runtime and need MagicPay as the Memory request layer. Integrate MagicPay sessions, requests, Memory, data resolution, actions, and choices from trusted TypeScript code. Protected payment and identity data stays behind MagicPay requests instead of entering LLM-visible context.

![What each part of the SDK client does](https://magiccard.ai/docs-assets/images/integrations-sdk-client-map.svg)

## Install

Use the public package in trusted Node or TypeScript runtimes.

```ts
npm i @nuanu-ai/magicpay-sdk
```

## Client Responsibilities

The SDK handles communication with MagicPay. Your app still owns browser control, provider calls, UI, and what happens after a protected result is returned. Memory fill is target-agnostic by design: the same value-free flow writes an approved value into an API header, a provider SDK call, or a browser field, with MagicBrowse as the browser adapter.

- Create workflow sessions.
- Resolve protected field values through user-approved requests.
- Run protected actions such as a payment authorization.
- Ask the user to choose from runtime-provided options.
- Create hosted links when a request or session needs to move back to a MagicPay-controlled UI.
- Wait for request results without writing custom polling.

## Security Rule

Treat request artifacts as short-lived handoff material. Do not log them, print them, store them in prompts, or give them to the LLM.

## Related

- SDK Purchase Flow: https://magiccard.ai/docs/guides/sdk-purchase
- API Reference: https://magiccard.ai/docs/api
- MagicPay Memory fill: https://magiccard.ai/docs/components/memory-fill