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

# FastSpring

> Configure FastSpring as a Merchant of Record gateway

# FastSpring

FastSpring is a Merchant of Record (MoR) that handles global tax compliance, VAT/GST, and local payment methods. Subscribd integrates with the FastSpring API.

## Configuration

```php theme={null}
// config/subscribd.php
'gateways' => [
    'fastspring' => [
        'driver'         => \Pixelworxio\Subscribd\Gateways\FastSpringGateway::class,
        'username'       => env('FASTSPRING_USERNAME'),
        'password'       => env('FASTSPRING_PASSWORD'),
        'webhook_secret' => env('FASTSPRING_WEBHOOK_SECRET'),
        'storefront'     => env('FASTSPRING_STOREFRONT_URL'),
        'success_url'    => env('FASTSPRING_SUCCESS_URL'),
        'cancel_url'     => env('FASTSPRING_CANCEL_URL'),
    ],
],
```

## Environment variables

```env theme={null}
FASTSPRING_USERNAME=...
FASTSPRING_PASSWORD=...
FASTSPRING_WEBHOOK_SECRET=...
FASTSPRING_STOREFRONT_URL=https://yourstore.onfastspring.com
FASTSPRING_SUCCESS_URL=https://yourapp.com/billing/success
FASTSPRING_CANCEL_URL=https://yourapp.com/billing/cancel
```

## Checkout flow

FastSpring uses a hosted storefront for checkout. `CreateSubscription` returns an `Incomplete` subscription with a `checkout_url` in `meta`. Redirect the user to complete payment:

```php theme={null}
$subscription = app(CreateSubscription::class)->execute($user, $plan, ['gateway' => 'fastspring']);

if ($subscription->status->value === 'incomplete') {
    return redirect($subscription->meta['checkout_url']);
}
```

`SubscriptionCreated` fires from the webhook handler after FastSpring confirms the order.

## Webhooks

Configure a webhook endpoint at `https://yourapp.com/subscribd/webhook/fastspring` in your FastSpring Dashboard under **Developer > Webhooks**. Enable:

* `subscription.activated`
* `subscription.updated`
* `subscription.canceled`
* `subscription.deactivated`
* `order.completed`
* `order.failed`

Set the **HMAC Secret** in FastSpring and add it as `FASTSPRING_WEBHOOK_SECRET`.

## Limitations

* Proration is handled by Subscribd's built-in `ProrationEngine`.
* Trial extension is not supported natively. `ExtendTrial` updates the local `trial_ends_at` only.
* Pausing is not supported natively. Subscribd updates the local status only.

## Next steps

* **[Square](/gateways/square)** — Card-present and online payments
* **[Webhooks](/advanced/webhooks)** — Full webhook reference
