Skip to content

PayPal Order

The PayPal Order component in Nappai allows you to interact with PayPal’s payment system. It acts as a bridge between your automation workflow and PayPal, enabling you to create new payment orders for customers or check the status of existing ones. This is essential for setting up checkout flows, verifying payments, and managing transactions automatically.

How it Works

This component connects to the PayPal API to manage payment orders. When you use this component, it communicates with PayPal using the credentials you configure (Client ID and Client Secret) to ensure security and authorization.

There are two main ways this component functions:

  1. Creating Orders: It builds a new order with specific details (like the amount and currency) and sends it to PayPal. PayPal then returns a unique ID for that order, which can be used to direct customers to a payment page.
  2. Retrieving Orders: It takes an existing Order ID and checks PayPal to see the current status of that payment (e.g., whether it is created, approved, or completed).

The component handles the technical authentication process in the background, so you only need to provide the necessary details for the transaction.

Connection & Credentials

This component requires configuring a PayPal API credential in Nappai before it can interact with PayPal services:

  1. Go to the Credentials section in your Nappai panel.
  2. Create a new credential of the type PayPal API and fill in the required fields (Client ID and Client Secret). These keys are provided by PayPal when you set up your developer account.
  3. In your workflow, select the saved credential in the Credential input field of this node.

Inputs

The following fields are available to configure this component. Each field may be visible depending on the operation you select.

  • Operation: Select the action you want to perform. Choose “Create” to generate a new order or “Get” to retrieve details of an existing order.
  • Order ID: The unique identifier of a PayPal order. Required only when using the “Get” operation.
  • Intent: Defines how the payment should be processed. Choose “CAPTURE” to collect payment immediately or “AUTHORIZE” to hold the funds for later capture.
  • Amount: The payment amount as a decimal string (e.g., ‘10.00’). Required for creating orders.
  • Currency: The three-letter ISO currency code for the transaction (e.g., ‘USD’, ‘EUR’).
  • Description: An optional description of the order, such as the product name or service details.

Outputs

Once the component executes, it produces data that you can use in subsequent steps of your workflow.

Output Data Example (JSON)

Below is an example of the data structure returned by this component when successfully creating or retrieving an order: json { “order_id”: “5O190127TN364715T”, “status”: “CREATED”, “intent”: “CAPTURE”, “purchase_units”: [ { “reference_id”: “d9f257ef-72d2-44d7-9ebf-77c66f454a6e”, “amount”: { “currency_code”: “USD”, “value”: “100.00” } } ], “links”: [ { “href”: “https://api-m.sandbox.paypal.com/v2/checkout/orders/5O190127TN364715T”, “rel”: “self”, “method”: “GET” }, { “href”: “https://www.sandbox.paypal.com/checkoutnow?token=5O190127TN364715T”, “rel”: “approve”, “method”: “GET” } ] }

Key Outputs Explained:

  • Order ID: The unique ID for the order, which you may need to reference later.
  • Status: The current state of the order (e.g., CREATED, APPROVED, COMPLETED).
  • Links: A list of URLs that indicate the next actions you can take, such as approving the payment or retrieving order details.

Connectivity

This component is typically used at the beginning of a payment workflow.

  • Upstream Connections: You usually do not connect anything into this component for the initial setup, except for the Credential and any dynamic data for Amount or Description from previous steps.
  • Downstream Connections:
    • If you are Creating an order, connect the output to a component that directs the user to a payment page using the provided link.
    • If you are Retrieving an order, connect the output to conditional logic (like “If/Else” blocks) to check the Status or process the payment once it is approved.

Usage Example

Scenario: Creating a Payment Order

  1. Set the Operation to “Create”.
  2. Select your PayPal API credential.
  3. Set the Intent to “CAPTURE”.
  4. Enter the Amount (e.g., “50.00”) and select the Currency (e.g., “USD”).
  5. Add a Description like “Monthly Subscription Fee”.
  6. Run the workflow. The component will return an Order ID and a Link that you can use to send the customer to the PayPal checkout page.

Important Notes

  • Ensure that your PayPal API credential has the necessary permissions to create orders.
  • When using the Get operation, always provide a valid Order ID from a previously created order.
  • The Environment setting (Sandbox vs. Live) in your credential determines whether the order is created in a testing environment or a real production environment.

Tips and Best Practices

  • Use the Sandbox environment (via your credential) for testing your workflows to avoid real transactions.
  • Always include a Description in your orders to help identify transactions later in your PayPal dashboard.
  • If you choose AUTHORIZE intent, remember that the payment is not collected immediately; you will need a separate step to capture the funds later.

Security Considerations

  • Never share your Client ID or Client Secret publicly. Store them securely in Nappai’s credential manager.
  • Be cautious when handling Order IDs and payment data, as they are sensitive financial information. Ensure your workflow complies with data protection regulations.