PHPackages                             abdelwahidjobs/payment-checkout-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. abdelwahidjobs/payment-checkout-api

ActiveLibrary[Payment Processing](/categories/payments)

abdelwahidjobs/payment-checkout-api
===================================

Multi-provider PHP SDK for Payment Checkout APIs (PayPal &amp; Stripe)

v1.0.0(3mo ago)01MITPHPPHP ^8.0 || ^8.2

Since Jan 26Pushed 3mo agoCompare

[ Source](https://github.com/abdelwahidJobs/payment-checkout-api)[ Packagist](https://packagist.org/packages/abdelwahidjobs/payment-checkout-api)[ Docs](https://phpjuice.gitbook.io/paypal-checkout-sdk)[ RSS](/packages/abdelwahidjobs-payment-checkout-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (8)Versions (2)Used By (0)

Multi-Provider Payment SDK (PayPal &amp; Stripe)
================================================

[](#multi-provider-payment-sdk-paypal--stripe)

[![Tests](https://github.com/phpjuice/paypal-checkout-sdk/workflows/Tests/badge.svg?branch=main)](https://github.com/phpjuice/paypal-checkout-sdk/workflows/Tests/badge.svg?branch=main)[![Latest Stable Version](https://camo.githubusercontent.com/993bb186eb955fc531a9d38549e288db921ff7d7af6848f884845838572525c4/687474703a2f2f706f7365722e707567782e6f72672f7068706a756963652f70617970616c2d636865636b6f75742d73646b2f76)](https://packagist.org/packages/phpjuice/paypal-checkout-sdk)[![Maintainability](https://camo.githubusercontent.com/ffadc7f926e15c42e927746fe86be7498fdf09249ff0a237fbf2e5dffccbac27/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f65363030626337636363653331396666653763372f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/phpjuice/paypal-checkout-sdk/maintainability)[![Total Downloads](https://camo.githubusercontent.com/80257f8428b7036bcefec25000f59276bdc37933f960847a2bb478a5ac5442e1/687474703a2f2f706f7365722e707567782e6f72672f7068706a756963652f70617970616c2d636865636b6f75742d73646b2f646f776e6c6f616473)](https://packagist.org/packages/phpjuice/paypal-checkout-sdk)[![License](https://camo.githubusercontent.com/075429d8dc47c06ddc13a820780c3e5afa2bbe6f4023e3efd4c98939040c5b33/687474703a2f2f706f7365722e707567782e6f72672f7068706a756963652f70617970616c2d636865636b6f75742d73646b2f6c6963656e7365)](https://packagist.org/packages/phpjuice/paypal-checkout-sdk)

This package is an enhanced multi-provider payment SDK that supports both PayPal and Stripe payment processing through a unified interface. It provides a simple, fluent API to create, capture, and refund payments with both sandbox and production environments supported.

**Features:**

- ✅ Unified interface for PayPal and Stripe payments
- ✅ Complete refund functionality for both providers
- ✅ Order creation and capture
- ✅ Sandbox and production environment support
- ✅ Comprehensive error handling
- ✅ Full working examples included

Installation
------------

[](#installation)

PayPal Checkout SDK Package requires PHP 7.4 or higher.

> **INFO:** If you are using an older version of php this package may not function correctly.

The supported way of installing PayPal Checkout SDK package is via Composer.

```
composer require phpjuice/paypal-checkout-sdk
```

Quick Start Examples
--------------------

[](#quick-start-examples)

This SDK includes comprehensive working examples to get you started quickly:

### Available Example Files

[](#available-example-files)

- **`example_usage.php`** - Basic usage examples for both PayPal and Stripe
- **`corrected_test.php`** - Corrected PayPal implementation example
- **`working_example_with_refunds.php`** - Complete example with refund functionality
- **`example_refund_usage.php`** - Dedicated refund examples and advanced usage

### Running the Examples

[](#running-the-examples)

1. Replace credential placeholders with your actual API keys in any example file
2. Run: `php example_usage.php` (or any other example file)
3. Follow the output instructions for completing payments

Setup
-----

[](#setup)

### Credentials Setup

[](#credentials-setup)

#### PayPal Credentials

[](#paypal-credentials)

Get client ID and client secret from [PayPal Developer Console](https://developer.paypal.com/developer/applications):

- Create a new REST API app
- Copy Client ID and Client Secret

#### Stripe Credentials

[](#stripe-credentials)

Get API keys from [Stripe Dashboard](https://dashboard.stripe.com/apikeys):

- Copy Secret Key (starts with `sk_`)
- Copy Publishable Key (starts with `pk_`)

### Basic Provider Setup

[](#basic-provider-setup)

```
use PayPal\Checkout\Factory\PaymentProviderFactory;

// PayPal Provider
$paypalProvider = PaymentProviderFactory::create('paypal', 'sandbox', [
    'client_id' => 'your_paypal_client_id',
    'client_secret' => 'your_paypal_client_secret'
]);

// Stripe Provider
$stripeProvider = PaymentProviderFactory::create('stripe', 'sandbox', [
    'secret_key' => 'sk_test_your_stripe_secret_key',
    'publishable_key' => 'pk_test_your_stripe_publishable_key'
]);
```

Usage
-----

[](#usage)

### Creating Orders (Unified Interface)

[](#creating-orders-unified-interface)

The same code works for both PayPal and Stripe providers:

```
use PayPal\Checkout\Orders\Order;
use PayPal\Checkout\Orders\PurchaseUnit;
use PayPal\Checkout\Orders\Amount;

// Create order (same for both providers)
$order = new Order();
$order->setIntent('CAPTURE');

// Create purchase unit
$purchaseUnit = new PurchaseUnit();
$purchaseUnit->setAmount(new Amount('100.00', 'USD'));
$purchaseUnit->setReferenceId('order-' . time());

$order->addPurchaseUnit($purchaseUnit);

// Create payment with either provider
$response = $paymentProvider->createOrder($order);
$responseData = json_decode($response->getBody(), true);

echo "Payment ID: " . $responseData['id'];
```

### PayPal-Specific Usage

[](#paypal-specific-usage)

```
// PayPal returns approval URL for customer
foreach ($responseData['links'] as $link) {
    if ($link['rel'] === 'approve') {
        echo "Customer Approval URL: " . $link['href'];
        break;
    }
}
```

### Stripe-Specific Usage

[](#stripe-specific-usage)

```
// Stripe returns client_secret for frontend integration
echo "Client Secret: " . $responseData['client_secret'];
```

### Refund Processing

[](#refund-processing)

Both providers support full and partial refunds through a unified interface:

```
use PayPal\Checkout\Refunds\RefundRequest;

// Create refund request
$refundRequest = new RefundRequest('25.00', 'USD'); // Partial refund
$refundRequest->setInvoiceId('refund-' . time())
             ->setNoteToPayer('Refund processed as requested')
             ->setReason('requested_by_customer');

// Process refund (works with both PayPal capture IDs and Stripe payment intent IDs)
$refundResponse = $paymentProvider->refundPayment($paymentId, $refundRequest);
```

### Order Details

[](#order-details)

Retrieve order/payment details:

```
// Get order details (works for both providers)
$detailsResponse = $paymentProvider->showOrder($orderId);
$details = json_decode($detailsResponse->getBody(), true);
```

Example Files Overview
----------------------

[](#example-files-overview)

### `example_usage.php`

[](#example_usagephp)

Complete basic usage examples demonstrating:

- PayPal and Stripe payment creation
- Order details retrieval
- Dynamic provider selection
- Error handling patterns

### `corrected_test.php`

[](#corrected_testphp)

Focused PayPal example showing:

- Proper PayPal order structure
- JSON output for debugging
- Comprehensive error handling
- Working PayPal implementation

### `working_example_with_refunds.php`

[](#working_example_with_refundsphp)

Comprehensive example featuring:

- Multi-provider payment creation (PayPal &amp; Stripe)
- Complete refund functionality for both providers
- Refund request creation and processing
- Summary of all implemented features

### `example_refund_usage.php`

[](#example_refund_usagephp)

Dedicated refund examples including:

- Full and partial refund processing
- Advanced refund request configuration
- Multi-provider refund testing
- Production-ready refund patterns

### Getting Started

[](#getting-started)

1. Choose the example file that best matches your needs
2. Replace credential placeholders with your actual API keys
3. Run: `php filename.php`
4. Follow console output for next steps

Changelog
---------

[](#changelog)

Please see the [changelog](changelog.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for details and a todo list.

Security
--------

[](#security)

If you discover any security related issues, please email author instead of using the issue tracker.

Credits
-------

[](#credits)

- [PayPal Developer Documentation](https://developer.paypal.com/docs/)
- [Stripe API Documentation](https://stripe.com/docs/api)
- [Original PayPal SDK](https://github.com/phpjuice/paypal-checkout-sdk)

License
-------

[](#license)

Please see the [LICENSE](https://github.com/phpjuice/paypal-checkout-sdk/blob/main/LICENSE) file for more information.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance80

Actively maintained with recent releases

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

106d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fa5c5d4fdde48e29c2b3268fcef0130390fce81abf6c96d981f0cd2c25cdaadb?d=identicon)[abdelwahidJobs](/maintainers/abdelwahidJobs)

---

Top Contributors

[![abdelwahidJobs](https://avatars.githubusercontent.com/u/19622081?v=4)](https://github.com/abdelwahidJobs "abdelwahidJobs (2 commits)")

---

Tags

stripepaymentpaypalcheckoutphpjuicemulti-provider

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/abdelwahidjobs-payment-checkout-api/health.svg)

```
[![Health](https://phpackages.com/badges/abdelwahidjobs-payment-checkout-api/health.svg)](https://phpackages.com/packages/abdelwahidjobs-payment-checkout-api)
```

###  Alternatives

[payum/payum

One million downloads of Payum already! Payum offers everything you need to work with payments. Friendly for all PHP frameworks (Symfony, Laravel, Laminas, Yii, Silex). Check more visiting site.

1.9k6.6M21](/packages/payum-payum)[payum/payum-bundle

One million downloads of Payum already! Payum offers everything you need to work with payments. Check more visiting site.

59510.3M40](/packages/payum-payum-bundle)[shetabit/multipay

PHP Payment Gateway Integration Package

291348.2k3](/packages/shetabit-multipay)[phpjuice/paypal-checkout-sdk

PayPal's PHP SDK for Checkout REST APIs

5858.1k](/packages/phpjuice-paypal-checkout-sdk)[payum/payum-laravel-package

Rich payment solutions for Laravel framework. Paypal, payex, authorize.net, be2bill, omnipay, recurring paymens, instant notifications and many more

12842.5k](/packages/payum-payum-laravel-package)[payum/stripe

The Payum extension. It provides Stripe payment integration.

22573.1k3](/packages/payum-stripe)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
