Anyone please advise what is the best payment gateway for php website and how to integrate in php website.

Dani AI

Generated

raised a common question; early replies from (PayPal) and (PayPal, Google) pointed to quick options. A historical note: Google Checkout was discontinued (see its entry), so advice from 2011 needs updating. Today the practical choices for PHP sites are gateways with solid PHP SDKs and hosted checkout options — for example Stripe, Braintree, and Authorize.Net — because they reduce PCI burden and offer modern webhooks, tokenization, and good docs.

Key selection criteria to weigh:

  • country and currency coverage
  • transaction fees, monthly/settlement terms
  • support for cards, wallets, recurring/subscriptions
  • hosted checkout vs direct API (hosted lowers PCI scope)
  • fraud tools, chargeback process and dispute support
  • quality of PHP SDKs, docs, and sandbox testing

A safe, repeatable PHP integration workflow:

  1. Decide hosted checkout (Checkout/Hosted) or direct API (Elements/JS + server).
  2. Create test/sandbox accounts and get test keys.
  3. Install official PHP SDK (example: composer require stripe/stripe-php) and use server-side endpoints to create payment intents/tokens.
  4. Use the provider’s client-side elements or hosted pages to collect card data (so raw card numbers never touch the server).
  5. Implement and validate webhooks, test refunds and chargebacks, then swap to live keys.

Small PHP example (server creates a PaymentIntent with Stripe):

composer require stripe/stripe-php
require 'vendor/autoload.php';
\Stripe\Stripe::setApiKey('sk_test_...');
$pi = \Stripe\PaymentIntent::create([
  'amount' => 2000,
  'currency' => 'usd',
  'payment_method_types' => ['card'],
]);
echo $pi->client_secret;

Practical cautions: never mix test and live keys, always use HTTPS, verify webhook signatures, use idempotency keys to avoid duplicate charges, and avoid storing card numbers unless fully PCI-compliant. For provider docs and implementation patterns see the official guides (for example ) and review PCI requirements (PCI DSS).

Recommended Answers

All 2 Replies

Dunno about best. Cheapest are google's (which I don't like much) and paypal. Most gateways will give you the code you need.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.