If you're running a classifieds site with LaraClassified, your promotion and featured-listing features are only useful once money can actually flow in. Setting up payment gateways properly means you can charge users to promote ads, upgrade listings, or subscribe to premium packages. This guide walks you through configuring Stripe, PayPal, and offline payments the right way, plus the safe way to tweak your configuration files.

Before You Start: Understand LaraClassified's Payment Flow

LaraClassified handles payments through Payment Methods tied to Packages (promotion or subscription plans). Users pick a package, choose a gateway, and pay. To make this work you need to:

  • Enable and configure at least one payment gateway.
  • Create promotion or subscription packages with prices.
  • Make sure your currency settings match your gateway.

Most of this is done inside the admin dashboard, with a couple of values stored in your .env file. Let's go through it.

Step 1: Log Into the LaraClassified Admin Panel

Open your admin area, usually at https://yoursite.com/admin, and sign in with your administrator account. From the left-hand menu you'll work mostly under Payments and Settings.

Set Your Currency First

Before touching gateways, confirm your currency is correct. Go to Settings → App / Currency and choose the currency that matches what your payment gateway supports. Stripe and PayPal both reject mismatched currencies, so this small step avoids failed transactions later.

Pro Tip: Not every gateway supports every currency. For example, some regions can't process certain currencies through PayPal. Check your gateway's supported currency list before going live.

Step 2: Configure the Stripe Gateway

Stripe is the most popular option for card payments in LaraClassified.

  1. Create a Stripe account and open your Developers → API keys section.
  2. Copy your Publishable key and Secret key (use test keys first if you want to try it safely).
  3. In the LaraClassified admin, go to Payments → Payment Methods and open the Stripe entry.
  4. Paste your keys into the appropriate fields, set the method to Active, and save.

Some LaraClassified versions store Stripe keys directly in the .env file instead. If so, you'll add lines like:

STRIPE_KEY=pk_live_xxxxxxxxxxxx
STRIPE_SECRET=sk_live_xxxxxxxxxxxx

We'll cover how to safely edit that file in Step 5.

Step 3: Configure the PayPal Gateway

  1. Log into the PayPal Developer Dashboard and create a REST API app.
  2. Copy your Client ID and Secret.
  3. In LaraClassified, open Payments → Payment Methods → PayPal.
  4. Paste in the Client ID and Secret, choose the environment (sandbox for testing, live for production), set to Active, and save.
Caution: Always test with sandbox credentials first. Run a full purchase through a test package before switching to live keys. This catches currency or webhook problems before real customers hit them.

Step 4: Enable Offline Payments (Optional but Handy)

Offline payment lets users pay via bank transfer, cash, or another manual method, and you approve the payment by hand. This is great for regions where card processing is limited.

  1. Go to Payments → Payment Methods → Offline Payment.
  2. Set it to Active.
  3. In the description field, add clear instructions (your bank details, what reference to use, and how long approval takes).

When a user selects offline payment, their order sits as pending until you approve it under Payments → Payments in the admin dashboard.

Step 5: Safely Editing the .env Configuration File

Some values (like app URL, mail, and occasionally gateway keys) live in the .env file at the root of your LaraClassified installation. Editing it incorrectly can take your whole site offline, so make a backup first.

Editing .env in DirectAdmin

  1. Log into DirectAdmin and open File Manager.
  2. Navigate to your site's root folder (often domains/yourdomain.com/public_html).
  3. Find the .env file. If hidden files aren't shown, enable Show Hidden Files in the File Manager settings.
  4. Right-click the file, choose Copy to make a backup (e.g. .env.bak), then Edit the original.
  5. Make your changes, then click Save.

Editing .env in cPanel

  1. Log into cPanel and open File Manager.
  2. Click Settings (top right) and tick Show Hidden Files (dotfiles), then Save.
  3. Navigate to your installation folder (commonly public_html).
  4. Select the .env file, click Copy to create a backup, then choose Edit.
  5. Update your values and click Save Changes.

After editing, clear the Laravel config cache so your changes take effect. If you have terminal or SSH access, run:

php artisan config:clear
php artisan cache:clear

No SSH? You can trigger cache clearing from within the LaraClassified admin panel under System → Cache in most versions.

Pro Tip: Never wrap values with spaces around the = sign. Use STRIPE_SECRET=sk_live_xxx, not STRIPE_SECRET = sk_live_xxx. A single stray space can throw config errors.

Step 6: Create Packages So Users Have Something to Pay For

Gateways are useless without something to buy. Set up your pricing:

  1. Go to Payments → Promotion Packages (for featuring/promoting ads) or Subscription Packages.
  2. Click Add and fill in the name, price, duration, and any options (like featured placement or number of allowed ads).
  3. Save and make sure the package is set to Active.

Once a package exists and a gateway is active, users will see the payment options during checkout.

Step 7: Test the Full Purchase Flow

Register a normal (non-admin) test account, post an ad, and try to promote it. Complete a purchase using a Stripe test card (e.g. 4242 4242 4242 4242) or a PayPal sandbox account. Confirm the payment shows up in the admin Payments list and the promotion actually applies to the ad.

Why Hosting Matters for Payment Reliability

Payment gateways rely on fast, stable outbound connections and quick page loads during checkout. On Hostiso's Shared Hosting, the LiteSpeed Web Server and Redis object caching keep checkout pages snappy, while NVMe storage means your database queries for packages and orders resolve fast. For higher-traffic classifieds sites processing many transactions, a Cloud VPS gives you the extra headroom. And if a gateway callback or config change ever misbehaves, our 24/7 support team is around to help sort it out.

Frequently Asked Questions

My payments succeed on the gateway but don't complete in LaraClassified. Why?

This is almost always a webhook or return-URL problem. Confirm your APP_URL in the .env file matches your live domain exactly (including https), and that the gateway's webhook/IPN settings point to the correct callback URL. Clearing the config cache after fixing it is essential.

Can I run more than one payment gateway at the same time?

Yes. You can enable Stripe, PayPal, and offline payments together. Users will simply choose their preferred method at checkout. Just make sure each active gateway is fully configured, or users may hit errors when selecting an incomplete one.

Do I have to edit the .env file, or can I do everything in the admin panel?

It depends on your LaraClassified version. Newer versions let you store gateway keys directly in the admin dashboard, so you rarely touch .env. Core values like your app URL, mail settings, and database connection still live in .env, so it's good to know how to edit it safely.