# SDKs & downloads

Official libraries for every part of a crypto checkout. Pick your platform below: each SDK has its own page with
the download, install (registry, local and development), keys setup, code examples and a full integration.

SDKs are MIT-licensed; the plugins are GPL-2.0-or-later (WordPress rules).

## Pick your SDK

### Mobile apps (publishable key or checkout URL)

| SDK | Package | Guide | Download |
|---|---|---|---|
| **Flutter** · Android + iOS | [`razcrypto_checkout`](https://pub.dev/packages/razcrypto_checkout) (pub.dev) | [Flutter SDK →](/docs/flutter-sdk) | [zip](https://razcryptogateway.com/downloads/razcrypto-flutter-sdk.zip) |
| **Android** · Kotlin / Java | `com.razcryptogateway:android-sdk` | [Android SDK →](/docs/android-sdk) | [zip](https://razcryptogateway.com/downloads/razcrypto-android-sdk.zip) |
| **React Native** · Android + iOS | [`@razcrypto/react-native`](https://www.npmjs.com/package/@razcrypto/react-native) (npm) | [React Native SDK →](/docs/react-native-sdk) | [zip](https://razcryptogateway.com/downloads/razcrypto-react-native-sdk.zip) |

### Websites (publishable key or checkout URL)

| SDK | Package | Guide | Download |
|---|---|---|---|
| **Browser popup** | `checkout.js` / [`@razcrypto/checkout`](https://www.npmjs.com/package/@razcrypto/checkout) (npm) | [checkout.js →](/docs/checkout-js) | [zip](https://razcryptogateway.com/downloads/razcrypto-js-checkout-sdk.zip) |

### Servers (secret key + webhook signing secret)

| SDK | Package | Guide | Download |
|---|---|---|---|
| **PHP 8.1+** · Laravel, any PHP | `worldxgrowth/razcrypto-php-sdk` (Packagist) | [PHP SDK →](/docs/php-sdk) | [zip](https://razcryptogateway.com/downloads/razcrypto-php-sdk.zip) |
| **Node.js 18+** · Express, NestJS | [`razcrypto-node`](https://www.npmjs.com/package/razcrypto-node) (npm) | [Node.js SDK →](/docs/node-sdk) | [zip](https://razcryptogateway.com/downloads/razcrypto-node-sdk.zip) |
| **Python 3.9+** · Django, Flask, FastAPI | [`razcrypto`](https://pypi.org/project/razcrypto/) (PyPI) | [Python SDK →](/docs/python-sdk) | [zip](https://razcryptogateway.com/downloads/razcrypto-python-sdk.zip) |

### Plugins (no code)

| Plugin | Guide | Download |
|---|---|---|
| **WooCommerce** · store checkout | [WooCommerce →](/docs/woocommerce) | [zip](https://razcryptogateway.com/downloads/razcrypto-for-woocommerce.zip) |
| **WordPress** · Pay button / shortcode | [WordPress →](/docs/wordpress) | [zip](https://razcryptogateway.com/downloads/razcrypto-payments.zip) |

Versions and SHA-256 checksums of every file: [manifest.json](https://razcryptogateway.com/downloads/manifest.json).

## Which ones do I need?

Most integrations use **one server SDK + one client**:

| You are building | Server | Client |
|---|---|---|
| Flutter app + Laravel backend | [PHP SDK](/docs/php-sdk#laravel-full-integration-for-a-mobile-app) | [Flutter SDK](/docs/flutter-sdk) |
| Android (Kotlin) app + any backend | PHP / Node.js / Python | [Android SDK](/docs/android-sdk) |
| React Native app + Node backend | [Node.js SDK](/docs/node-sdk#full-integration-for-a-mobile-app) | [React Native SDK](/docs/react-native-sdk) |
| Website with your own checkout page | PHP / Node.js / Python | [checkout.js](/docs/checkout-js) or a redirect to `checkout_url` |
| WordPress / WooCommerce store | — | [Plugin](/docs/woocommerce) |

**Rule of thumb:** the secret key (`sk_…`) and the webhook signing secret (`whsec_…`) stay on your server.
Browsers and apps only ever get the publishable key (`pk_…`) or the `checkout_url` your server received.

## How every SDK works

1. **Install** the package.
2. **Initialize** it with your key. The SDKs already know the official RazCrypto API.
3. **Create a payment** on your server and send the customer to its `checkout_url`, or open checkout in your page
   or app.
4. **Mark the order paid** only from the verified `payment.paid` webhook or a server-side `retrieve()`.

```js
const rc = new RazCrypto(process.env.RAZCRYPTO_SECRET_KEY);
const payment = await rc.payments.create({ amount: "25.00", currency: "USD", reference_id: "order_1042" });
```

Get your keys in **Dashboard → API apps**. Use `sk_test_…` while building. Test mode never moves real money.

## Mobile apps: how the SDKs open checkout

The mobile SDKs push a full-screen native screen that hosts the RazCrypto checkout in a WebView, the same way
card-gateway mobile SDKs work. There is no address bar, the merchant's logo and colours are applied, wallet buttons
open the wallet app, Back asks before leaving, and the result comes back to your code as a typed value. New coins,
networks and design updates reach every app without an app update.

### Mobile app without an SDK

Any app can take crypto payments with only the `checkout_url` from your server:

1. Create the payment on your server with a `redirect_url` on your own https domain, for example
   `https://shop.example/app/payment-done`. Register that URL as an Android **App Link** / iOS
   **Universal Link** so it opens your app (live mode accepts only https URLs).
2. Open the `checkout_url` in an in-app browser tab: Android **Custom Tabs** (`androidx.browser`), iOS
   **SFSafariViewController**, or `url_launcher` / `Linking.openURL`. Wallet buttons work there without
   extra code.
3. After payment the customer is sent to `redirect_url` and lands back in your app. Ask your server for the
   payment status to show the result.

```kotlin
// Android, no SDK: implementation("androidx.browser:browser:1.8.0")
CustomTabsIntent.Builder().build().launchUrl(context, Uri.parse(checkoutUrl))
```

Using your own WebView instead? Open every link that is not on the checkout host (`metamask://`,
`trust://`, `wc:`, other sites) outside the WebView, or the wallet buttons will not work. The SDKs already
do this. `checkout.js` is for web pages; inside a native app use an SDK or the `checkout_url`.

## Custom environment (optional)

Not needed for normal use. Only for a staging server or a self-hosted RazCrypto gateway:

| SDK | Option | Environment variable |
|---|---|---|
| Node.js | `new RazCrypto(key, { apiBase: "https://staging.example" })` | `RAZCRYPTO_API_BASE` |
| PHP | `new Client($key, ['api_base' => 'https://staging.example'])` | `RAZCRYPTO_API_BASE` |
| Python | `RazCrypto(key, api_base="https://staging.example")` | `RAZCRYPTO_API_BASE` |
| checkout.js | `open({ payHost })` or `data-pay-host` on the script/button | — |
| Android | `CheckoutOptions.Builder().payHost(…)` | — |
| Flutter | `CheckoutOptions(…, payHost: …)` | — |
| React Native | `open({ …, payHost })` | — |
| WooCommerce / WordPress plugins | `define( 'RAZCRYPTO_API_BASE', 'https://staging.example' );` in `wp-config.php` | — |

The SDK adds `/v1/…` itself; a trailing `/` or `/v1` is removed. A `checkout_url` already carries its host.

## Errors and retries

- API errors raise a typed error with `status`, `code`, `param` and `request_id` (see [Errors](/docs/errors)).
  Switch on `code`, never on the message.
- Network errors, `429` and `5xx` are retried twice with backoff. Retries reuse the same `Idempotency-Key`,
  so a retry never creates a second payment.
- Pass your own idempotency key (for example your order id) to make retries safe across processes too.
- **Test mode:** use `sk_test_…` and `payments.simulate(id, "paid")` to drive the outcome.

## Versioning

- SDKs follow semantic versioning. A minor or patch update never breaks your code.
- `/v1/checkout.js` always serves the latest 1.x. Versioned files (`checkout.1.0.4.js`) never change.
- Each release is listed in the [changelog](/docs/changelog).
