PHPackages                             leifermendez/laravel-paypal-subscription - 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. leifermendez/laravel-paypal-subscription

ActiveLibrary[Payment Processing](/categories/payments)

leifermendez/laravel-paypal-subscription
========================================

Plugin especial para laravel el cual permite de forma facil el cobro de subscripcion con PAYPAL

v1.0.4(5y ago)411.0k1Apache-2.0PHPPHP &gt;=7.2

Since Feb 17Pushed 5y ago2 watchersCompare

[ Source](https://github.com/leifermendez/laravel-paypal-subscription)[ Packagist](https://packagist.org/packages/leifermendez/laravel-paypal-subscription)[ RSS](/packages/leifermendez-laravel-paypal-subscription/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (6)Used By (1)

Laravel PAYAPAL (Subscripciones)
================================

[](#laravel-payapal--subscripciones)

Realiza cobros en paypal de forma periódica y automatiza haciendo uso de subscripción con PAYPAL.

> **NOTA**: Antes continuar recuerda solicitar tus credenciales de acceso en [PAYPAL](https://developer.paypal.com/developer/applications/create)

[![Buy Me A Coffee](https://camo.githubusercontent.com/9f44ce2dc3b3eecdd02598900866ffc518801df1932849703dae1e5ce5031070/68747470733a2f2f7777772e6275796d6561636f666665652e636f6d2f6173736574732f696d672f637573746f6d5f696d616765732f6f72616e67655f696d672e706e67)](https://www.buymeacoffee.com/leifermendez)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[](#)

[![](./assets/video.gif)](./assets/video.gif)

#### Instalar

[](#instalar)

`composer require leifermendez/laravel-paypal-subscription`

#### Laravel 5.4 o inferior

[](#laravel-54-o-inferior)

Add the service provider to your `config/app.php` file:

```
    'providers' => array(

        //...
        leifermendez\paypal\ProviderPaypalSubscription

    ),
```

Add the facade to your `config/app.php` file:

```
    'aliases'       => array(

        //...
        'PapyalSubscription'  => leifermendez\paypal\PaypalSubscriptionFacade,

    ),
```

#### Uso

[](#uso)

> Recuerda colocar tus credenciales en tu archivo .env , Mode: "test" or "live"

```
# PAYPAL SUBSCRIPTION

PAYPAL_APP_ID=xxxxxxxxxxxx
PAYPAL_APP_SK=xxxxxxxxxxxx
PAYPAL_APP_MODE=test

```

---

#### Productos

[](#productos)

Si quieres ver todas las opciones posibles

[https://developer.paypal.com/docs/api/catalog-products/v1/#products\_create](https://developer.paypal.com/docs/api/catalog-products/v1/#products_create)

**CREAR (producto)**

```

    $product = [
        'name' => 'iPhone X',
        'description' => 'Awesome item, phone, etc',
        'type' => 'SERVICE',
        'category' => 'SOFTWARE',
        'image_url' => 'https://avatars.githubusercontent.com/u/15802366?s=460&u=ac6cc646599f2ed6c4699a74b15192a29177f85a&v=4',
        'home_url' => 'https://github.com/leifermendez/laravel-paypal-subscription',
    ];

    $response = PapyalSubscription::createProduct($product);

    dd($response);
```

**LISTAR (producto)**

```
    $response = PapyalSubscription::getProduct();
    dd($response);
```

#### Planes

[](#planes)

Si quieres ver todas las opciones posibles

**CREAR (plan)**

```

    $plan = [
        'name' => 'Video Streaming Service Plan',
        'description' => 'Video Streaming Service basic plan',
        'status' => 'ACTIVE',
        'billing_cycles' => [
            [
                'frequency' => [
                    'interval_unit' => 'MONTH',
                    'interval_count' => '1'
                ],
                'tenure_type' => 'REGULAR',
                'sequence' => '1',
                'total_cycles' => '12',
                'pricing_scheme' => [
                    'fixed_price' => [
                        'value' => '3',
                        'currency_code' => 'USD'
                    ]
                ]
            ]
        ],
        'payment_preferences' => [
            'auto_bill_outstanding' => 'true',
            'setup_fee' => [
                'value' => '10',
                'currency_code' => 'USD'
            ],
            'setup_fee_failure_action' => 'CONTINUE',
            'payment_failure_threshold' => '3'
        ],
        'taxes' => [
            'percentage' => '10',
            'inclusive' => false
        ]
    ];

    $product = [
        'product_id' => 'PROD-5C186753RC8244822' // '2022-11-01T00:00:00Z',
        'quantity' => '1',
        'shipping_amount' => [
            'currency_code' => 'USD',
            'value' => '10'
        ],
        'subscriber' => [
            'name' => [
                'given_name' => 'Leifer',
                'surname' => 'Mendez'
            ],
            'email_address' => 'leifer@test.com',
            'shipping_address' => [
                'name' => [
                    'full_name' => 'Joe'
                ],
                'address' => [
                    'address_line_1' => '2211 N First Street',
                    'address_line_2' => 'Building  17',
                    'admin_area_2' => 'San Jose',
                    'admin_area_1' => 'CA',
                    'postal_code' => '95131',
                    'country_code' => 'US'
                ]
            ]
        ],
        'application_context' => [
            'brand_name' => 'Racks',
            'locale' => 'es-ES',
            'shipping_preference' => 'SET_PROVIDED_ADDRESS',
            'user_action' => 'SUBSCRIBE_NOW',
            'payment_method' => [
                'payer_selected' => 'PAYPAL',
                'payee_preferred' => 'IMMEDIATE_PAYMENT_REQUIRED',
            ],
            'return_url' => 'https://github.com/leifermendez?status=returnSuccess',
            'cancel_url' => 'https://github.com/leifermendez?status=cancelUrl'

        ]
    ];

    $plan = [
        'plan_id' => 'P-6LP13543ED649531TMAWPBHA' //
