Created
June 30, 2010 18:58
-
-
Save dasher/459075 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Let's make a funky Window | |
var win = Titanium.UI.createWindow({ | |
backgroundColor:'#F00', | |
left: 0, | |
top: 0, | |
zIndex: 0 | |
}); | |
// | |
// Paypal Button | |
// | |
var ppButton = Titanium.Paypal.createPaypalButton( | |
{ | |
// Button Details | |
// Note - you can override the button size as defined by Paypal - but it's not a good idea | |
height:30, | |
width:100, | |
top: 10, | |
left: 10, | |
appId: "APP-80W284485P519543T", // The appID issued by Paypal for your application - APP-80W284485P519543T is the default Paypal test ID | |
buttonStyle: Titanium.Paypal.BUTTON_68x24, // The style & size of the button | |
paypalEnvironment: Titanium.Paypal.PAYPAL_ENV_SANDBOX, // Sandbox, None or Live | |
feePaidByReceiver: false, // This will only be applied when the transaction type is Personal | |
transactionType: Titanium.Paypal.PAYMENT_TYPE_DONATION, // The type of payment | |
// The payment itself | |
payment: | |
{ | |
amount: 12.99, | |
tax: 0.00, | |
shipping: 0.00, | |
currency: "USD", | |
recipient: "moneyBags@biz.near.me", | |
itemDescription: "Donation", | |
merchantName: "Dev Tools", | |
senderEmailOrPhone: "joe@spendThrift.com" | |
} | |
}); | |
// Events available | |
ppButton.addEventListener("paymentCancelled", function(e){ | |
Titanium.API.log("1","Payment Cancelled"); | |
}); | |
ppButton.addEventListener("paymentSuccess", function(e){ | |
Titanium.API.log("1","Payment Success. TransactionID: "+e.transactionID); | |
}); | |
ppButton.addEventListener("paymentError", function(e){ | |
Titanium.API.log("1","Payment Error"); | |
Titanium.API.log("1","errorCode: "+e.errorCode); | |
Titanium.API.log("1","errorMessage: "+e.errorMessage); | |
}); | |
// Add it to the window | |
win.add(ppButton); | |
// Opent the window | |
win.open(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment