Paypal

A secure and globally accepted online payment transfer.

Note

Make yourself familiar with our API Principles to ensure a resilient integration.

Product Overview

Why use PayPal

PayPal is a global payment method with strong consumer recognition and trust. It is also one of the most popular APMs in the world. PayPal opens up a large customer base who already have PayPal accounts and can make purchases with a payment flow that they are comfortable with.

It is accepted in over 200 countries, supports 25 currencies and is a mainstay of APM payments.

Feature summary

Payment typeCountriesRecurringReversalsPartial ReversalsDisputesAuth onlyAuth and Settlement (Sale)
Digital WalletGlobal acceptance
  • Partial refund - yes
  • Partial cancel- No
Handled directly via PayPal

Acceptance currencies

CurrencyCurrency Codes
Australian DollarAUD
Brazilian RealBRL
Canadian DollarCAD
Czech KorunaCZK
Danish KroneDKK
EuroEUR
Hong Kong DollarHKD
Hungarian ForintHUF
Indian RupeeINR
Israeli New ShekelILS
Japanese YenJPY
Malaysian RinggitMYR
Mexican PesoMXN
New Taiwan DollarTWD
New Zealand DollarNZD
Norwegian KroneNOK
Philippine PesoPHP
Polish ZłotyPLN
Pound SterlingGBP
Singapore DollarSGD
Swedish KronaSEK
Swiss FrancCHF
Thai BahtTHB
United States DollarUSD
Note

For use of PayPal in the US please contact your Relationship Manager.

Payment flows

There are two different ways to integrate PayPal:

  • Redirect URL mechanism
  • Smart Button

Redirect URL

Your customer's are redirected to a web broswer to log into PayPal where they complete the payment.

Smart Button

Your customer clicks on the Smart Button, a pop-up window opens on top of their payment screen.

You must integrate using the PayPal SDK using the JavaScript SDK script configuration developer guide.

Important

The payment-source within the Paypal SDK must be "paypal" when integrating with Access Worldpay. This enables the PayPal option within the SDK. Other payment methods, offered by the PayPal SDK, will not work with Access Worldpay.

You can also customize the Paypal Smart button. The options are:

  • the size, color and shape of the button
  • the language that appears on the buttons
  • the layout of the button: horizontal or vertical

Get Started

Get started using our API Reference and set your headers.


Request

POST https://try.access.worldpay.com/apmPayments

Example request

application/json
{ "transactionReference": "Memory265-13/08/1876", "merchant": { "entity": "default" }, "instruction": { "method": "paypal", "value": { "amount": 35, "currency": "GBP" }, "narrative": { "line1": "MindPalace" }, "paymentInstrument": { "type": "direct", "billingAddress": { "address1": "221B Baker Street", "address2": "Marylebone", "address3": "Westminster", "postalCode": "NW1 6XE", "city": "London", "state": "Greater London", "countryCode": "GB" } }, "settlement": { "auto": true }, "resultUrls": { "cancel": "https://example.com/cancel", "failure": "https://example.com/failure", "pending": "https://example.com/pending", "success": "https://example.com/success" }, "shipping": { "firstName": "James", "lastName": "Moriarty", "address": { "address1": "The Palatine Centre", "postalCode": "DH1 3LE", "city": "Durham", "state": "County Durham", "countryCode": "GB" } }, "customer": { "email": "moriarty@example.com" } } }

Parameters

