Skip to content

Commit 935a554

Browse files
committed
Merge pull request #8 from jeffharrell/enhancements
Enhancements
2 parents 3eaf206 + 4f4e01b commit 935a554

7 files changed

Lines changed: 188 additions & 110 deletions

File tree

README.md

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Integrating with our HTML payment buttons are as easy as including a snippet of code. [Try it out and configure your own](http://paypal.github.com/JavaScriptButtons/).
44

5-
We have two flavors of buttons for you to use:
5+
We have a few flavors of buttons for you to use:
66

77
### Buy Now
88
Buy Now buttons are for single item purchases.
@@ -51,32 +51,39 @@ All of PayPal's [HTML button variables](https://cms.paypal.com/us/cgi-bin/?cmd=_
5151
* `data-size` For button images: `small` and `large` work. For QR codes enter the pixel length of the longest side.
5252
* `data-id` The hosted ID of the button (if applicable).
5353

54+
## Editable fields
55+
Creating editable fields is easy! Just add `-editable` to the name of your variable, e.g. `data-quantity-editable`, and an input field will magically appear for your users.
5456

55-
## Getting your Merchant ID
56-
Your merchant ID needs to be added to the URL of the referenced script. This ID can either be your Secure Merchant ID, which can be found by logging into your PayPal account and visiting your profile, or your email address.
57-
58-
59-
## Download
60-
To download the production-ready JavaScript you'll need to save one of these files:
61-
62-
* [JavaScript Buttons](https://github.com/paypal/JavaScriptButtons/blob/master/dist/paypal-button.min.js)
63-
* [JavaScript Buttons + MiniCart](https://github.com/paypal/JavaScriptButtons/blob/master/dist/paypal-button-minicart.min.js)
6457

65-
The first file gives you support for PayPal's JavaScript buttons. The second file has the same code from the first, but also contains functionality for the [PayPal Mini Cart](https://github.com/jeffharrell/MiniCart).
66-
67-
To see the un-minified code you can take a peek at [paypal-button.js](https://github.com/paypal/JavaScriptButtons/blob/master/src/paypal-button.js).
58+
## Localization
59+
* Changing the default language of a button can be done by setting the variable `data-lc` with the correct locale code, e.g. es_ES.
60+
* Changing the default input labels of editable buttons can be done by overriding the default configuration, e.g. PAYPAL.apps.ButtonFactory.config.labels.
6861

6962

7063
## JavaScript API
7164
There's even a fancy JavaScript API if you'd like to pragmatically create your buttons.
7265

66+
**PAYPAL.apps.ButtonFactory.config**
67+
This can be overridden to change the default behavior of the buttons.
68+
7369
**PAYPAL.apps.ButtonFactory.create(data, type, parentNode)**
7470
Creates and returns an HTML element that contains the button code.
7571
> **data** - A JavaScript object containing the button variables
7672
> **type** - The button type, e.g. "buynow", "cart", "qr"
7773
> **parentNode** - An HTML element to add the newly created button to (Optional)
7874
7975

76+
## Download
77+
To download the production-ready JavaScript you'll need to save one of these files:
78+
79+
* [JavaScript Buttons](https://github.com/paypal/JavaScriptButtons/blob/master/dist/paypal-button.min.js)
80+
* [JavaScript Buttons + MiniCart](https://github.com/paypal/JavaScriptButtons/blob/master/dist/paypal-button-minicart.min.js)
81+
82+
The first file gives you support for PayPal's JavaScript buttons. The second file has the same code from the first, but also contains functionality for the [PayPal Mini Cart](https://github.com/jeffharrell/MiniCart).
83+
84+
To see the un-minified code you can take a peek at [paypal-button.js](https://github.com/paypal/JavaScriptButtons/blob/master/src/paypal-button.js).
85+
86+
8087
## Browser support
8188
The JavaScript buttons have been tested and work in all modern browsers including:
8289

@@ -86,6 +93,10 @@ The JavaScript buttons have been tested and work in all modern browsers includin
8693
* Internet Explorer 7+.
8794

8895

96+
## Getting your Merchant ID
97+
Your merchant ID needs to be added to the URL of the referenced script. This ID can either be your Secure Merchant ID, which can be found by logging into your PayPal account and visiting your profile, or your email address.
98+
99+
89100
## Contributing [![Build Status](https://travis-ci.org/paypal/JavaScriptButtons.png)](https://travis-ci.org/paypal/JavaScriptButtons)
90101

91102
We love contributions! If you'd like to contribute please submit a pull request via Github.

dist/paypal-button-minicart.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/paypal-button.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

grunt.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ module.exports = function (grunt) {
3131

3232

3333
// Default task.
34-
grunt.registerTask('default', 'lint min');
34+
grunt.registerTask('default', 'min');
3535

3636
};

0 commit comments

Comments
 (0)