# Welcome to PayPal Pro

### PayPal Pro Plugin for Bubble.io subscrptions and payments

A comprehensive PayPal integration solution that enables both single payments and subscription management in your Bubble application, with full API support for payment processing and subscription handling.

### Technical Requirements:

* PayPal Business Account
* Client ID and Secret Key
* SSL enabled website (https)

### Plugin Components

#### 1. PayPal (Single Payment) Element

**Properties:**

* Amount: Numeric value for payment
* Currency: Standard currency code (e.g., USD, EUR, BHD)
* Shape: Rectangle or Pill
* Color: gold, blue, silver, white, black
* Label: paypal, checkout, buynow, pay
* Expose Logs: Debug mode toggle

**States:**

* Order ID: Unique PayPal order identifier
* Capture ID: Payment capture identifier
* Order status: Current order status
* Payer name: Customer's full name
* Payer email: Customer's email address
* Payer id: PayPal payer identifier
* Error: Error information if any

**Events:**

* On Approved: Triggers when payment is authorized
* On Captured: Triggers when payment is completed
* On Error: Triggers when payment fails

#### 2. PayPal (Subscription) Element

**Properties:**

* Plan ID: PayPal subscription plan identifier
* Shape: Button shape customization
* Color: Button color options
* Label: Button text options
* Layout: Button layout style
* Expose Logs: Debug mode toggle

**States:**

* subscription\_id: Unique subscription identifier
* orderid: Associated order identifier
* error: Error information if any

**Events:**

* On Approved: Triggers when subscription is created
* On Error: Triggers on subscription creation failure

#### **3. Actions**

A. PayPal - Get Access Token

**Input Parameters:**

* Type: Sandbox/Live environment selection

**Returns:**

* Token: Access token for API operations
* Error: Error message if token generation fails

B. PayPal - Refund

**Input Parameters:**

* Sale Id: Transaction ID to refund
* Amount: Refund amount (optional)
* Currency: Refund currency (optional)
* Access Token: Valid access token
* Type: Sandbox or Live environment

**Returns:**

* ID: Refund transaction ID
* State: Refund status
* Error: Error details if refund fails

C. Get Subscription Details

**Input Parameters:**

* subscriptionId: Subscription identifier
* access token: Valid access token
* type: Sandbox/Live environment

**Returns:**

* subscriptionDetails: Complete subscription information
* error: Error message if request fails

D. Cancel Subscription

**Input Parameters:**

* subscriptionId: Subscription to cancel
* access token: Valid access token
* type: Sandbox/Live environment

**Returns:**

* status: Cancellation status
* error: Error information if cancellation fails

E. Implementation Guide

### 1. Initial Setup

1. Add PayPal credentials in **ALL fields** plugin settings:
   * Client ID
   * Secret Key
   * Client ID - dev.
   * Secret Key - dev.

### 2. Single Payment Implementation

1. Add PayPal (Single Payment) element
2. Configure required properties:
   * Set amount and currency
   * (Optional) Customize button appearance
3. Add workflow for payment events:
   * Handle On Approved
   * Handle On Captured
   * Process error events

### **3. Subscription Implementation**

1. Create subscription plan in PayPal
2. Add PayPal (Subscription) element to the page
3. Configure properties:
   * Enter Plan ID
   * (Optional) Set button styling
4. Create workflows to save subscription ID and/or order ID:
   * Subscription approval
   * Error handling

### Jump right in

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Getting Started</strong></td><td>Create your first site</td><td></td><td></td><td><a href="/pages/CyH2xJQs9yWJ1S8BYNav">/pages/CyH2xJQs9yWJ1S8BYNav</a></td></tr><tr><td><strong>Basics</strong></td><td>Learn the basics of GitBook</td><td></td><td></td><td><a href="/pages/7aUFmnCMx9m4smGncsXL">/pages/7aUFmnCMx9m4smGncsXL</a></td></tr><tr><td><strong>Publish your docs</strong></td><td>Share your docs online</td><td></td><td></td><td><a href="/pages/JjjojIyKxaiBPzzLwvtg">/pages/JjjojIyKxaiBPzzLwvtg</a></td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://roayati.gitbook.io/paypal-pro/readme.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
