PaymentPaypal

PaymentPaypal - using standard payment API and PDT for verification

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

More modules by apeisa

  • Thumbnails

    Three modules that offer nice thumbnail cropping for ProcessWire. Fully compatible with normal image field.
  • Fredi - Friendly Frontend Editor

    Fredi will bring quick modal edit links to frontend. Supports all the fieldtypes.
  • Finnish (fi-FI)

    Finnish (fi-FI) language pack for ProcessWire admin.
  • Trashman

    Allows users without superuser role to view and restore pages from trash.
  • Facebook Login

    Adds facebook login/register for your website or application.
  • PaymentPaypal

    PaymentPaypal - using standard payment API and PDT for verification
  • PaymentStripe

    Allows using stripe for credit card payments in any ProcessWire site.

All modules by apeisa

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