Skip to content

Instantly share code, notes, and snippets.

@yokada
Last active December 11, 2015 02:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yokada/4528232 to your computer and use it in GitHub Desktop.
Save yokada/4528232 to your computer and use it in GitHub Desktop.
var m = require('ti.paypal');
var appID = 'MY-LIVE-APP-ID'; // live App ID
var env = m.PAYPAL_ENV_LIVE; // live
var recip = 'info@example.com'; // live
var btn = m.createPaypalButton({
// NOTE: height/width only determine the size of the view that the button is embedded in - the actual button size
// is determined by the buttonStyle property!
width : 278,
height : 60,
buttonStyle : m.BUTTON_278x43, // The style & size of the button
top : 10,
language : 'ja_JP',
textStyle : m.PAYPAL_TEXT_PAY, // Causes the button's text to change from "Pay" to "Donate"
appID : appID, // The appID issued by Paypal for your application; for testing, feel free to delete this property entirely.
paypalEnvironment : env, // Sandbox, None or Live
feePaidByReceiver : false,
enableShipping : false, // Whether or not to select/send shipping information
payment : {// The payment itself
paymentType : m.PAYMENT_TYPE_SERVICE, // The type of payment
subtotal : 10, // The total cost of the order, excluding tax and shipping
tax : 0,
shipping : 30,
currency : 'JPY',
recipient : recip,
customID : 'anythingYouWant',
invoiceItems : [{
name : 'Shoes',
totalPrice : 6,
itemPrice : 6,
itemCount : 1
}, {
name : 'Hats',
totalPrice : 4,
itemPrice : 4,
itemCount : 1
}],
merchantName : 'myapp1',
memo : 'For the orphans and widows in the world!'
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment