# Stripe Integration

# Stripe Integration

Stripe is a global payment processing platform. NexWave integrates with Stripe to accept online payments for invoices and orders, supporting both one-time charges and recurring subscriptions.

## Payment Flow

 ![](https://docs.nexwaveapp.com/api/files.get?sig=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXkiOiJ1cGxvYWRzL2YxMTg5ZTEzLTdlMTQtNDA1ZC04MDI1LWMxZmI0Y2Y2MTg0ZC8yN2UyMWRmZS0xMzE1LTQxN2YtYWQwZS1lN2Q1MjEwYjNiNmEvc3RyaXBlLXBheW1lbnQtZmxvdy5zdmciLCJ0eXBlIjoiYXR0YWNobWVudCIsImlhdCI6MTc5MzI4ODcwMCwiZXhwIjoxNzkzMzc1MTAwfQ.Q0sFqAkHphlvDNd1eIT1e0JGC8kqiFainvzlVtjiZg4 " =700x432")

## Features

| Feature | Description |
|---------|-------------|
| **One-Time Payments** | Process single charges via Stripe Charges API |
| **Subscriptions** | Recurring billing via Stripe Subscriptions API |
| **PCI Compliance** | Card details tokenised client-side via Stripe.js |
| **Multi-Currency** | Supports 135+ currencies |
| **Hosted Checkout** | Built-in checkout page with customisable branding |
| **Request Logging** | All payment attempts logged in Integration Request |
| **Custom Redirects** | Configurable success/failure redirect URLs |

## Supported Currencies

Stripe supports 135+ currencies including:

* **Major:** USD, EUR, GBP, AUD, NZD, CAD, CHF, JPY
* **Regional:** INR, SGD, HKD, MXN, BRL, ZAR
* **Full list:** AED, ALL, ANG, ARS, and many more

### Minimum Charge Amounts

| Currency | Minimum |
|----------|---------|
| USD, AUD, CAD, EUR, NZD, SGD | $0.50   |
| GBP      | £0.30   |
| JPY      | ¥50     |
| DKK, NOK, SEK | 2.50-3.00 |

## Configuration

### Stripe Settings

Navigate to **Settings > Stripe Settings** to configure:

| Field | Description |
|-------|-------------|
| Gateway Name | Unique identifier for this Stripe account |
| Publishable Key | Public key from Stripe Dashboard (pk_live_xxx) |
| Secret Key | Private key from Stripe Dashboard (sk_live_xxx) |
| Header Image | Logo displayed on checkout page |
| Redirect URL | Custom URL after payment completion |

### Obtaining API Keys


1. Log into [Stripe Dashboard](https://dashboard.stripe.com)
2. Navigate to **Developers > API Keys**
3. Copy the **Publishable key** and **Secret key**
4. For testing, use keys from Test mode

## Payment Types

### One-Time Payments

Used for invoices and single purchases:


1. Customer clicks Pay on Payment Request
2. Redirected to Stripe checkout page
3. Card details tokenised by Stripe.js
4. NexWave creates charge via Stripe API
5. Payment Entry created on success

### Subscriptions

Used for recurring billing:


1. Payment Request linked to Subscription Plan
2. Customer subscribes via checkout
3. Stripe creates Customer and Subscription
4. Recurring charges processed automatically
5. Requires `product_price_id` on Subscription Plan

## Integration Points

| Document | Integration |
|----------|-------------|
| Payment Request | Initiates Stripe checkout flow |
| Payment Gateway | Links to Stripe Settings |
| Subscription Plan | Stores Stripe product_price_id |
| Integration Request | Logs all API calls and responses |

## Error Handling

* Failed payments logged in Integration Request with status "Failed"
* Customer shown error message and redirected appropriately
* Detailed errors logged via `frappe.log_error()`
* Invalid API keys detected on Stripe Settings save

## Security

* Card numbers never touch NexWave servers (PCI compliant)
* Stripe.js handles all sensitive data client-side
* Secret key stored encrypted in database
* Credential validation on settings update