Stripe is the easiest payment gateway I've setup so far!
You can find all details about this service on their website, I will only mention that Twitter, Apple and Facebook are using it.
# composer prerequisites
$ apt-get install php5 git php5-curl
# install stripe-php library with composer
$ mkdir /var/www/stripe
$ cd /var/www/stripe/
$ curl -sS https://getcomposer.org/installer | php
$ cat <<'EOF' > composer.json
{
"require": {
"stripe/stripe-php": "2.*"
}
}
EOF
$ php composer.phar install
$ cat <<'EOF' > test.html
<form action="charge.php" method="POST">
<script src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="pk_test_6pRNASCoBOKtIshFeQd4XMUh"
data-amount="2000"
data-name="Demo Site"
data-description="2 widgets ($20.00)"
data-image="/128x128.png">
</script>
</form>
EOF
$ cat <<'EOF' > charge.php
<?php
require 'vendor/autoload.php';
\\Stripe\\Stripe::setApiKey("sk_test_BQokikJOvBiI2HlWgH4olfQ2");
$token = $_POST['stripeToken'];
try {
$charge = \\Stripe\\Charge::create(array(
"amount" => 2000, // amount in cents, again
"currency" => "usd",
"source" => $token,
"description" => "test charge")
);
echo "ok";
# other backend actions
} catch(\\Stripe\\Error\\Card $e) {
echo "error, card was declined";
}
EOF
Now open your browser, load /stripe/test.html
and that's all.