Skip to content

Commit 4474d9b

Browse files
author
Jeff Harrell
committed
A few tweaks for hosted buttons per issue #2
1 parent 098797c commit 4474d9b

3 files changed

Lines changed: 35 additions & 19 deletions

File tree

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Buy Now buttons are for single item purchases.
1111

1212
```html
1313
<script src="paypal.js?merchant=MERCHANT_ID"
14-
data-type="buynow"
14+
data-button="buynow"
1515
data-item_name="Buy me now!"
1616
data-amount="1.00"
1717
></script>
@@ -23,7 +23,7 @@ Add To Cart buttons lets users add multiple items to their PayPal cart.
2323

2424
```html
2525
<script src="paypal.js?merchant=MERCHANT_ID"
26-
data-type="cart"
26+
data-button="cart"
2727
data-item_name="Add to cart!"
2828
data-amount="1.00"
2929
></script>
@@ -33,25 +33,25 @@ Add To Cart buttons lets users add multiple items to their PayPal cart.
3333
You can pass additional data values to the button as well. The following are currently supported:
3434

3535
**Item details**
36-
* `data-item_name` Description of the item
37-
* `data-item_number` The number of the item
36+
* `data-item-name` Description of the item
37+
* `data-item-number` The number of the item
3838
* `data-quantity` Number of items
3939
* `data-shipping` The cost of shipping this item
4040
* `data-shipping2` The cost of shipping each additional unit of this item
4141
* `data-tax` Transaction-based tax override variable
4242

4343
**Discounts**
44-
* `data-discount_amount` Discount amount associated with an item
45-
* `data-discount_amount2` Discount amount associated with each additional quantity of the item
46-
* `data-discount_rate` Discount rate (percentage) for an item
47-
* `data-discount_rate2` Discount rate (percentage) for each additional quantity of the item
48-
* `data-discount_num` Number of additional quantities of the item to which the discount applies
44+
* `data-discount-amount` Discount amount associated with an item
45+
* `data-discount-amount2` Discount amount associated with each additional quantity of the item
46+
* `data-discount-rate` Discount rate (percentage) for an item
47+
* `data-discount-rate2` Discount rate (percentage) for each additional quantity of the item
48+
* `data-discount-num` Number of additional quantities of the item to which the discount applies
4949

5050

5151
## Merchant ID
5252
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.
5353

54-
## Authors
5554

55+
## Authors
5656
**Jeff Harrell**
57-
[https://github.com/jeffharrell](https://github.com/jeffharrell)
57+
[https://github.com/jeffharrell](https://github.com/jeffharrell)

index.html

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ <h3 id="buy-now">Buy Now</h3>
129129
<p>Buy Now buttons are for single item purchases.</p>
130130

131131
<pre><code>&lt;script src="paypal.js?merchant=6XF3MPZBZV6HU"
132-
data-type="buynow"
133-
data-item_name="Buy me now!"
132+
data-button="buynow"
133+
data-item-name="Buy me now!"
134134
data-amount="1.00"
135135
&gt;&lt;/script&gt;</code></pre>
136136

@@ -139,16 +139,31 @@ <h3 id="buy-now">Buy Now</h3>
139139
data-item_name="Buy me now!"
140140
data-amount="1.00"
141141
></script>
142-
</p>
142+
143+
144+
<h3 id="hosted-buttons">Hosted Buttons</h3>
145+
146+
<p>Hosted buttons are extra secure.</p>
147+
148+
<pre><code>&lt;script src="paypal.js?merchant=6XF3MPZBZV6HU"
149+
data-button="cart"
150+
data-hosted_button_id="8R63A645E2QB6"
151+
&gt;&lt;/script&gt;</code></pre>
152+
153+
<script src="paypal.js?merchant=6XF3MPZBZV6HU"
154+
data-button="cart"
155+
data-hosted_button_id="8R63A645E2QB6"
156+
></script>
157+
143158

144159
<h3 id="add-to-cart">Add To Cart</h3>
145160

146161
<p>Add To Cart buttons lets users add multiple items to their PayPal cart.</p>
147162

148163

149164
<pre><code>&lt;script src="paypal.js?merchant=6XF3MPZBZV6HU"
150-
data-type="cart"
151-
data-item_name="Add to cart!"
165+
data-button="cart"
166+
data-item-name="Add to cart!"
152167
data-amount="1.00"
153168
&gt;&lt;/script&gt;</code></pre>
154169

paypal.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ PAYPAL.apps = PAYPAL.apps || {};
1111

1212

1313
// Don't execute the code multiple times!
14-
if (PAYPAL.apps.DynamicButton) {
15-
return;
16-
}
14+
// See issue #5
15+
//if (PAYPAL.apps.DynamicButton) {
16+
// return;
17+
//}
1718

1819

1920
var PAYPAL_URL = 'https://www.paypal.com/cgi-bin/webscr',

0 commit comments

Comments
 (0)