Recommend this page to a friend! |
Classes of mbjwebdevelopment | All in One PayPal WooCommerce Plugin | admin/partials/lib/paypal-digital-goods/README.md | Download |
|
DownloadPayPal Digital Goods PHP LibraryPayPal's Digital Goods for Express Checkout service is a great payment solution with a needlessly complicated API and an unfortunately verbose name. This library makes it easier to write code using the PayPal Digital Goods API. It supports both one off purchases and recurring payments (subscriptions). To see the library in action, visit my PayPal Digital Goods Demo. If you are not a programmer, or just want to save yourself the heartache of working with PayPal APIs, try setting up PayPal Digital Goods with WooCommerce - no code required. Why Use a ClassUsing a class to interact with the PayPal API provides all the advantages you love about Object-Oriented programming:
ExamplesLike to learn by example? Check out the PayPal Digital Goods PHP Examples repository. Live DemoWant to see a live example of Recurring Payments with PayPal's Digital Goods for Express Checkout? Take a look at my PayPal Digital Goods Demo. UsageConfigurationBefore creating a payment, you need to register a few settings with the The minimum configuration settings required are your PayPal API Credentials, a return URI and cancel URI.
Once the PayPal library is configured, you can create a Purchase or Subscription object, or a few of each if you prefer. Creating a Purchase ObjectThe Below is a quick example which creates a purchase of two different goods with a total transaction value of $12.00.
These are the purchase details used in the PayPal Digital Goods PHP Examples repository. Creating a SubscriptionThe Below is a quick example which creates a $2/week subscription for 4 weeks with a $10.00 sign-up fee.
Note, it is highly recommend you include the subscription amounts and details in the Adding the PayPal Buy ButtonOnce you have created a purchase or subscription object, the rest is simple. Add the following line to your checkout or payment page. It will add all necessary scripts and set-up the transaction with PayPal.
Processing a Payment and Starting a SubscriptionWhen a user returns from PayPal, processing their payment or starting their subscription is also a one line operation. Process a PaymentTo process a payment once a user has authorized the purchase with PayPal, call the
Start a SubscriptionTo start a subscription after a user has authorized the recurring payment plan with PayPal, call the
From Sandbox to a Live EnvironmentBy default, the library uses the PayPal Sandbox. Switching from the Sandbox to the live PayPal site is easy, set the
Supported PayPal OperationsSupported PayPal API Operations:
Using the Library as a Git SubmoduleTo use the library as a submodule in your application's main git repository, use the following command:
When cloning your application's Git repo, be sure to specify the --recursive option to include the contents of the PayPal submodule.
Further ReadingPayPal has hidden some excellent articles within the x.commerce dev zone, including:
Pull RequestsPatches are welcome To submit a patch:
The class is written to be friendly to humans, so place special emphasis on readability of your code. It is more important than cleverness and brevity. Your syntax should conform to the WordPress Coding Standards. Provide a brief explanation of each functions purpose in header comments, and comment inline only to explain why your code works. Let your code explain how. >Programs must be written for people to read, and only incidentally for machines to execute. >— Structure and Interpretation of Computer Programs Other NotesRecurring payments are not available for German PayPal accounts. |