PaymentPaypal by apeisa

PaymentPaypal - using standard payment API and PDT for verification

PaymentPaypal

PayPal payment method for ProcessWire

Requirements


Requires PaymentModule -module

Example


// Load the module and setup payment
$payment = $modules->get("PaymentPaypal");
$payment->setCurrency("EUR");
$payment->setId(123456789);

$customer = Array();
$customer['givenName'] = "Antti";
$customer['familyName'] = "Peisa";
$customer['streetAddress'] = "Some Street";
$customer['locality'] = "Some City";
$customer['postalCode'] = "12345";
$customer['email'] = "antti.peisa@gmail.com";
$payment->setCustomerData($customer);

$title = "Cool product";
$quantity = 2;
$amount = 1000; // Amount in payment modules always in cents
$payment->addProduct($title, $amount, $quantity);

// In this example we are going to do all in same page
$url = $page->httpUrl;
$payment->setProcessUrl($url . "?step=process");
$payment->setFailureUrl($url . "?step=fail");
$payment->setCancelUrl($url . "?step=cancel");

switch ($input->get->step) {
	case 'process':
		if ($payment->processPayment()) {
			echo "Thanks, payment successful!";
		} else {
			echo "Are you kidding me?";
		}
		break;

	case 'fail':
		echo "Something went wrong";
		break;

	case 'cancel':
		echo "I think you cancelled?";
		break;

	default:
		echo $payment->render();
		break;
}

License


GPL 2.0

Install and use modules at your own risk. Always have a site and database backup before installing new modules.

Latest news

  • ProcessWire Weekly #558
    In the 558th issue of ProcessWire Weekly we'll check out the blog post that introduces ProcessWire 3.0.244, share some recent ProcessWire highlights, and more. Read on!
    Weekly.pw / 18 January 2025
  • ProcessWire 3.0.244 new main/master version
    ProcessWire 3.0.244 is our newest main/master/stable version. It's been more than a year in the making and is packed with tons of new features, issue fixes, optimizations and more. This post covers all the details.
    Blog / 18 January 2025
  • Subscribe to weekly ProcessWire news

“The end client and designer love the ease at which they can update the website. Training beyond how to log in wasn’t even necessary since ProcessWire’s default interface is straightforward.” —Jonathan Lahijani