PayPal integration guide

PayPal PayPal is a payment provider allowing customers to pay using payment methods saved to their PayPal account. This section is intended to help you implement PayPal based on your preferred integration workflow.

📘

Note

PayPal is different from PayPal (with Braintree) in the following ways:

  • PayPal only supports customer-present transactions, whereas PayPal (with Braintree) allows for customer-not-present (also known as "merchant-initiated") transactions via a saved token.
  • PayPal supports the multi-iframe, individual iframe, and custom redirect integration methods and PayPal (with Braintree) only supports the individual iframe integration method.
  • PayPal only supports a "Checkout page" flow while PayPal (with Braintree supports the "Continue button" and "Checkout page" payment flows
  • PayPal supports the AUD, BRL, CAD, CHF, CZK, DKK, EUR, GBP, HKD, HUF, ILS, INR, JPY, MXN, MYR, NOK, NZD, PLN, RUB, SEK, SGD, THB, TWD, and USD currencies; PayPal (with Braintree) only supports the AUD, CAD, EUR, GBP, and USD currencies.
  • For a checkout page flow, the required fields for the two payment methods are the same. However, PayPal (with Braintree) requires additional parameters for either the "Continue button" payment flow or the merchant-initiated transactions.

Services and compatibility

Payment method gateway namePayPal
Supported transaction types
Supported integration methods
Supported processing currenciesAUD, BRL, CAD, CHF, CZK, DKK, EUR, GBP, HKD, HUF, ILS, INR, JPY, MXN, MYR, NOK, NZD, PLN, RUB, SEK, SGD, THB, TWD, USD
Webhook event types
  • TRANSACTION_AUTHORIZED
  • TRANSACTION_CAPTURED
  • TRANSACTION_REFUNDED
  • TRANSACTION_SETTLED
  • TRANSACTION_VOIDED

Gateway-specific information

PayPal does not support merchant-initiated transactions for a subscription or payment plan. For that feature, you must integrate with PayPal (with Braintree).

However, PayPal does support Pay Later messaging, which acts like a subscription or payment plan from the customer point of view. For details, see the Pay Later messaging topic.

Configuration

Apart from working with Integrations to add PayPal as a payment method, you do not need to do any other configuration steps.

Required fields

The following table shows the required and optional fields for PayPal transactions in the Create APM one-time-use token request.

FieldRequired?Description
data.amountYesThe transaction amount.
data.currencyYesThe three-character ISO currency code for the transaction.
For PayPal, supported currencies are AUD, BRL, CAD, CHF, CZK, DKK, EUR, GBP, HKD, HUF, ILS, INR, JPY, MXN, MYR, NOK, NZD, PLN, RUB, SEK, SGD, THB, TWD, and USD.
data.customer.orderNumberYesThe order number.
data.customer.firstNameYesThe customer's first name, as it is set for the payment method.
data.customer.lastNameYesThe customer's last name, as it is set for the payment method.
data.customer.emailYesThe customer's email address.
customerRedirectUrlConditionalThe URL to which the customer will be redirected after completing their payment. The customer will be sent here upon successful or failed payment. This URL must use the HTTPS protocol. Required if you intend to use Nexio’s redirectUrls with your own buttons.
data.cart.items[n].itemNoItem number or code.
data.cart.items[n].descriptionNoA description of the item.
data.cart.items[n].quantityNoThe quantity sold.
data.cart.items[n].priceNoThe price per item.
data.customer.customerRefNoCustomer identifier. You can use this field to pass a customer ID to the APM or to manage user subscriptions.
data.customer.billToAddressOneNoThe street address for the customer.
data.customer.billToAddressTwoNoAdditional street address information, if required.
data.customer.billToCityNoThe city for the address record.
data.customer.billToStateNoThe state or province on file with the payment provider. (If in the US, this must be the two-character state abbreviation).
data.customer.billToPostalNoThe postal code on file.
data.customer.billToCountryNoThe two-character (Alpha-2) ISO country code.
data.customer.billToPhoneNoThe billing phone number.
data.customer.invoiceNoThe invoice number.
data.customer.shipToAddressOneNoThe shipping address, if different from the billing address.
data.customer.shipToAddressTwoNoAdditional shipping address information, if required.
data.customer.shipToCityNoThe shipping city.
data.customer.shipToStateNoThe shipping state or province. (If in the US, this must be the two-character state abbreviation).
data.customer.shipToPostalNoThe shipping postal code.
data.customer.shipToCountryNoThe two-character (Alpha-2) ISO shipping country code.
data.customer.shipToPhoneNoThe shipping phone number.
data.descriptionNoA description of the transaction.
data.paymentMethodNoThe identifier for the alternative payment method. Use this parameter when you want to only return the PayPal iframe button URL or the PayPal redirect URL (rather than data for all payment methods associated with the account).

The value to use is payPal.
isAuthOnlyNoSet to true to run an auth only transaction.
processingOptions.merchantIdNoThe Nexio merchant ID (MID).
processingOptions.paymentOptionTagNoA custom value used to route transactions to a specific gateway or merchant account.
processingOptions.saveRecurringTokenNoSet to true to get a token in order to process merchant-initiated recurring transactions, such as with PayPal (with Braintree).

Note: The standard PayPal integration does not support merchant-initiated recurring transactions.
uiOptions.displaySubmitButtonNoSet to true to include a submit button in the iframe.
uiOptions.cssNoThe URL where your custom CSS file is hosted.

Example requests

The following are example one-time-use token requests for PayPal.

curl -X POST https://api.nexiopaysandbox.com/apm/v3/token \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Basic [Base64_encoded_login]'
  -d '{
  "data": {
    "amount": 4.00,
    "currency": "USD",
    "paymentMethod": "payPal",
    "customer": {
      "orderNumber": "12345678",
      "firstName": "John",
      "lastName": "Doe",
      "email": "[email protected]"
    }
  }
}'

