The ballerinax/paypal.subscriptions connector provides practical examples illustrating usage in various scenarios. Explore these examples, covering use cases like creating and listing subscription plans, and monitoring and managing subscription status.
- Create and list plans - Create a subscription plan and list all available plans for subscription-based services.
- Monitor and manage subscription status - Retrieve a subscription's status and suspend or reactivate it based on its current state.
- Manage Premium Subscription - Create a subscription plan, enroll a customer, and retrieve subscription details for a premium membership.
-
Generate PayPal credentials to authenticate the connector as described in the Setup guide.
-
For each example, create a
Config.tomlfile with the related configuration. Here's an example of how yourConfig.tomlfile should look:clientId = "<your_client_id>" clientSecret = "<your_client_secret>" productId = "<your_product_id>" # Required for create-and-list-plans, manage-premium-subscription subscriptionId = "<your_subscription_id>" # Required for monitor-and-manage-subscription
Execute the following commands to build an example from the source:
-
To build an example:
bal build
-
To run an example:
bal run
Warning: Due to the absence of support for reading local repositories for single Ballerina files, the Bala of the module is manually written to the central repository as a workaround. Consequently, the bash script may modify your local Ballerina repositories.
Execute the following commands to build all the examples against the changes you have made to the module locally:
-
To build all the examples:
./build.sh build
-
To run all the examples:
./build.sh run