PayPal Extension
Vendor
MindTouch
Type Script
Categories Widgets
Requires MindTouch Deki 1.8.3 or later
Status Stable
License Free/Open Source
Manifest http://scripts.mindtouch.com/paypal.xml

 

Table of Contents

Description

Add a PayPal button to your wiki.

See also How to add a script, Using the Extension Dialog, Learn about DekiScript, Extensions Directory.


Configuration

The following configuration settings are required to run this script (unless shown as optional).

NameTypeDescription
price/{product-name}numSet the price for the product with name 'product-name'.
emailstrThe email for your PayPal account.


Functions

paypal.buynow(name, image) : xml

Easily add a Buy Now button to your wiki page

Parameters:

NameTypeDescription
namestrName of product to sell.
imageuri(optional) Custom button image.


paypal.donate(name, image) : xml

Easily add a Donation button to your wiki page

Parameters:

NameTypeDescription
namestrName of product to sell.
imageuri(optional) Custom button image.


Script Source

<extension>
	<title>PayPal Extension</title>
  <label>PayPal</label>
  <copyright>Copyright (c) 2006-2009 MindTouch, Inc.</copyright>
  <description>Add a PayPal button to your wiki.</description>
	<uri.help>http://wiki.developer.mindtouch.com/MindTouch_Deki/Extensions/Paypal</uri.help>
	<uri.logo>http://scripts.mindtouch.com/logos/paypal-logo.gif</uri.logo> 
	<namespace>paypal</namespace>

  <config>
    <param name="price/{product-name}" type="num">Set the price for the product with name 'product-name'.</param>
    <param name="email" type="str">The email for your PayPal account.</param>
  </config>
  
	<function>
		<name>buynow</name>
		<description>Easily add a Buy Now button to your wiki page</description>
		<param name="name" type="str">Name of product to sell.</param>
		<param name="image" type="uri" optional="true">Custom button image.</param>
		<return>
			<html xmlns:eval="http://mindtouch.com/2007/dekiscript">
				<body>
					<eval:if test="!config['price'][args.name]">Product name "<eval:expr>args.name</eval:expr>" doesn't exist.  Please check your configuration.</eval:if>
					<eval:if test="config['price'][args.name]">
						<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
							<input type="hidden" name="cmd" value="_xclick" />
							<input type="hidden" name="business" eval:value="config['email']" />
							<input type="hidden" name="item_name"  eval:value="args.name" />
							<input type="hidden" name="amount" eval:value="config['price'][args.name]" />
							<input type="hidden" name="no_shipping" value="2" />
							<input type="hidden" name="no_note" value="1" />
							<input type="hidden" name="currency_code" value="USD" />
							<input type="hidden" name="bn" value="IC_Sample" />
							<input type="image" eval:src="args.image ?? 'https://www.paypal.com/en_US/i/btn/x-click-but23.gif'" name="submit" />
							<img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />
						</form>
					</eval:if>
				</body>
			</html>
		</return>
	</function>
  
	<function>
		<name>donate</name>
		<description>Easily add a Donation button to your wiki page</description>
		<param name="name" type="str">Name of product to sell.</param>
		<param name="image" type="uri" optional="true">Custom button image.</param>
		<return>
			<html xmlns:eval="http://mindtouch.com/2007/dekiscript">
				<body>
					<eval:if test="!config['price'][args.name]">Product name "<eval:expr>args.name</eval:expr>" doesn't exist.  Please check your configuration.</eval:if>
					<eval:if test="config['price'][args.name]">
						<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
							<input type="hidden" name="cmd" value="_xclick" />
							<input type="hidden" name="business" eval:value="config['email']" />
							<input type="hidden" name="item_name"  eval:value="args.name" />
							<input type="hidden" name="amount" eval:value="config['price'][args.name]" />
							<input type="hidden" name="no_shipping" value="2" />
							<input type="hidden" name="no_note" value="1" />
							<input type="hidden" name="currency_code" value="USD" />
							<input type="hidden" name="bn" value="IC_Sample" />
							<input type="image" eval:src="args.image ?? 'https://www.sandbox.paypal.com/en_US/i/btn/x-click-but21.gif'" name="submit" />
							<img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />
						</form>
					</eval:if>
				</body>
			</html>
		</return>
	</function>
</extension>


Samples

  Output

To embed the PayPal Buy Now button:

{{ paypal.buynow("wiki") }} 
./paypal buynow.png

To embed the PayPal Donation button:

{{ paypal.donate("wiki") }} 
./paypal donate.png

 

Tag page
You must login to post a comment.