A successful request returns a response similar to the following:
{
  "expiration": "2018-09-18T15:43:05.664Z",
  "token": "830d36f6-a5e3-4455-9600-3a55b63e2fc2",
  "asyncTraceId": "830d36f6-a5e3-4455-9600-3a55b63e2fc2",
  "expressIFrameUrl": "https://www.api.nexiopaysandbox.com/v3?token=830d36f6-a5e3-4455-9600-3a55b63e2fc2",
  "redirectUrls": [
    {
      "paymentMethod": "payPal",
      "url": "https://www.api.nexiopaysandbox.com/v3/popup?token=830d36f6-a5e3-4455-9600-3a55b63e2fc2&paymentMethod=payPal"
    },
    {
      "paymentMethod": "applePayCyberSource",
      "url": "https://www.api.nexiopaysandbox.com/v3/popup?token=830d36f6-a5e3-4455-9600-3a55b63e2fc2&paymentMethod=applePayCyberSource"
    },
    {
      "paymentMethod": "nihaoPayWechatPay",
      "url": "https://www.api.nexiopaysandbox.com/v3/popup?token=830d36f6-a5e3-4455-9600-3a55b63e2fc2&paymentMethod=nihaoPayWechatPay"
    }
  ],
  "buttonIFrameUrls": [
    {
      "paymentMethod": "payPal",
      "url": "https://api.nexiopaysandbox.com/apm/v3?token=830d36f6-a5e3-4455-9600-3a55b63e2fc2&paymentMethod=payPal"
    },
    {
      "paymentMethod": "applePayCyberSource",
      "url": "https://api.nexiopaysandbox.com/apm/v3?token=830d36f6-a5e3-4455-9600-3a55b63e2fc2&paymentMethod=applePayCyberSource"
    },
    {
      "paymentMethod": "nihaoPayWechatPay",
      "url": "https://api.nexiopaysandbox.com/apm/v3?token=830d36f6-a5e3-4455-9600-3a55b63e2fc2&paymentMethod=nihaoPayWechatPay"
    }
  ]
}

For the multi iframe integration method: You use the expressIFrameUrl value in the steps for the transaction.

For the individual iframe option: You use the buttonIFrameUrls.url of the paypal APM for the transaction.

For the custom redirect option: You use the redirectUrls.url of the paypal APM for the transaction.

Transaction types and integration methods

Regardless of the integration method workflow you implement, consumers are redirected to PayPal to complete their transactions.

Nexio supports the following transaction types for PayPal:

PayPal also supports Pay Later messaging. For details, see the Pay Later messaging topic.

PayPal payment flow

The following show the general flows for a customer accessing a merchant site through payment using PayPal from the checkout page.

Customer adds item to cart and clicks Checkout button

  1. The customer adds one or more items to a shopping cart.

  2. The customer goes to that cart, the order amount displays, along with a Checkout button.

  3. Customer clicks the Checkout button and is redirected to a Checkout page with all available payment options (potentially including PayPal). Customer address information is collected (or retrieved) and is used to generate tax and shipping costs.

  4. If the customer clicks the PayPal button, they are asked to log in to PayPal and to select their payment options.

    If the customer clicks a different APM button, the process for that specific APM continues through to confirming the payment options.

    If the customer submits payment for card or ACH, the process continues based on the entered payment options.

  5. The customer is redirected to a Receipt page.

Testing data

For testing information and data, see PayPal’s Sandbox Testing Guide.

Response handling

In the one-time-use token request, PayPal gets returned in the paymentMethod parameter as payPal.

Nexio responds with transaction results in one of the following ways, depending on your integration workflow:

  • Event messages: This applies to integrations that do not pass a customerRedirectUrl in the request.
  • Response fields in the URL: This applies to integrations that do provide a customerRedirectUrl in the request.

In addition to one of the above, if your merchant account is configured to receive webhooks, Nexio provides responses to the webhook URLs that have been registered. For further explanation of the webhook event types, see the webhook Event types table.

For PayPal, these are the possible webhook event types:

  • TRANSACTION_AUTHORIZED
  • TRANSACTION_CAPTURED
  • TRANSACTION_REFUNDED
  • TRANSACTION_SETTLED
  • TRANSACTION_VOIDED

For information about how to run each of the integration workflows, see Transaction types and integration methods above.

Status workflows

The status of a successful transaction with PayPal varies, depending on the options you choose.

SaleWhen isAuthOnly is false, successful sale transactions have the following statuses:
  • pending*
  • settled
Auth onlyWhen isAuthOnly is true, successful sale transactions have the following statuses:
  • authOnlyPending
  • authOnly
CaptureSuccessful capture transactions have the following status:
  • settled
VoidSuccessful void transactions have the following status:
  • voided
RefundSuccessful refund transactions have the following status:
  • settled

* Pending status displays as "authorized" or "AUTHORIZED" in the Nexio Dashboard; it displays as 10, meaning "authorized", in the response when querying transactions (for more information about transactionStatus, see the table).

Next steps

Now, you are ready to get started with running transactions:

If you have any additional questions or feedback, see Contact us.