PHP Classes

PHP Payment Gateway Processor: Process payments using Paypal or Stripe

Recommend this page to a friend!
  Info   View files View files (1)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2023-05-02 (4 months ago) RSS 2.0 feedNot enough user ratingsTotal: 70 All time: 10,170 This week: 48Up
Version License PHP version Categories
paymentprocess 1.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

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

 Version Control Unique User Downloads Download Rankings  
 0%
Total:70
This week:0
All time:10,170
This week:48Up