Learn more  » Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

jsarnowski / jsarnowski/elementor-pro   php

Repository URL to install this package:

Version: 3.2.1 

/ modules / payments / widgets / paypal-button.php.md

Paypal-Button.php

Product Knowledge Base:

Technical Description:

This class handles the PayPal button widget.

As of writing those lines, it only supports the legacy payments API of PayPal.

We planned on adding support for the Payments API using the PHP || JavaScript SDKs but unfortunately both of them where not suitable for our needs.

JavaScript SDK ( AKA "Smart Buttons" ):

  • The fast & easy-to-use option, but lack the support of button styling.

  • Forces you to pass basic argument like currency or locale as a query parameter to the script ( See here ).

    That means you are limited to a single currency type for each page.

PHP SDK:

  • You can style the button ( well, you use it with AJAX and you are not bounded to PayPal's style, so... ).

  • PayPal created a nice Checkout SDK which works well, but luckily for us, it doesn't support anything other than a simple checkout request. Hurray! 🎉

    We tried extending the SDK to at least support subscriptions, but creating a subscription in PayPal is complicated for the goal of a simple widget:

    You need to create a Product, attach to a Plan and finally pass it to a Subscription.

They both also don't support donations, so we dropped this idea.

Attention Needed / Known Issues:

  • get_numeric_setting( $key, $min ) retrieves a value by key from get_settings(), and return it as a numeric value, or defaults to $min if it's non-existent or invalid.

  • get_errors() handles basic validations and returns an array of errors.

  • get_api_method() && render_legacy_form() are leftovers from the time we tried using the Payments API and might be used in the future if PayPal will provide a simpler API.