ShipNow LogoShipNow
Payments

Stripe

Learn how to configure pricing plans and integrate Stripe payments in your ShipNow application.

Overview

ShipNow's Stripe payment enables you to:

  • 💰 Configure subscription or one-time payments
  • 🔄 Automatically handle payment lifecycle
  • 🛠️ Developer friendly with sandbox and webhook

Configure Stripe

Create Stripe Account

  1. Sign up for a Stripe account
  2. Fill in the information to activate the account
  3. Before activation, you can use a sandbox or test mode

Get API Keys

  1. Go to Stripe API Keys
  2. Create and copy the "Publishable key" and "Secret key"

Get Stripe API keys

Add Environment Variables

Add your Stripe keys to .env.local:

.env.local
STRIPE_PUBLIC_KEY="pk_test_..."
STRIPE_SECRET_KEY="sk_test_..."

Configure Stripe Webhooks

Create Webhook Endpoint

  1. Go to Stripe Webhooks
  2. Click "Add destination"

Create Stripe webhook

Select Events

Search and select the following events:

  • invoice.paid
  • checkout.session.completed
  • customer.subscription.deleted

Create Stripe webhook

Choose Destination Type

Use "Webhook endpoint" as the destination type, click "Continue"

Create Stripe webhook

Add Webhook URL

  1. Add your webhook URL to the "Endpoint URL" field
    https://your-domain.com/api/stripe/webhook
  2. Click "Create destination"

Create Stripe webhook

Get Webhook Secret

  1. After creating the webhook, click "Reveal" and copy the "Signing secret"
  2. Add it to .env.local:
    STRIPE_WEBHOOK_SECRET="whsec_..."

Get Stripe webhook secret

Payment Flow

Here's how the payment process works in ShipNow:

User clicks "Buy Now" button on the pricing table

System creates a Stripe checkout session

User is redirected to Stripe Checkout

After payment, user is redirected back to success page

Webhook receives payment confirmation

Local Development and Testing

Setup Local Development

When developing locally, use Stripe's sandbox mode:

Go to Stripe Sandboxes, and enter the sandbox you want to use

Get your test API keys from the API keys page

Set up local webhooks in the Stripe Workbench

Use the following command to forward webhooks to your local server:

stripe listen --forward-to http://localhost:3000/api/stripe/webhook

Test Payment Cards

Use these cards to test different scenarios:

Card NumberScenario
4242 4242 4242 4242Success
4000 0000 0000 0002Decline

For all test cards:

  • Expiry: Any future date, eg 12/34
  • CVC: Any 3 digits, eg 123
  • ZIP: Any 5 digits if required, eg 12345

Testing Checklist

✅ Create a test subscription

  • Use test card 4242 4242 4242 4242
  • Verify success redirect
  • Check webhook received

✅ Test failed payment

  • Use declined test card 4000 0000 0000 0002
  • Verify error message shown

✅ Monitor webhook events

  • Check Stripe CLI output
  • Verify events in application logs

Debugging Tips

If you encounter issues:

  1. Check environment variables are set correctly
  2. Ensure webhook forwarding is running
  3. Look for errors in Stripe Dashboard

Pro Tips

  • Do not use the live mode to test the payment process, use the sandbox or test mode instead

Need Help?

ShipNow LogoGet ShipNow