Musical Score-sheets Research


The aim of this research is to find a way to display my clients musical score-sheets on the website for people to preview and then be be able to purchase the full copy. As an added bonus it would be nice to have the music being sold in score-sheet form to be there too to playable for the user.

Payment system


The payment system has already been decided in my meeting with the client to be using PayPal buttons to purchase the individual score-sheets.

The only issue then becomes how do we code that so it triggers a full copy of the score-sheet to made available to the user through the website or by email.


So what I can gather is that HTML variables are the core of getting what I want from PayPal. I want for the user to be able to purchase a score-sheet then be directed after purchase to the full product.


Now PayPal say in this developer site that each button can be individual for the product so if I redirect them after they come back from the PayPal gateway then we can direct them to the link to the full product.

The only issue with that is somebody could send the link around and other users could bypass ever having to pay for it again.

So we need something different that protects easy access to the full product but ensures the user can easily access their product again after purchase if they wish to download it more than once. An email with a temporary link could be the best solution.

After researching  PayPal developer forums I found that this type of sale comes under selling of ‘Digital Goods’ which there are a lot of third party companies (charge an average 5% per transaction) that offer to do it for you through their systems, widgets or plugins. Though the client might not agree to being charged 5% for every purchase so we’ll see if there are any alternatives first. I will try and learn to do it by myself as much I possibly can.

Using Google Mail for PayPal Digital Goods purchases

I found a guide written by  that guides you to how to simply use Google Mail to store and deliver the digital goods through PayPal. I feel this avoids having the link available to anyone through the first method we looked at by redirecting them to a particular URL.

It means they only get ONE copy of the product and if they need another copy they can always get in touch. We can then query whether they purchased it before using the PayPal payment records.


I’ll have to go to my PayPal account and when creating a product assign it a unique ID. Create the PayPal button then insert the HTML code into the relevant webpage.


Then I need to insert this script in a JavaScript (.js) format obviously amending the email addresses and product ID’s.

/* PayPal Shop with Apps Script */

/* Written by Amit Agarwal – */
[“product-001”, “useful-websites-book.pdf”],
[“product-002”, “linux-training-course.mp4”],
[“product-003”, “steve-audio-book.mp3”],
[“product-004”, “presentation-template.ppt”]

function PayPal() {

function myShop() {

var file, size, files, threads;

for (var p in PAYPAL) {

threads =“is:unread from:paypal ” + PAYPAL[p][0]);

if (threads.length > 0) {

files = DriveApp.searchFiles(‘title contains “‘ + PAYPAL[p][1] + ‘”‘);

if (files.hasNext()) {

file =;
size = file.getSize()/(1024*1024);

for (var i=0; i<threads.length; i++) {

var buyer = threads[i].getMessages()[0].getReplyTo();
var subject = “Thank you for your purchase”;
var body = “Please download the file using the link below.\n\n”;

if (size > 20) {
GmailApp.sendEmail(buyer, subject, body + file.getUrl());
} else {
GmailApp.sendEmail(buyer, subject, body, {attachments: file.getBlob()});



Then that’s it according to the guide. The script will read the clients Gmail mailbox every 5 minutes and will process all the PayPal related emails sending the digital-goods to the user.

Displaying the Musical Score Sheet

I could either manually code into the website to display the PDF with a script like the one below:-


Or I could either use a third-party Java Script Utility which does a lot of the work for me.

I think I’ll choose manually coding it in myself to keep the project challenging.


I’ll be using the manual Gmail, Google Drive and PayPal to sell/deliver the digital-goods using the method above because it also protects the clients products from being available for free if the URL is passed around. It also seems an interesting project and I had no idea something as simple as that was even possible. It was a great learning experience to learn how to do that for selling digital-goods.

In terms of displaying the musical-score sheets I’ll simply embed that with HTML but if it doesn’t look quite right I’ll have to use Java Script Utilities like ‘PDFObject’.

In terms of playing the music I’ll use HTML5 audio tags as I’ve already researched that element of the score-sheets when researching into to manipulating audio hardware through code.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s