PayPal Plugin

The PayPal plugin makes it easy to add PayPal payment processing to your apps.

Platforms:

supports iOS devices running iOS 7 or later, Android devices running Android 4.3 or later.

Functions:

Setup:

The first step is to create a new app in the PayPal developer portal. To do this, please follow the steps listed below:

    1.Log in to the My Apps & Credentials page on the PayPal developer portal.

    2.Under REST API apps, click Create App.

    3.On the Create New App page, provide an App Name.

    4.Fill in all the required fields, ensuring that you also enable all functionality you       wish to provide via PayPal in your app.

    5.Click Create App.

To obtain your PayPal credentials, you should visit your app page in the PayPal developer portal.

    1.Log in to the My Apps & Credentials page on the PayPal developer portal.

    2.Under REST API apps, select the app you created in the previous steps.

    3.Select either the sandbox or live (production) tab at the top right to obtain your       id for the desired environment.

    4.Copy the id listed under the "Client Id" field.

    5.Insert that id into your paypal.config() api call table.

paypal.init(listener)

listener(function)-- returns the following events

  • Init event(Dispatched upon the plugin successfully initialising): event.phase = "init" and event.name = "paypal"
  • Payment event(Dispatched upon a PayPal payment event): event.phase = "payment", event.name = "paypal", event.state = "completed" or "canceled", event.type = "confirmation", event.correlationId = "(string) The PayPal application correlation ID (generated by PayPal)", event.currencyCode = "(string) The currency code of the payment", event.amount = "(number) The payment amount", event.shortDescription = "(string) The value passed from "shortDescription" that you defined in paypal.show()", and event.response = "(string) The JSON-encoded response string from PayPal"
  • Future Payment event(Dispatched upon a PayPal future payment event): event.phase = "payment", event.name = "paypal", event.state = "completed" or "canceled", event.type = "confirmation", event.correlationId = "(string) The PayPal application correlation ID (generated by PayPal)", and event.response = "(string) The JSON-encoded response string from PayPal"

paypal.show(paymentType, params)

paymentType(string)(required) The type of PayPal view to show, either "payment" or "futurePayment". "payment" facilitates a single payment while "futurePayment" lets the user consent to future payments.

params(table) A table containing payment properties. See the param reference below for more info. Only the "payment" payment type accepts this table, you can omit it for "futurePayments".

Contains the following key values

  • shortDescription(string)(required) The description of the payment, for example "Hipster t-shirt".
  • currencyCode(string) The currency code of the payment. If this is omitted, PayPal will set it automatically depending on the user's country.
  • acceptCreditCards(boolean) This value determines whether or not your app allows credit card payments. This is initially set in paypal.config(), but you can optionally update the property here. If set to true, your app will allow payment by credit card and allow users to pay by scanning their credit card with the device's camera. If set to false, your app will only allow payments via a registered PayPal account. Default is true.
  • bnCode(string) Optional Build Notation code ("BN code") obtained from PayPals partner program email for your tracking purposes.
  • payment(table)(required for single payments) A table containing payment properties. See the payment reference below for more info. Param reference for payment table:
    • amount(number)(required) required numerical value for the payment amount for the transaction.
    • tax(number)(optional) optional numerical value for the amount of tax.
    • shipping(number)(optional) optional numerical value for the cost of shipping.
    • intent(string)(optional) Optional string value for the intent of the payment, either "sale" or "authorize". Default is "sale".

Contains the following key values

  • shortDescription(string)(required) The description of the payment, for example "Hipster t-shirt".
  • currencyCode(string) The currency code of the payment. If this is omitted, PayPal will set it automatically depending on the user's country.
  • acceptCreditCards(boolean) This value determines whether or not your app allows credit card payments. This is initially set in paypal.config(), but you can optionally update the property here. If set to true, your app will allow payment by credit card and allow users to pay by scanning their credit card with the device's camera. If set to false, your app will only allow payments via a registered PayPal account. Default is true.
  • bnCode(string) Optional Build Notation code ("BN code") obtained from PayPals partner program email for your tracking purposes.
  • payment(table)(required for single payments) A table containing payment properties. See the payment reference below for more info. Param reference for payment table:
    • amount(number)(required) required numerical value for the payment amount for the transaction.
    • tax(number)(optional) optional numerical value for the amount of tax.
    • shipping(number)(optional) optional numerical value for the cost of shipping.
    • intent(string)(optional) Optional string value for the intent of the payment, either "sale" or "authorize". Default is "sale".

paypal.config

Build Settings:

Credits:

this plugin was made and created by Infuse Dreams aka Danny Glover

Helpful Links:

Example

Support

Get Plugin