PayPal

To use PayPal you must first open a PayPal business account, and connect it to WhenThen Settings → Connections.

Connect PayPal Connection

For general instruction how to connect payment processor connection see getting started

info icon

If you are new to PayPal, the best place to start is by registering for a PayPal developer accounthere
Once a developer account is established, follow PayPal’s documentation and setting up a new REST application. You will need the appropriate Client ID and Secret in order to connect a new PayPal connection on WhenThen platform.


  1. You will need to get credentials from PayPal. PayPal has the ability to set-up more than one application within in your configuration. Determine which application you would like to grant WhenThen access to by logging into the PayPal Developer Dashboard and navigating to the My Apps & Credentials.
  2. You will need the Client Id and Secret when creating a new PayPal connection.
    PayPal Credentials
    We return a link, generated by APM provider that you can redirect your customer to for authorization process. An authorization screen will be presented to customers where they login and approve the payment.

Integration

Example authorizePayment using PayPal - use PAYAPL as the type for the paymentMethod.

  curl
    -X POST
    -H "Content-Type: application/json"
    -H "Authorization: Bearer xxxxxxx"
    -d '{
      "query": "mutation authorizePayment($authorisePayment: AuthorisedPaymentInput!) {
        authorizePayment(authorisePayment: $authorisePayment) {
          id
          status
        }
     }",
      "variables": {
         "authorisePayment": {
            "orderId": "5113e019-9316-4498-a16d-4343fda403eb",
            "flowId": "0c6d975e-f586-4fa6-8caf-863e69ac78d6",
            "amount": 1200,
            "currencyCode": "USD",
            "apmRedirectUrl": "http://valid-url-to-merchant-callback-endpoint.io",
            "paymentMethod":{
              "type": "PAYPAL"
            }
         }
      }
    }'
    https://api.whenthen.com/api/graphql

When an authorizePayment call is made, WhenThen will initiate a request to PayPal. In response, PayPal provides WhenThen a checkoutnow URL which we provide to you in a valid error response. See Handle Valid Error Response section for further details.

When the user is redirected to that URL, it will prompt the user to login at PayPal and then present them with page similar to the following to select the payment method they would like complete the transaction:

PayPal Test Store

After your customer selects a payment method type at PayPal and authorizes the payment, they will then be redirected back to your, previously provided APM Redirect URL with the payment Id. See See Handle Authorization Callback Response section for further details.

Once a successful authorization has occurred, if your automation is using auto capture then no futher actions is required. Otherwise you should call the Capture API .