Example
What you'll build
Build an integration that authenticates with PayPal using OAuth2 Client Credentials and retrieves a list of invoices, logging the result as JSON. The workflow connects to the PayPal Invoices API and binds the response to a result variable for downstream processing.
Operations used:
- List invoices : Retrieves a list of invoices from the PayPal Invoices API and binds the response to a configurable result variable
Architecture
Prerequisites
- A PayPal developer account with an app configured for OAuth2 (Client ID and Client Secret)
Setting up the PayPal invoices integration
New to WSO2 Integrator? Follow the Create a New Integration guide to set up your integration first, then return here to add the connector.
Adding the PayPal invoices connector
Step 1: Open the add connection palette
Select the + button in the Connections panel to open the Add Connection palette.
Configuring the PayPal invoices connection
Step 2: Fill in the connection parameters
Enter the connection parameters, binding each field to a configurable variable so credentials aren't hard-coded:
- Config : The OAuth2 client credentials configuration expression, referencing
paypalClientIdandpaypalClientSecretconfigurable variables - Connection Name : A name that identifies this connection on the canvas
Step 3: Save the connection
Select Save to persist the connection. The canvas updates to show the invoicesClient connection node, and the sidebar lists it under Connections.
Step 4: Set actual values for your configurables
In the left panel, select Configurations. Set a value for each configurable listed below:
- paypalClientId (string) : Your PayPal app's OAuth2 client ID
- paypalClientSecret (string) : Your PayPal app's OAuth2 client secret
Configuring the PayPal invoices list invoices operation
Step 5: Add an automation entry point and select the list invoices operation
- Navigate to the Automation canvas under Entry Points.
- Select the + add button on the canvas flow line to open the node panel.
- Expand the
invoicesClientconnection section to reveal available operations. - Select List invoices.
Step 6: Configure the list invoices operation and add a log step
- In the List invoices form, set the Result Variable to
resultso the API response is bound for downstream use. - Select Save.
- Select the + add button between the
invoices:getnode and the Error Handler node to insert a new step. - From the Logging section, select Log Info.
- In the Log Info form, switch the Msg field to Expression mode and enter
result.toJsonString(). - Select Save.
Try it yourself
Try this sample in WSO2 Integration Platform.
More code examples
The PayPal Invoices connector provides practical examples illustrating usage in various scenarios. Explore these examples, covering the following use cases:
-
Record invoice: Create and manage draft invoices with detailed billing information and line items.
-
Send and cancel invoice: Send invoices to customers and handle cancellation scenarios.





