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

# Sdks

# fype SDKs

fype provides official SDKs for Node.js and Python to make integration seamless.

## Node.js SDK

### Installation

```bash theme={null}
npm install @fype/nodejs-sdk
```

### Initialization

```typescript theme={null}
import { fype } from '@fype/nodejs-sdk';

const fype = new fype({
  apiKey: 'fype_test_...',
});
```

### Usage

```typescript theme={null}
// Create a payment
const payment = await fype.payments.create({
  amount: 1000,
  currency: 'INR',
  customer_email: 'jane@example.com',
  success_url: 'https://example.com/success',
  cancel_url: 'https://example.com/cancel',
});

console.log(payment.checkout_url);

// Process a refund
const refund = await fype.refunds.create({
  payment_id: payment.id,
  amount: 500,
});
```

***

## Python SDK

### Installation

```bash theme={null}
pip install fype-python-sdk
```

### Initialization

```python theme={null}
from fype import fype

fype = fype(api_key="fype_test_...")
```

### Usage

```python theme={null}
# Create a payment
payment = fype.payments.create(
    amount=1000,
    currency="INR",
    customer_email="jane@example.com",
    success_url="https://example.com/success",
    cancel_url="https://example.com/cancel"
)

print(payment['checkout_url'])

# Verify webhook signature
# Returns True if valid, raises SignatureVerificationError if invalid
is_valid = fype.webhooks.verify_signature(
    raw_payload=request.body(),
    signature_header=request.headers.get('X-fype-Signature'),
    secret="whsec_..."
)
```

## Best Practices

* **Timeout Management**: Our SDKs have built-in timeout handling. We recommend a 15-second timeout for payment creation.
* **Error Handling**: Always wrap your SDK calls in try/catch (Node.js) or try/except (Python) blocks to handle `fypeAuthenticationError`, `fypeInvalidRequestError`, etc.
* **Async/Await**: Both SDKs are built to be non-blocking. Use async/await patterns for the best performance.
* **Signature Verification**: Note that the Node.js `verifySignature` method returns `true` on success but **throws** a `fypeSignatureVerificationError` on mismatch. The Python version returns `True` or raises `SignatureVerificationError`.
