Ti.Paypal Module

Description

The Ti.Paypal module gives you access to payments via paypal for goods and services. Note that Apple does not accept payment through any means other than the in-app purchasing store for extensions and subscriptions for your app.

Getting Started

View the Using Titanium Modules document for instructions on getting started with using this module in your application.

Accessing the Ti.Paypal Module

To access this module from JavaScript, you would do the following:

var Paypal = require("ti.paypal");

Functions

Ti.Paypal.createPaypalButton({...})

Creates and returns a Ti.Paypal.PaypalButton object, which is a view. Note that the view's size determines the amount of space on the screen it takes up, not the size of the Paypal button, which is determined by a constant.

WARNING: A paypal button may only be used once! It is designed to be created for one transaction. If the user cancels the transaction, or goes through with it, you must recreate the paypal button before allowing them to touch it again.

Takes one argument, a dictionary containing the following properties:

To submit a simple payment, you should also set the following property:

Or, to submit an advanced payment (such as a chained or parallel payment), set the following property. Note that the only programmatic difference between chained and parallel payments is the "isPrimary" property set on one of your advanced payments.

Or, to submit a Preapproval for payment, set the following properties.

NOTE: Once set on a button, payment information CANNOT be changed.

Properties

Properties - Text Types for Paypal Button

Ti.Paypal.PAYPAL_TEXT_PAY[int] (read-only)

A constant for a button's "textStyle" property causing "Pay" to be displayed.

Ti.Paypal.PAYPAL_TEXT_DONATE[int] (read-only)

A constant for a button's "textStyle" property causing "Donate" to be displayed.

Properties - Payment Types

Ti.Paypal.PAYMENT_TYPE_GOODS[int] (read-only)

A constant for a button's "transactionType" property which denotes the sale of physical goods. This is the default payment type.

Ti.Paypal.PAYMENT_TYPE_SERVICE[int] (read-only)

A constant for a button's "transactionType" property which denotes the sale of a service.

Ti.Paypal.PAYMENT_TYPE_PERSONAL[int] (read-only)

A constant for a button's "transactionType" property which denotes a personal payment.

Ti.Paypal.PAYMENT_TYPE_NONE[int] (read-only)

A constant for a button's "transactionType" property which denotes a payment where no money is exchanged.

Properties - Preapproval Types

Ti.Paypal.PREAPPROVAL_TYPE_AGREE_AND_PAY[int] (read-only)

Ti.Paypal.PREAPPROVAL_TYPE_AGREE[int] (read-only)

Properties - Preapproval Days

Ti.Paypal.PREAPPROVAL_DAY_SUNDAY[int] (read-only)

Ti.Paypal.PREAPPROVAL_DAY_MONDAY[int] (read-only)

Ti.Paypal.PREAPPROVAL_DAY_TUESDAY[int] (read-only)

Ti.Paypal.PREAPPROVAL_DAY_WEDNESDAY[int] (read-only)

Ti.Paypal.PREAPPROVAL_DAY_THURSDAY[int] (read-only)

Ti.Paypal.PREAPPROVAL_DAY_FRIDAY[int] (read-only)

Ti.Paypal.PREAPPROVAL_DAY_SATURDAY[int] (read-only)

Properties - Preapproval Periods

Ti.Paypal.PREAPPROVAL_PERIOD_ANNUALLY[int] (read-only)

Ti.Paypal.PREAPPROVAL_PERIOD_BIWEEKLY[int] (read-only)

Ti.Paypal.PREAPPROVAL_PERIOD_DAILY[int] (read-only)

Ti.Paypal.PREAPPROVAL_PERIOD_MONTHLY[int] (read-only)

Ti.Paypal.PREAPPROVAL_PERIOD_NONE[int] (read-only)

Ti.Paypal.PREAPPROVAL_PERIOD_SEMIMONTHLY[int] (read-only)

Ti.Paypal.PREAPPROVAL_PERIOD_WEEKLY[int] (read-only)

Properties - Button Sizes

