Last updated

PayPal Checkout Adapter

Overview Document: Payment Adapters Overview

Overview and Unique Capabilities

The PayPal Checkout Adapter integrates PayPal's payment platform with Norce Checkout. This page focuses on the unique technical details and configuration for PayPal.

Supported payment methods and other features: Features Overview

Configuration in Norce Admin

The adapter is configured using the following settings in the apiSettings section:

FieldDescriptionExample Value
apiUrlPayPal API URL (sandbox or live).https://api-m.sandbox.paypal.com
paypalMerchantIdYour PayPal Merchant ID from Developer Dashboard.MERCHANT123

Options Configuration

The options section contains adapter behavior settings:

FieldDescriptionDefault Value
intentPayment intent: authorize (reserve funds) or capture (immediate payment).authorize
providesCustomerIf true, customer address comes from PayPal. If false, address is collected outside PayPal.false
mapDiscountPerRowIf true, discounts are included in item prices. If false, discounts appear as separate order lines.false
useCartReferenceAsInvoiceIdIf true, uses cart.reference as PayPal invoice ID. If false, uses the Norce order reference.false
disableFundingArray of funding sources to disable (e.g., ["credit", "card"]).[]
enableFundingArray of funding sources to enable (e.g., ["paylater", "venmo"]).[]
paymentSourceJSON string for advanced PayPal payment source configuration with return/cancel URLs.null

Redirect URLs Configuration

When using PayPal as an external redirect flow (not SDK-based), configure the redirectUrls section:

FieldDescription
checkoutPageURL to redirect to if payment fails or is cancelled. Supports {order.merchant}, {order.channel}, {order.id}, and {errorCode} placeholders.
confirmationPageURL to redirect to after successful payment authorization. Supports {order.merchant}, {order.channel}, and {order.id} placeholders.

PayPal API Environments

In addition to the generic Norce Adapter URLs (see Payment Adapters Overview), PayPal uses the following external API environments:

EnvironmentPayPal API Base URL
Productionhttps://api-m.paypal.com
Sandboxhttps://api-m.sandbox.paypal.com

Webhook Configuration

Configure webhooks in PayPal Developer Dashboard with the following events:

  • CHECKOUT.ORDER.APPROVED
  • CHECKOUT.ORDER.COMPLETED
  • PAYMENT.AUTHORIZATION.CREATED

Webhook URL format:

https://{slug}.api-se.{env}.norce.tech/checkout/paypal-adapter/api/checkout/v1/callback/webhook

Creating a PayPal Payment

To initialize a PayPal Checkout session:

POST /api/v1/orders/{order_id}/payments
Host: {slug}.api-se.stage.norce.tech
x-merchant: {merchant}
x-channel: {channel}
Authorization: Bearer {token}

The response includes SDK configuration for rendering PayPal buttons:

{
  "paymentId": "pVjGamNQMiEtecSfkABthgijIJK",
  "reference": "5O190127TN364715T",
  "sdkUrl": "https://api-m.sandbox.paypal.com",
  "partnerAttributionId": "Norce_Cart_PPCP",
  "sdkSettings": {
    "clientId": "AdfIh3vhZgRSn0CrYDXnbDOCwTUPnWZ...",
    "merchantId": "MERCHANT123",
    "currency": "SEK",
    "locale": "sv_SE",
    "buyerCountry": "SE",
    "disableFunding": [],
    "enableFunding": [],
    "commit": false,
    "vault": false,
    "integrationDate": "2025-04-01",
    "intent": "authorize"
  }
}

Handling Shipping Changes

The adapter supports shipping address and option change callbacks:

    POST /api/checkout/v1/callback/orders/{order_id}/payments/{payment_id}/shipping-address-change
    Host: {slug}.api-se.stage.norce.tech
    POST /api/checkout/v1/callback/orders/{order_id}/payments/{payment_id}/shipping-options-change
    Host: {slug}.api-se.stage.norce.tech

Troubleshooting (PayPal Specific)

In addition to the generic troubleshooting steps:

  • Payment Creation Fails (409 Conflict): A PayPal payment already exists for this order. Remove the existing payment or use a different order.
  • Authorization Fails (400 Bad Request): Verify the customer has approved the payment in the PayPal UI. The adapter returns 400, not PayPal's upstream 422.
  • Webhook Signature Invalid: Verify the webhook URL is correctly configured in PayPal Developer Dashboard.
  • Review transaction details in PayPal Developer Dashboard.
  • Verify webhook delivery status in PayPal.

PayPal Order Expiration

PayPal orders and authorizations have expiration windows enforced by PayPal's platform. The Norce Checkout PayPal Adapter does not proactively detect expiration — it returns a PayPal error when an operation is attempted on an expired resource.

PayPal Order Not Found (3-Hour Expiration)

A PayPal order expires after 3 hours if the buyer has not approved the payment. After expiration, PayPal no longer recognizes the order. The adapter may return either paypal-resource-not-found (HTTP 404) or paypal-order-expired (HTTP 400) depending on the PayPal SDK error.

What to do: Remove the expired PayPal payment from the Norce Checkout order and create a new PayPal payment. The existing PayPal order cannot be recovered after expiration.

PayPal Order Expiration Window

PayPal orders expire after 3 hours by default. PayPal supports extending this window up to 72 hours on the PayPal side. Contact your PayPal Account Manager (TAM) to configure an extended expiration window for your merchant account. This extension is configured in PayPal's platform, not in Norce Checkout.

PayPal Authorization Expiration (29-Day Window)

When using the authorize intent, a PayPal authorization is valid for 29 days. PayPal recommends capturing within the 3-day honor period for the highest capture success rate. After 29 days the authorization auto-voids and a new payment must be created.

The adapter does not explicitly map PayPal's AUTHORIZATION_EXPIRED error — an expired authorization surfaces as a generic paypal-error (HTTP 400). The Norce Checkout PayPal Adapter does not implement PayPal's reauthorization flow.

What to do: Create a new PayPal payment on the same Norce Checkout order. The expired authorization cannot be captured or reauthorized through the adapter.

Redirect Return Error Handling

When the customer returns from PayPal's redirect flow and the PayPal order is expired or not found, the Norce Checkout PayPal Adapter redirects the customer to the configured checkoutPage URL with an error code parameter:

ScenarioRedirect Error Code
PayPal order expired or not foundorder-not-found
Order conflict (order changed since approval)order-conflict
Payment errorpayment-error
Internal server errorinternal-server-error

The error code is substituted into the {errorCode} placeholder in the redirectUrls.checkoutPage URL. Integration partners should handle the order-not-found error code by removing the expired PayPal payment and creating a new one.

Payment States

StateDescription
intentPayment initialized, awaiting customer approval
processingPayment approval in progress
pendingAwaiting asynchronous confirmation
reservedPayment authorized successfully
capturedPayment captured (funds transferred)
declinedPayment declined by PayPal
cancelledPayment voided/cancelled