PaymentStripe by apeisa

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

PaymentStripe

Stripe payment module for ProcessWire

Requirements


Requires PaymentModule -module.

Example


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

$customer = Array();
$customer['email'] = "antti.peisa@gmail.com";
$payment->setCustomerData($customer);

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

// 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->embed(); // Here you could look if instance is PaymentEmbed or PaymentRedirect and choose method based on that
		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 #554
    In the 554th issue of ProcessWire Weekly we'll check out the latest core updates, introduce a couple of new third party modules, and more. Read on!
    Weekly.pw / 21 December 2024
  • Custom Fields Module
    This week we look at a new ProFields module named Custom Fields. This module provides a way to rapidly build out ProcessWire fields that contain any number of subfields/properties within them.
    Blog / 30 August 2024
  • 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