Skip to content

Latest commit

 

History

History
37 lines (30 loc) · 1.58 KB

README.md

File metadata and controls

37 lines (30 loc) · 1.58 KB

Apps Script PayPal IPN Listener

This is a super-simple Google Apps Script Library project that provides a minimal API for interacting with the PayPal IPN postback service.

Usage

  1. Add the Library to your Google Apps Script project.
    • Use the library's Script ID (not its "Project Key"); the Script ID can be found in this repository's .clasp.json file.
  2. Choose a sensible identifier for the library in your project. The examples below assume the use of the default PayPalIPNListener identifier.
  3. Use this library's API in your code.

Full documentation is provided in JSDoc documentation blocks in the comments preceeding each function.

Example Usage

A simple example:

/**
 * Example project's HTTP POST handler.
 *
 * @see https://developers.google.com/apps-script/guides/triggers/#dogete_and_doposte
 */
function doPost (e) {
    if (PayPalIPNListener.isIpnMessage(e)) {
        if (PayPalIPNListener.isValid(e)) {
            // Verification successul, so continue processing.
            // This means the PayPal payment is valid, not necessarily
            // that it meets your business needs. For example, you
            // should write code that ensures that the payment amount
            // is what you expect it to be, etc.
        } else {
            Logger.log('PayPal verification failed.');
        }
    }
}