> For the complete documentation index, see [llms.txt](https://roayati.gitbook.io/paypal-pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://roayati.gitbook.io/paypal-pro/getting-started/subscription-payment.md).

# Subscription payment

## PayPal Pro Subscription Element Guide for Bubble.io 💳

### Overview 🔎

A comprehensive guide for implementing PayPal subscription payments using the PayPal Pro Element in Bubble.io. This element enables recurring payments and subscription management.

The Subscription element enables recurring payments with PayPal for subscription-based services. Set unique plans with custom IDs, billing frequencies, and pricing, providing flexibility for various subscription tiers. This element manages automatic billing cycles, simplifying the setup of ongoing customer relationships with reliable payment processing.

### Prerequisites ✅

* PayPal Business account
* PayPal Client ID / Secret ID
* Active PayPal subscription plan

### Element Setup in Bubble Editor 🛠️

#### Basic Configuration

1. Drag the "PayPal Pro (Subscription)" element onto your page
2. Set the following required properties:
   * Plan ID
   * Client ID (in plugin settings) \*both dev and live
   * Secret Key (in plugin settings) \*both dev and live

#### Visual Properties

| Property  | Description                      | Options                          |
| --------- | -------------------------------- | -------------------------------- |
| Plan ID   | Your PayPal subscription plan ID | Text input                       |
| Shape     | Button shape style               | Rectangle, Pill                  |
| Layout    | Button layout orientation        | Vertical, Horizontal             |
| Color     | Button color scheme              | Gold, Blue, Silver, White, Black |
| Label     | Button text                      | PayPal, Subscribe, Checkout      |
| Show Logs | Enable debugging logs            | Yes/No                           |

#### Element States

| State           | Description                    |
| --------------- | ------------------------------ |
| Subscription ID | Active subscription identifier |
| Order ID        | PayPal order reference         |
| Error           | Error message if payment fails |

#### Events

| Event    | Description                             |
| -------- | --------------------------------------- |
| Approved | Triggered when subscription is approved |
| Error    | Triggered when an error occurs          |

### Implementation Guide 📝

#### Step 1: Create PayPal Subscription Plan

1. Log into PayPal Business account
2. Navigate to Subscription Plans
3. Create a new plan
4. Copy the Plan ID

#### Step 2: Configure Element

In Bubble editor:

1. Set Plan ID
2. Choose button style:

   ```bubble
   Shape: Rectangle
   Color: Gold
   Label: Subscribe
   Layout: Vertical
   ```

#### Step 3: Set Up Workflows

Example workflow:

```bubble
When PayPal Subscription - Approved
- Create New User Subscription
  → Subscription ID: PayPal Subscription's Subscription ID
  → Status: Active
  → Start Date: Current Date/Time
```

### Styling Guide 🎨

#### Button Appearance Options

* **Shapes:**
  * Rectangle (Default)
  * Pill
* **Colors:**
  * Gold (Recommended)
  * Blue
  * Silver
  * White
  * Black
* **Labels:**
  * PayPal
  * Subscribe
  * Checkout

### Best Practices 👍

1. Always test in Sandbox mode first
2. Store subscription IDs securely
3. Implement proper error handling
4. Set up webhook notifications
5. Monitor subscription status

### Workflow Examples 💡

#### Basic Subscription Setup

```bubble
When Page is loaded
- Set PayPal Element's Plan ID
- Show PayPal Button
```

#### Success Handling

```bubble
When PayPal Subscription - Approved
- Create Subscription Record
- Send Welcome Email
- Redirect to Dashboard
```

#### Error Handling

```bubble
When PayPal Subscription - Error
- Display Error Message
- Log Error Details
- Show Support Contact
```

### Testing Guidelines 🧪

#### Test Scenarios

1. New subscription creation
2. Payment method validation
3. Error handling
4. Subscription cancellation
5. Renewal process

#### Sandbox Testing

1. Use PayPal Sandbox credentials
2. Test with various plan types
3. Verify webhook responses
4. Check error scenarios

### Troubleshooting 🔧

#### Common Issues

1. Button not displaying
   * Check Plan ID
   * Verify Client ID
   * Confirm element visibility
2. Subscription failures
   * Validate plan status
   * Check payment method
   * Review error logs

### Security Considerations 🔒

#### Best Practices

1. Secure credential storage
2. Implement SSL
3. Validate webhook signatures
4. Monitor transactions
5. Regular security audits

### Integration Checklist ✅

#### Before Launch

* [ ] Valid PayPal Business account
* [ ] Active subscription plan
* [ ] Configured Client ID
* [ ] Tested in Sandbox
* [ ] Error handling implemented
* [ ] Webhooks configured
* [ ] Success flows tested
* [ ] Mobile responsiveness checked

### Support & Resources 📚

#### Documentation

* PayPal Developer Docs
* Bubble.io Forums
* Plugin Documentation

#### Help Channels

* PayPal Support
* Bubble.io Community
* Developer Forums

### FAQs 💭

#### Common Questions

Q: How do I get my Plan ID? A: Create a subscription plan in PayPal Business dashboard and copy the Plan ID

Q: Can I customize the button style? A: Yes, using Shape, Color, and Label properties

Q: How do I test subscriptions? A: Use PayPal Sandbox environment with test accounts

Would you like me to expand on any particular section?