transactionReferencestring[ 1 .. 64 ] characters^[a-zA-Z0-9\-_/!@#$%()*=.:;?\[\]{}~+]*$required
merchantobject(MerchantV2)required
merchant.​entitystring[ 1 .. 32 ] characters^([a-zA-Z0-9]*)$required

Used to route the request in Access Worldpay, created as part of on-boarding.

Example: "default"
instructionobject(InstructionV2)required

Object that contains the payment type and details.

instruction.​methodstringrequired

The type of instrument.

Value"paypal"
Discriminator
instruction.​valueobject(Value)required

The value of the payment.

instruction.​value.​amountinteger(int64)[ 1 .. 2147483647 ]required

The amount in the lowest denomination of the currency e.g. pennies for GBP, cents for USD.

Example: 1234
instruction.​value.​currencystringrequired
Enum"AED""AFN""ANG""AOA""ARS""AUD""AWG""AZN""BAM""BBD"
instruction.​narrativeobject(NarrativeBase)required
instruction.​narrative.​line1string[ 1 .. 24 ] characters^[a-zA-Z0-9\\-\\.\\,\\ ]*$required

The description shown on your customer's bank statement for the payment.

Example: "Joe Plumbing Ltd"
instruction.​paymentInstrumentobject(PayPalInstrumentV2)required
instruction.​paymentInstrument.​typestringrequired

The type of instruction.

Value"direct"
instruction.​paymentInstrument.​billingAddressobject(PayPalBillingAddressV2)
instruction.​settlementobject(Settlement)

Indicates whether the transaction should be sent for settlement now = true, or later = false at a time of your choosing.

instruction.​resultUrlsobject(ResultUrls)
instruction.​shippingobject(Shipping)
instruction.​customerobject(Customer)
Recommendation

We suggest you provide the cancelURL,failureURL, pendingURL and successURL attribute to redirect your customer to, once you have received the payment result.

Response

Successful response

  • an HTTP code 201
  • an id which is unique to the payment - we recommend storing the "id" as this can be used to manage the payment later
  • a url to redirect your customer to the APM provider to complete the payment
  • a link to query the payment status
  • an object which will give flow information such as method (e.g. paypal), type (sdk for a Smart Button flow or redirect for a Redirect URL flow) and an sdk token
Note
  • for the Smart Button flow use the sdkReference to generate the Smart Button
  • for the redirect flow use the url in the response to redirect your customer

Example Response

{
  "paymentId": "nFxASqw-LV9HE_rr1mMONP6OuaBhNYiq0jRwvvUBRLffpu0O_8mOnTpFSIM9gnTSg8thuF8qvuzMKHjhAUKA-SBywF4F_ufX78jkgX7yoPwA8HF_HMLM0RSLDKrlDpMxs5bSRRbjItu_Me3kIkraos_XGMXXDzWYsmzASPr6BGo",
  "lastEvent": "pending",
  "_links": {
    "self": {
      "href": "https://access.worldpay.com/apmPayments/nFxASqw-LV9HE_rr1mMONP6OuaBhNYiq0jRwvvUBRLffpu0O_8mOnTpFSIM9gnTSg8thuF8qvuzMKHjhAUKA-SBywF4F_ufX78jkgX7yoPwA8HF_HMLM0RSLDKrlDpMxs5bSRRbjItu_Me3kIkraos_XGMXXDzWYsmzASPr6BGo"
    },
    "_actions": {
      "confirmPayment": {
        "href": "https://access.worldpay.com/apmPayments/nFxASqw-LV9HE_rr1mMONP6OuaBhNYiq0jRwvvUBRLffpu[…]rlDpMxs5bSRRbjItu_Me3kIkraos_XGMXXDzWYsmzASPr6BGo/confirmations"
      },
      "paymentInstrument": {
        "method": "paypal",
        "type": "sdk",
        "sdkReference": "2HG28153DX910101U"
      }
    }
  }
}

Errors

Check out our API reference for the full error code schema.

PayPal Smart Button flow

Payment confirmation

Once your customer has closed the PayPal iframe, you must confirm the payment when using the PayPal Smart Button. This is done by using the confirmPayment href returned in the payment request response.

Make a POST request on the link:actions action link returned in your payment response.

POST https://try.access.worldpay.com/apmPayments/nFxASqw-LV9HE_rr1mMONDTNO21DI7iBqIBDP8tbNT_pHfdVKepSMngqe9EDiBI1pHXEu-SbvqJyvSludyCd-2L21mL7uoB8zl62Ayz7E3GblXYsLnrW2-IZDMChfXfwWt7xrjVsKEPMGearp4PdIQp8hQ6k4_KTkZa_frsM4TQ/confirmations

Note

No request body is needed for this request.

For greater understanding of the PayPal Smart Button flow, view the sequence diagram below.

CustomerMerchantWorldpayPayPal1. Clicks Smart Button2. Sends request to create a payment3. Validates and sends request to create a payment4. Generates and responds with paymentId5. Sends paymentId and SDK reference, including confirmPayment href6. Uses SDK ref to have Smart Button render the PayPal login screen7. Logs in and pays8. Closes PayPal screen9. Uses the confirmPayment href to confirm the payment10. Sends payment confirmation11. Processes payment and provides notification on transaction outcome12. Provides notification, via webhook, on transaction outcomeCustomerMerchantWorldpayPayPal

Next Steps


Manage your PayPal payment