Paypal API 2 in the works

I am currently working on a complete rewrite of this module to refactor everything out into a much more flexible framework as suggested in #1360218: Make this module more generic.

This will allow much easier integration into new modules, other systems, etc.

The 2.x dev branch contains the current snapshot of this code, and the core can already be used. The functionality regarding content type access control is currently broken, and in fact I wouldn't use this code in a production site yet. But if you want to get a preview and start playing around with it, feel free to check out the dev branch and have a look.

Paypal API

Implements the Paypal API for Drupal sites.

With this module you may configure content types to require payment for creating or viewing. You may further limit viewing to payment per instance, or payment to view any instance of a given type.

This module does not seek to be a full-blown e-commerce system, so it will never provide a shopping cart or other e-commerce tools.

Rather, it allows developers to build e-commerce systems, using this module for the payment gateway.

Out of the box, you can configure the system to require payment to view or create given content. Paypal API manages a simple ledger to control user access to paid content.

Payments may be configured to be made either through a Pay Now button you create through your Paypal account, or Paypal API can create them for you.

If you choose to use the Paypal API, you will need to store your Paypal account email in your Drupal web site. Use of Pay Now buttons created through your control panel do not have this requirement.

Either way, the Paypal API module handles your IPN (instant payment notification) for you, and you may create custom code in your own module to handle the payment notification (through hook_paypal_api_ipn()) or else query Paypal API as necessary. See paypal_api.api.php in this package for more documentation.

Release 1.2

Version 1.2 is the latest version, and adds the following:

Anonymous user payments
Anonymous users may not purchase content, though they must be registered during the process. Registration is handled automatically by Paypal API and requires only an email address, which is collected on the form with the Paypal payment button. The user experience should be seamless.
Deferred payment
You may now configure content to accept payment AFTER content has been created. In this case, the user may create content, which will remain unpublished until the Paypal IPN notifies that payment has gone through. At this time, the content will automatically be published.


Insert your Paypal account information by going to Configuration > Paypal API (admin/config/system/paypal_api) and inserting it in the appropriate box.

Paypal API is designed to "just work" in most common use case scenarios. It also provides hooks for developers who want to further integrate payments into their site.

For information on hooks, download the module and read

For out of the box functionality, read on.

Install the module
Install the module in the usual way
Activate content types

Paypal API is designed to allow you to manage payments for arbitrary content on your web site. It is not a full e-commerce solution, and never will be. Instead, it allows you to require payment to VIEW or CREATE content on your site.

Configure content types

Once enabled, go to the content type edit form (admin/structure/types) for the content type you wish to configure. You can also see enabled content types at Configuration > Paypal API (admin/config/system/paypal_api).

Find the Paypal API tab at the bottom of the page, then click to activate that content type.

Save and then click the link that appears in the confirmation message after the form is saved. You can also got back to Configuration > Paypal API and you'll see the active content types listed.

The form is fairly self explanatory. If the in form documentation is unclear to you, please open a support request with your questions.

Using the Sandbox

Under Configuration > Paypal API > Developer Settings is a checkbox for switching over to the Paypal Sandbox for testing.

If this is checked you MUST change your Paypal account email to your sandbox account. If you don't have one, you can create one.


You should use pre-configured Paypal buttons that you create yourself if the products you are selling have a fixed price and you will not be adding discounts or changing prices according to user role or other variables.

You should use Paypal API buttons if you want to change the amount of the sale from transaction to transaction.


Project Information