Advanced Paypal Payments

Demo to preview the plugin:

Introduction

This plugin allows you to use PayPal for payments and includes actions such as creating a payment order, confirming an order using Paypal or a card, receiving payment data, etc. It also comes with a set of PayPal buttons that you can place on your page.

Prerequisites

You must have an account with PayPal Developer to interact with the API. Create your development account at: https://developer.paypal.com/developer/applications/create

How to setup

  1. Go to https://developer.paypal.com/developer/applications/create and create a new PayPal app using your PayPal Developer login.
Once you have created your app, change the environment to 'Live'.
Image without caption
For demo purposes, all screenshots below are from Sandbox, but in live this is the same.
  1. Go to your app settings. Next copy Client ID and Secret key
    1. Image without caption
  1. You can generate a new key if you don’t have any.
    1. Image without caption
  1. Insert the Client ID and Secret key into your application in the appropriate fields in the plugin settings.
    1. Image without caption
  1. Use the action "Get API key" to get the API key. The result of calling this action will be the API key, copy it together with the name β€œBasic”. This action will only be used once to obtain the Key. Since the demo page already has a retrieved API key, this functionality is not present in the demo. Below is an example of setting up a workflow to obtain an API key.
    1. Image without caption
      Image without caption
  1. Insert API key in Plugin settings.
    1. Image without caption
​There are a few things to understand to complete a recurring payment plan, the flow should follow these actions:

Sandbox Accounts

  1. Go to the "Testing Tools" tab.
Image without caption
Two accounts (Personal & Business) will be created automatically for the PayPal sandbox.
Image without caption
  1. The password for your PayPal sandbox accounts can be changed in the "View/Edit account" section.
Image without caption
Image without caption

Elements

Paypal Button

Action

Get API key

API Calls

Orders

Payments

Products

Subscriptions

Payment Test workflow

This workflow demonstrates, using the example of buying a product in a store, how to set up API calls for creating a payment order, choosing a payment method, confirming payment and further processing the payment on the seller's side.
Image without caption
  1. When buying one or more products, you can set up the action "Order - Create order2" and transfer the necessary amount for payment and other necessary parameters according to the documentation of this action.
Image without caption
Image without caption
  1. After creating a payment order using order ID, you can get data about the payment order (ID, status, etc.) using the action "Order - Show order details2" or data call "Order - Show order details data". As long as the payment order is not paid and the payment is not captured by the seller, you can edit the payment order using actions: Update intent order, Update order address, Update order description, Update shipping name order, Update the shipping type order, Update amount order.
Image without caption
  1. For the created order, you can accept payment using Paypal or a Card. To do this, use the actions "Order - Confirm the Order Paypal" and "Order - Confirm the Order Card".
Image without caption
Action "Order - Confirm the Order Paypal" returns a link to go to the Paypal site for payment (links➑️href).
After successful payment, the status of the payment order will change to APPROVED.
  1. Depending on the selected value of the field "intent" action "Order - Create order2", it is necessary to select further actions.
  • If the value of the field is "intent" AUTHORIZE, then it is necessary to authorize the payment of the order using the action "Order - Authorize payment for order2". At the same time, the payment will be waiting for authorization in the buyer's personal account.
Image without caption
In the merchant's personal account, the payment will have the status "PENDING".
Image without caption
To further fix the authorized payment, use the action "Payments - Capture authorized payment".
  • If the value of the "intent" field is CAPTURE, then it is necessary to authorize the payment of the order using the "Order - Capture payment for order2" action. In this case, the payment will be recorded immediately after the buyer makes the payment.
Payment in the buyer's personal account.
Payment in the buyer's personal account.
Payment in the merchant's personal account.
Payment in the merchant's personal account.

Step-by-step configuration workflow

This workflow demonstrates the step-by-step process of the API from the moment the payment order is created to the moment the seller receives the money.
  1. Create a payment order by filling in the required fields.
Image without caption
For further work with the payment order, you need to use the order_id received when using the Order - Create order2 action.
Image without caption
  1. Use the Order ID to further confirm the payment using the selected method:
Image without caption
  • when paying using Paypal, use the action "Order - Confirm the Order Paypal" by filling in the required fields. Using the action "Order - Confirm the Order Paypal" returns a link to go to the Paypal payment site, after a successful (unsuccessful) payment on the Paypal site, you can set up a redirect link (field return_url (cancel_url)).
    • Image without caption
After successful payment, you can use the Order ID from the URL, it is located in the "token" parameter.
Image without caption
  • when paying with a credit/debit card, use the action "Order - Confirm the Order Card" by filling in the required fields. To test card payment, use Paypal documentation.
  1. If the payment was successful, then the payment order must be authorized or captured, depending on the selected "Intent" value when creating the payment order. To do this, use the actions "Order - Authorize payment for order2" and "Order - Capture payment for order2" by filling in all the necessary fields. After successful authorization or capture of the payment order, you will receive the payment ID.
Image without caption
Image without caption
Image without caption
  1. Using actions Payments - Show details for authorized payment, Payments - Show captured payment details you can get information about payments, as well as re-authorize an authorized payment using action Payments - Reauthorize authorized payment. Use the payment ID in these actions obtained in the previous step.
Image without caption
Image without caption

Changelogs

Update: 06.20.19 – Version

Added 3 new Actions:
  • Paypal Payments - Create A Product NEW API
  • Paypal Payments - Create A Plan NEW API
  • Paypal Payments - Create A Subscription NEW API

Update: 05.09.23 - Version 1.13.0

  • Upgrade to node18.

Update: 14.09.23 - Version 1.16.0

  • Added subscription actions