PHP Classes

PHP Payment Gateway Processor: Process payments using Paypal or Stripe

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 89 All time: 9,966 This week: 66Up
Version License PHP version Categories
paymentprocess 1.0.0Proprietary License5PHP 5, E-Commerce, Web services
Description 

Author

This package can process payments using Paypal or Stripe.

It provides a class that uses the Paypal or Stripe SDK libraries to perform operations to process the PHP application's payment requests.

Currently, it can:

- Send a payment request to Paypal API and redirects the current user browser to a page where the user can finish the payment in the Paypal
site

- Send a payment intent to use the Stripe API and returns an array with the client's secret and public key to call the Stripe API to perform payment request steps.

Instructions:

Ensure you have installed the necessary SDKs and libraries for both PayPal and Stripe.

You can find instructions for installing the PayPal PHP SDK here: https://github.com/paypal/PayPal-PHP-SDK.

You can find instructions for installing the Stripe PHP library here: https://github.com/stripe/stripe-php.

Next, create an instance of the PaymentProcessor class, passing in your PayPal client ID and Stripe API key:

$processor = new PaymentProcessor('STRIPE_API_KEY', 'PAYPAL_CLIENT_ID');

To process payment through PayPal, call the processPayment method on your PaymentProcessor instance, passing in the amount of the payment, the currency of the payment, and the string 'PayPal' to indicate that you want to use PayPal:

$payment = $processor->processPayment(100, 'USD', 'PayPal');

This will initiate a PayPal payment and redirect the user to the PayPal checkout page.

To process a payment through Stripe, call the processPayment method on your PaymentProcessor instance, passing in the amount of the payment, the currency of the payment, and the string 'stripe' to indicate that you want to use Stripe:

$payment = $processor->processPayment(100, 'USD', 'stripe');

This will create a Stripe Payment Intent and return a client secret and public key that you can use to complete the payment on the client side.

On the client side, you can use the client secret and public key returned by the processPayment method to complete the payment through Stripe using Stripe Elements or another Stripe integration.

You can find documentation for Stripe Elements here: https://stripe.com/docs/payments/accept-a-payment.

And that's it! With this PaymentProcessor class, you can quickly process payments through PayPal and Stripe using a simple, unified interface.

Picture of Rahul Banerjee
Name: Rahul Banerjee <contact>
Classes: 2 packages by
Country: India India
Age: ???
All time rank: 4144284 in India India
Week rank: 214 Up11 in India India Up

  Files folder image Files (1)  
File Role Description
Plain text file class.paymentprocess.php Class Payment processor class for paypal or stripe

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:89
This week:0
All time:9,966
This week:66Up