npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

apostrophe-donate

v0.5.14

Published

Donate module for Apostrophe CMS

Downloads

38

Readme

#apostrophe-donate apostrophe-donate allows a developer to quickly add a donation form to a webpage on an apostrophe-sandbox-powered website. It uses the paypal-api-sdk module to process payments and allows email configuration to the donor and recipient of the donation.

Installation

I assume you already have a nifty Apostrophe 2 project built with apostrophe-site. The easiest way is to start by cloning the apostrophe-sandbox project.

Add the module to your project:

npm install --save apostrophe-donate

Configuration

In app.js, you'll need to configure the apostrophe-donate module, just like the rest of your modules:

    'apostrophe-donate': {
      // production has this in local.js
      payPal: {
        mode: 'sandbox',
        client_id: 'xxxxxx',
        client_secret: 'xxxxxx'
      },
      description: 'Donation for P\'unk Ave', //description of transaction
      // configure the email to send to the donor
      from:{
        email: '[email protected]',
        name: 'First Last'
      },
      // configure the email to send to the recipient of the donation
      recipient:{
        email: '[email protected]',
        name: 'Recipient'
      },
      thankYouSubject: 'Thanks!', // subject of the email to the donor
      confirmationSubject: 'Yay!' // subject of the email to send to the recipient of the donation,
      // Your recaptcha 2.0 key and secret. IF YOU LEAVE THIS OUT,
      // YOU *WILL* GET OWNED BY CREDIT CARD FRAUD TESTERS. DON'T
      // leave this out
      recaptcha: {
        key: 'xxx',
        secret: 'yyy'
      }
    }

The client_id and client_secret are retrieved after setting up a pro account with PayPal and registering your application.

Registering an app with PayPal

  • Login to PayPal and go to https://developer.paypal.com
  • Click Applications, then click Create App.
  • Give your app a name and leave the defaults in place for the sandbox developer account field.
  • Click the Create App
  • Under Test Credentials, note the Client ID and Secret. These are for your local data/local.js configuration so as to not be playing with real money in development.
  • Under Live Credentials, click Show to find the production Client ID and Secret

Registering your recaptcha 2.x key and secret

See the recaptcha documentation. You WILL regret skipping this step. Fraudsters routinely use legitimate sites to test stolen cards in bulk.

Inclusion

Add this line to the template of your choice where you want the form to appear

{{ aposDonationForm() }}

Assets

apostrophe-donate comes with a lot of pre-baked things.

Templates

  • form.html - donation form generated with apostrophe-schemas's schemaMacros. You can redefine the schema in index.js.
  • formWrapper.html - a wrapper for the form
  • recipientEmail.html, recipientEmail.txt - email template sent to the recipient of the donation after successful form submission
  • thankYou.html - thank you message displayed after successful form submission
  • thankYouEmail.html, thankYouEmail.txt - email sent to the donor after successful form submission.

Extras

Pre-baked styles in content.less and a spinner.gif for backward compatible ui goodness