Ti.Paypal.BUTTON_152x33[int] (read-only)

A paypal button sized for a 152x33 pixel view.

Ti.Paypal.BUTTON_194x37[int] (read-only)

A paypal button sized for a 194x37 pixel view.

Ti.Paypal.BUTTON_278x43[int] (read-only)

A paypal button sized for a 278x43 pixel view.

Ti.Paypal.BUTTON_294x45[int] (read-only)

A paypal button sized for a 294x45 pixel view.

Properties - Environments

Ti.Paypal.PAYPAL_ENV_LIVE[int] (read-only)

Sets paypal to use the production servers for processing payments. Payments are actual transactions.

Ti.Paypal.PAYPAL_ENV_SANDBOX[int] (read-only)

Sets paypal to use the testing servers for processing payments. Payments use testing funds in the development sandbox.

Ti.Paypal.PAYPAL_ENV_NONE[int] (read-only)

Sets paypal to use internal demonstration data for payments and server operations.

Properties - Payment Subtypes

The payment subtype for a "SERVICES" type payment (see enumerated values section). Applicable only if you have been approved for special pricing plans. For any transactionType other than "TYPE_SERVICE" or if you have not been approved for special pricing plans use "SUBTYPE_NOT_SET" (the default value) as the transactionSubType.

Ti.Paypal.PAYMENT_SUBTYPE_NONE [int] (read-only)

Ti.Paypal.PAYMENT_SUBTYPE_AFFILIATE [int] (read-only)

Ti.Paypal.PAYMENT_SUBTYPE_B2B [int] (read-only)

Ti.Paypal.PAYMENT_SUBTYPE_PAYROLL [int] (read-only)

Ti.Paypal.PAYMENT_SUBTYPE_REBATES [int] (read-only)

Ti.Paypal.PAYMENT_SUBTYPE_REFUNDS [int] (read-only)

Ti.Paypal.PAYMENT_SUBTYPE_REIMBURSEMENTS [int] (read-only)

Ti.Paypal.PAYMENT_SUBTYPE_DONATIONS [int] (read-only)

Ti.Paypal.PAYMENT_SUBTYPE_UTILITIES [int] (read-only)

Ti.Paypal.PAYMENT_SUBTYPE_TUITION [int] (read-only)

Ti.Paypal.PAYMENT_SUBTYPE_GOVERNMENT [int] (read-only)

Ti.Paypal.PAYMENT_SUBTYPE_INSURANCE [int] (read-only)

Ti.Paypal.PAYMENT_SUBTYPE_REMITTANCES [int] (read-only)

Ti.Paypal.PAYMENT_SUBTYPE_RENT [int] (read-only)

Ti.Paypal.PAYMENT_SUBTYPE_MORTGAGE [int] (read-only)

Ti.Paypal.PAYMENT_SUBTYPE_MEDICAL [int] (read-only)

Ti.Paypal.PAYMENT_SUBTYPE_CHILDCARE [int] (read-only)

Ti.Paypal.PAYMENT_SUBTYPE_EVENTS [int] (read-only)

Ti.Paypal.PAYMENT_SUBTYPE_CONTRACTORS [int] (read-only)

Ti.Paypal.PAYMENT_SUBTYPE_ENTERTAINMENT [int] (read-only)

Ti.Paypal.PAYMENT_SUBTYPE_TOURISM [int] (read-only)

Ti.Paypal.PAYMENT_SUBTYPE_INVOICE [int] (read-only)

Ti.Paypal.PAYMENT_SUBTYPE_TRANSFER [int] (read-only)

Events

For legacy support, this module fires all of the events from created Ti.Paypal.PaypalButton. Adding event listeners here is deprecated, and will be removed in a future version of the module.

Usage

See example.

Author

Stephen Tramer

Module History

View the change log for this module.

Feedback and Support

Please direct all questions, feedback, and concerns to info@appcelerator.com.

License

Copyright(c) 2010-2013 by Appcelerator, Inc. All Rights Reserved. Please see the LICENSE file included in the distribution for further details.