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(5mo ago)01MITPHPPHP ^8.0 || ^8.2

Since Jan 26Pushed 5mo 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 today

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

33

—

LowBetter than 72% of packages

Maintenance72

Regular maintenance activity

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

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

160d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/19622081?v=4)[abdelwahid elmeghit](/maintainers/abdelwahidJobs)[@abdelwahidJobs](https://github.com/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

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k543.5M2.6k](/packages/aws-aws-sdk-php)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k43](/packages/civicrm-civicrm-core)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

21866.0M1.7k](/packages/drupal-core)[shetabit/multipay

PHP Payment Gateway Integration Package

293361.0k4](/packages/shetabit-multipay)[oat-sa/tao-core

TAO core extension

66143.7k124](/packages/oat-sa-tao-core)

PHPackages © 2026

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