2017 © Pedro Peláez
 

library paypal-ewp

A PHP library for generating encrypted PayPal buttons (EWP)

image

pkerrigan/paypal-ewp

A PHP library for generating encrypted PayPal buttons (EWP)

  • Saturday, May 19, 2018
  • by patrickkerrigan
  • Repository
  • 1 Watchers
  • 1 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 44 % Grown

The README.md

Build Status Maintainability Test Coverage PHP >=7.1 Packagist, (*1)

paypal-ewp

A PHP library for generating encrypted PayPal buttons (EWP), (*2)

Prerequisites

To use this library you should first follow the instructions given by PayPal on generating a merchant certificate and key pair and obtaining PayPal's public certificate., (*3)

You'll need the following data to generate a button: * Your Certificate ID issued by PayPal after you uploaded your certificate * The path to your certificate in PEM format on disk * The path to your private key in PEM format on disk * The passphrase for your private key (if you set one) * The path to PayPal's public certificate in PEM format on disk * The HTML Variables you wish to add to your button, (*4)

Installation

The recommended way to install this library is via Composer:, (*5)

composer require pkerrigan/paypal-ewp ^1

Usage

Below is a complete example which generates an encrypted button for submitting a shopping cart:, (*6)

<?php

use Pkerrigan\PaypalEwp\PaypalCertificate;
use Pkerrigan\PaypalEwp\MerchantCertificate;
use Pkerrigan\PaypalEwp\ButtonGenerator;

$buttonGenerator = new ButtonGenerator();

$paypalCert = new PaypalCertificate('/path/to/certs/paypal-cert.pem');

$merchantCert = new MerchantCertificate(
    'MY_CERTIFICATE_ID',
    '/path/to/certs/merchant-cert.pem',
    '/path/to/certs/merchant-key.pem',
    'MY_KEY_PASSPHRASE' //This argument can be omitted if you have no passphrase
);

$buttonVariables = [
    'cmd' => '_cart',
    'upload' => '1',
    'amount_1' => '1.00',
    'item_name_1' => 'Test Item',
    'business' => 'test@example.org',
    'currency_code' => 'GBP'
];

$encryptedCart = $buttonGenerator->encrypt($paypalCert, $merchantCert, $buttonVariables);

?>

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_s-xclick">
    <input type="hidden" name="encrypted" value="<?= $encryptedCart; ?>">
    <input type="submit" value="Proceed to checkout">
</form>

The Versions

19/05 2018

dev-master

9999999-dev

A PHP library for generating encrypted PayPal buttons (EWP)

  Sources   Download

BSD-3-Clause

The Requires

  • php >=7.0
  • ext-openssl *

 

The Development Requires

payments paypal ewp encrypted buttons

06/01 2018

v1.0.1

1.0.1.0

A PHP library for generating encrypted PayPal buttons (EWP)

  Sources   Download

BSD-3-Clause

The Requires

  • php >=7.0
  • ext-openssl *

 

The Development Requires

payments paypal ewp encrypted buttons

30/12 2017

v1.0.0

1.0.0.0

A PHP library for generating encrypted PayPal buttons (EWP)

  Sources   Download

BSD-3-Clause

The Requires

  • php >=7.0
  • ext-openssl *

 

The Development Requires

payments paypal ewp encrypted buttons