Paypal V2

PayPal V2 introduces the PayPal Checkout, which features a RESTful API solution that includes standard checkout, PayPal Express, and the new PayPal Vault functionality. With these flexible and powerful payment solutions, we aim to enhance the e-commerce experience for both merchants and their customers. By enabling customers to quickly complete transactions using their PayPal accounts, this integration reduces cart abandonment and accelerates the payment process. PayPal V2 offers streamlined authentication and approval steps, ensuring a secure, efficient, and user-friendly checkout experience for your e-commerce platform. In addition to the standard checkout, you also have the option to utilize the JavaScript SDK to render PayPal buttons and respond to various PayPal events.

Standart vs Express

We provide the flexibility to implement payment options across multiple pages:

on the product page
Your customers can directly pay on your product page.

on the shopping cart page
Your customers can chose to pay on your shopping cart page

Regular on the checkout page

as a regular checkout on the payment solution page.

The PayPal Checkout V2 handles the regular checkout. For more information about the Product page and Shopping Cart page please use our PayPal Express V2 implementation guide. 

Configure your Initiation script

PayPal allows the configuration of the initiation script via Query parameters to help define specific content or actions based on the data being passed. Each piece of data sent contains:

  • A key-value pair: Keys define the piece of information needed, and the value provides that information. The key is separated from the value by an equal sign (=).
  • A question mark (?): Preceding the key-value pair to annotate that a question for a piece of information is being asked.
  • Ampersands (&): Used if more than one set of values needs to be provided at a time.
  • Information that PayPal needs to handle your request.
     

In this example, the script includes the following query parameters:

  • client-id: Axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  • merchant-id: YYYYYYYYYYYYYY
  • currency: EUR
  • intent: authorize 
  • locale: de_DE the country list is published here
  • commit: true
  • vault: false
  • disable-funding: card, sepa ( these are not implemented)
  • enable-funding: paylater

 <script src="https://www.paypal.com/sdk/js?client-id=Axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&merchant-id=LXXXXXXXXXXXXX&currency=EUR&intent=authorize&locale=de_DE&commit=true&vault=false&disable-funding=card,sepa,bancontact&enable-funding=paylater"></script>

 

For debug purpose you can also add the parameter

debug:  true/false

Rendering the PayPal Button

---end

 

There are two options for rendering the PayPal button: merchants can choose between a dynamic PayPal button or the standard JavaScript SDK to create buttons and respond to key events (onApprove, onError, onCancel, onShippingChange).

The JavaScript Button Render provides a straightforward and efficient way to integrate the PayPal button into your website, enhancing both functionality and user experience. To ensure that the PayPal button functions correctly and delivers a seamless checkout process, you will need to prepare the following components:

You have to use Payone clientid when rendering the Payone button

Payone clientid LIVE: AVNBj3ypjSFZ8jE7shhaY2mVydsWsSrjmHk0qJxmgJoWgHESqyoG35jLOhH3GzgEPHmw7dMFnspH6vim
merchant ID/ Account ID: Your Merchant ID (for the Javascript SDK only, see Credentials)

 

Test Data (fixed):

client ID: AUn5n-4qxBUkdzQBv6f8yd8F4AWdEvV6nLzbAifDILhKGCjOS62qQLiKbUbpIKH_O2Z3OL8CvX7ucZfh
merchant ID/ Account ID: 3QK84QGGJE5HW (for the Javascript SDK only, currently fixed)

Example: Render PayPal Button
<body>
    <script>
        paypal.Buttons({

            style: {
                layout: 'vertical', // vertical or horizontal
                color: 'gold', // gold, blue, black, silver, white
                shape: 'rect', // rect, pill
                label: 'checkout', // paypal, pay, subscribe, checkout, buynow
                height: 40 // 25 - 55, a value around 40 is recommended
            },

            createOrder: function(data, actions) {
                // call your own serverside script for pre-/authorization call to payone
                return fetch('create_order.php', {
                    method: 'post'
                }).then(function(res) {
                    return res.text();
                }).then(function(orderID) {
                    return orderID;
                });
            },

            onApprove: function(data, actions) {
                // redirect to your serverside success handling script/page
                window.location = 'handle_on_approve.php';
            },

            onCancel: function(data, actions) {
                console.log("Customer cancelled the PayPal Checkout Flow");
                // add your actions on cancellation
            },

            onError: function() {
                console.log("An Error occurred as part of the PayPal JS SDK");
                // add your actions if error occurs
            },

        }).render('#paypal-button-container');
    </script>

    <div id="paypal-button-container"></div>
</body>

Enable shipping and payment updates

The display of payment and shipping might change depending on the shipping address retrieved from PayPal. Therefore you have the option to patch/update your order after the redirection from PayPal back to the merchant. 

API Requests

Before proceeding to specific API requests for PayPal V2 your should familiarise yourself with the general Payone Server API interface definition as described in Channel Server API - Platform - PAYONE docs.
In this section we will describe the request chain specific remarks for PayPal Checkout V2 integration.

POST Request - Pre-/ Authorization
Account Parameters
request
required
Fixed Value: preauthorization / authorization
mid
required
your merchant ID, 5-digit numeric
aid
required
your subaccount ID, 5-digit numeric
portalId
required
your Portal ID, 7-digit numeric
key
required
your key value, alpha-numeric
clearingtype
required
Fixed Value: wlt
common Parameters
amount
required
Format NUMERIC(1..10)
Permitted values max. +/- 19 999 999 99

Specifies the total gross amount of a payment transaction.

Value is given in smallest currency unit, e.g. Cent of Euro; Pence of Pound sterling; Öre of Swedish krona.

The amount must be less than or equal to the amount of the corresponding booking.

currency
required
Fixed Value EUR
narrative_text
optional
Format CHAR(1..81)

Dynamic text element on account statements (3 lines with 27 characters each) and credit card statements.

add_paydata Parameters

add_paydata[redirection_mode] is a required parameter if the JavaScript SDK is used.

add_paydata[redirection_mode]
required
Fixed Value: DIRECT_TO_MERCHANT

This parameter is utilized exclusively when the JavaScript SDK is implemented and the payment method is not PayPal Express. It signifies the specific redirection value to be used after the customer completes the transaction with PayPal.

PERSONAL DATA Parameters
customerid
optional
Format CHAR(1..20)
Permitted Symbols [0-9, a-z, A-Z, .,-,_,/]

Merchant's customer ID, defined by you / merchant to refer to the customer record.

"customerid" can be used to identify a customer record. 
If "customerid" is used then stored customer data are loaded automatically.
userid
optional
Format NUMERIC(6..12)

PAYONE User ID, defined by PAYONE

salutation
optional
Format CHAR(1..10)

The customer's salutation

title
optional
Format CHAR(1..20)
Samples

Dr / Prof. / Dr.-Ing.

Title of the customer

firstname
optional
Format CHAR(1..50)

First name of customer; optional if company is used, i.e.: you may use "company" or "lastname" or "firstname" plus "lastname"

lastname
required
Format CHAR(2..50)

Last name of customer; optional if company is used, i.e.: you may use "company" or "lastname" or "firstname" plus "lastname"

company
optional
Format CHAR(2..50)

Comany name of customer; optional if company is used, i.e.: you may use "company" or "lastname" or "firstname" plus "lastname"

street
optional
Format CHAR(1..50)

Street number and name (required: at least one character)

addressaddition
optional
Format CHAR(1..50)
Samples

7th floor / c/o Maier

Specifies an additional address line for the invoice address of the customer.

zip
optional
Format CHAR(2..50)
Permitted Symbols [0-9][A-Z][a-z][_.-/ ]

Postcode

city
optional
Format CHAR(2..50)

City of customer

country
required
Fixed Value DE
email
optional
Format CHAR(5..254)

Mandatory if "add_paydata[shopping_cart_type]=DIGITAL"

Permitted Symbols RFC 5322

Special Remark email validation:

Max. length for email is 254 characters. Validation is set up in the following way:

Username = Max. 63 characters

Domain Name = Max. 63 characters
Domain Suffixes = Max. 4 suffixes with max. 124 characters 
Example: username[63]@domain_name[63].suffix[60].suffix[60].suffix[4]

"@" and "." is counted as a character as well; in case of a total of three suffixes, this would allow a total of 254 characters.

email-address of customer

telephonenumber
optional
Format CHAR(1..30)

Phone number of customer

birthday
optional
Format DATE(8), YYYYMMDD
Samples

20190101 / 19991231

Date of birth of customer

language
optional
Format LIST
Permitted values ISO 639-1 (Language)2-letter-codes

Language indicator (ISO 639) to specify the language that should be presented to the customer (e.g. for error messages, frontend display).

If the language is not transferred, the browser language will be used. For a non-supported language English will be used.

vatid
optional
Format CHAR(1..50)

VAT identification number. Used for b2b transactions to indicate VAT number of customer.

gender
optional
Format LIST
Permitted values f / m / d

Gender of customer (female / male / diverse* )

* currently not in use

personalid
optional
Format CHAR(1..32)
Permitted Symbols [0-9][A-Z][a-z][+-./()]

Person specific numbers or characters, e.g. number of passport / ID card

ip
optional
Format CHAR(1..39)

Customer's IP-V4-address (123.123.123.123) or IP-V6-address

Delivery data Parameters
shipping_firstname
required
Format CHAR(1..50)

First name of delivery address

shipping_lastname
required
Format CHAR(1..50)

Surname of delivery address

shipping_company
optional
Format CHAR(2..50)

Company name of delivery address

shipping_street
optional
Format CHAR(2..50)

Street number and name of delivery address

shipping_zip
required
Format CHAR(2..50)

Postcode of delivery address

shipping_addressaddition
optional
Format CHAR(1..50)

Specifies an additional address line for the delivery address of the customer, e.g. "7th floor", "c/o Maier".

shipping_country
optional
Format LIST
Permitted values ISO 3166 2-letter-codes
Samples

DE / GB / US

Specifies country of address for the customer.

Some countries require additional information in parameter "state"

shipping_state
optional
Format LIST
Permitted values ISO 3166-2 States (regions) 2-letter-codes
Samples US Samples CA
AK BC
AB AR
AL BA
Wallet PARAMETERS
wallettype
required
Fixed Value: PAL
successurl
required
Format CHAR(2..255)

Scheme <scheme>://<host>/<path>
       <scheme>://<host>/<path>?<query>
       
scheme-pattern: [a-zA-Z]{1}[a-zA-Z0-9]{1,9}

URL for "payment successful"

errorurl
required
Format CHAR(2..255)

Scheme <scheme>://<host>/<path>
       <scheme>://<host>/<path>?<query>
       
scheme-pattern: [a-zA-Z]{1}[a-zA-Z0-9]{1,9}

URL for "faulty payment"

backurl
required
Format CHAR(2..255)

Scheme <scheme>://<host>/<path>
       <scheme>://<host>/<path>?<query>
       
scheme-pattern: [a-zA-Z]{1}[a-zA-Z0-9]{1,9}

URL for "Back" or "Cancel"

Article Parameters
Use a second Article ([n+1]) for shipping as there are no separate parameters for it
it[n]
optional
it[n] Comments
goods Goods
shipment Shipping Charges
handling Handling fee
voucher Voucher / discount

Required for physical goods in order to ensure PayPal seller protection

id[n]
optional
Format CHAR(1..32)
Array Array elements [n] starting with [1]; serially numbered; max [400]
Permitted Symbols [0-9][a-z][A-Z], .,-,_,/

Required for physical goods in order to ensure PayPal seller protection

International Article Number (EAN bzw. GTIN)

Product number, SKU, etc. of this item

pr[n]
optional
Format NUMERIC(10) max. 19 999 999 99
Array elements [n] starting with [1]; serially numbered; max [400]

Required for physical goods in order to ensure PayPal seller protection

Unit gross price of the item in smallest unit! e.g. cent. Value negative for refund like -1500 for refund of 15 EUR

no[n]
optional
Format NUMERIC(6)
Array elements [n] starting with [1]; serially numbered; max [400]

Required for physical goods in order to ensure PayPal seller protection

Quantity of this item

de[n]
optional
Format CHAR(1..255)
Array elements [n] starting with [1]; serially numbered; max [400]

Required for physical goods in order to ensure PayPal seller protection

Description of this item. Will be printed on documents to customer.

va[n]
optional
Format NUMERIC(4)

VAT rate (% or bp)

Array elements [n] starting with [1]; serially numbered; max [400]

Response Parameters
status
required
Permitted Values
REDIRECT
ERROR
Response Parameter (redirect)
Format NUMERIC(9..12)

The txid specifies the payment process within the PAYONE platform

Format NUMERIC(6..12)

PAYONE User ID, defined by PAYONE

Format CHAR(2..2000)

Redirect URL → zMerchant system has to redirect customer to this URL to complete payment

Response Parameter (Error)
Format NUMERIC(1..6)

In case of error the PAYONE Platform returns an error code for your internal usage.

Format CHAR(1..1024)

In case of error the PAYONE Platform returns an error message for your internal usage.

Format CHAR(1..1024)

The customermessage is returned to your system in order to be displayed to the customer.

(Language selection is based on the end customer's language, parameter "language")

Host: api.pay1.de
    Content-Type: application/x-www-form-urlencoded  
Payload
mid=23456
portalid=12345123
key=abcdefghijklmn123456789
api_version=3.11
mode=test (set to „live“ for live-requests)
request=preauthorization
encoding=UTF-8
aid=12345
clearingtype=wlt
reference=Ref123456
language: de,
wallettype: PAL,
currency: EUR,
lastname: PM-Tester,
firstname: Paul,
country: DE,
amount: 1500,
successurl: https: //success.com,
errorurl: https: //error.com,
backurl: https: //back.com,
shipping_firstname: Peter,
shipping_lastname: Pan,
shipping_zip: 13587,
shipping_city: Berlin,
shipping_country: DE,
shipping_street: Mustergasse5,
email: email@email.de,
add_paydata[redirection_mode]: DIRECT_TO_MERCHANT,
userid: 27975892,
it[n]: goods,
it[n+1]: shipment,
id[n]: 1001,
id[n+1]: 1002,
pr[n]: 1000,
pr[n+1]: 500,
de[n]: Schuhe,
de[n+1]: Versand,
no[n]: 1,
no[n+1]: 1,
va[n]: 19,
va[n+1]: 19  
RESPONSE
status: REDIRECT,
txid: 1202914664,
userid: 27975892,
redirecturl: https: //www.sandbox.paypal.com/checkoutnow?token,
add_paydata[orderId]: 94765686BK5419036,
add_paydata[workorderid]: PP2AADTNKQR0BEZH

---end

POST Request - genericpayment – add_paydata[action] = confirm_order_status
This generic call is mandatory if the SDK is being used.

---end

Account Parameters
request
required
Fixed Value: preauthorization / authorization
mid
required
your merchant ID, 5-digit numeric
aid
required
your subaccount ID, 5-digit numeric
portalId
required
your Portal ID, 7-digit numeric
key
required
your key value, alpha-numeric

---end

Common Parameters
mode
required
Fixed Value: test/live

Can be either test environment (test) or live environment (live)

reference
optional
Format CHAR(2..255)

A unique ID that will be displayed in your shop backend and for the customer

currency
required
Format LIST
Permitted values ISO 4217 (currencies) 3-letter-codes
Samples

EUR / USD / GBP

workorderid
required
Format CHAR(1..50)

The ID is unique. The returned workorderid is mandatory for the following requests of PayPal Express Checkout.

The workorderid is a technical id returned from the PAYONE platform to identify a workorder. A workorder is a part of a payment process (identified by a txid). The workorderid is used for the genericpayment request.

language
optional
Format LIST
Permitted values ISO 639-1 (Language)2-letter-codes

Language indicator (ISO 639) to specify the language that should be presented to the customer (e.g. for error messages, frontend display).

If the language is not transferred, the browser language will be used. For a non-supported language English will be used.

Wallet PARAMETERS
wallettype
required
Fixed Value PAL
successurl
required
Format CHAR(2..255)

Scheme <scheme>://<host>/<path>
       <scheme>://<host>/<path>?<query>
       
scheme-pattern: [a-zA-Z]{1}[a-zA-Z0-9]{1,9}

URL for "payment successful"

errorurl
required
Format CHAR(2..255)

Scheme <scheme>://<host>/<path>
       <scheme>://<host>/<path>?<query>
       
scheme-pattern: [a-zA-Z]{1}[a-zA-Z0-9]{1,9}

URL for "faulty payment"

backurl
required
Format CHAR(2..255)

Scheme <scheme>://<host>/<path>
       <scheme>://<host>/<path>?<query>
       
scheme-pattern: [a-zA-Z]{1}[a-zA-Z0-9]{1,9}

URL for "Back" or "Cancel"

---end

Paydata Parameters
add_paydata[action]
required
Fixed Value: confirm_order

---end

Response Parameters
status
required
Permitted Values
OK / ERROR
Response Parameter (OK)
workorderid
Format AN(1..16)

The ID is unique. The returned workorderid is mandatory for the following requests of PayPal Express Checkout.

The workorderid is a technical id returned from the PAYONE platform to identify a workorder. A workorder is a part of a payment process (identified by a txid). The workorderid is used for the genericpayment request.

---

ReSponse Parameter (Error)
errorcode
Format NUMERIC(1..6)

In case of error the PAYONE Platform returns an error code for your internal usage.

errormessage
Format CHAR(1..1024)

In case of error the PAYONE Platform returns an error message for your internal usage.

customermessage
Format CHAR(1..1024)

The customermessage is returned to your system in order to be displayed to the customer.

(Language selection is based on the end customer's language, parameter "language")

Host: api.pay1.de
    Content-Type: application/x-www-form-urlencoded
    
Payload
mid: 18323,
portalid: 2013285,
key: 1856f15989f3df533f77f294a6871c2a,
clearingtype: wlt,
mode: test,
encoding: UTF-8,
request: genericpayment,
reference: jv-1727774862,
aid: 18324,
language: de,
wallettype: PAL,
add_paydata[action]: confirm_order_status,
workorderid: PP2AADTBNQ9BCL80,
currency: EUR,
successurl: https: //paypal.mirage.zznza.pay1-test.de/success.php,
errorurl: https: //paypal.mirage.zznza.pay1-test.de/error-php,
backurl: https: //paypal.mirage.zznza.pay1-test.de/error-php

RESPONSE
status=OK
workorderid: PP2AADTBNQ9BCL80              

---end

POST Request - Capture
Account Parameters
request
required
Fixed Value: capture
mid
required
your merchant ID, 5-digit numeric
aid
required
your subaccount ID, 5-digit numeric
portalId
required
your Portal ID, 7-digit numeric
key
required
your key value, alpha-numeric
common Parameters
txid
required
Format NUMERIC(9..12)

The txid specifies the payment process within the PAYONE platform

sequencenumber
optional
Format NUMERIC(1..3)
Permitted values 0..127

Sequence number for this transaction within the payment process (1..n), e.g. PreAuthorization: 0, 1. Capture: 1, 2. Capture: 2

Required for multi partial capture (starting with the 2nd capture)

amount
required
Format NUMERIC(1..10)
Permitted values max. +/- 19 999 999 99

Specifies the total gross amount of a payment transaction.

Value is given in smallest currency unit, e.g. Cent of Euro; Pence of Pound sterling; Öre of Swedish krona.

The amount must be less than or equal to the amount of the corresponding booking.

currency
required
Fixed Value EUR
narrative_text
optional
Format CHAR(1..81)

Dynamic text element on account statements (3 lines with 27 characters each) and credit card statements.

Response Parameters
Permitted Values
APPROVED
PENDING
ERROR
Response Parameter (approved)
Format NUMERIC(9..12)

The txid specifies the payment process within the PAYONE platform

add_paydata[capture_id]
Format CHAR(16)

The capture ID can be used for multiple captures and refunds, to connect a specific refund to a specific capture

Format LIST
Value Comment

yes

Settlement of outstanding balances has been carried out.

no

Settlement of outstanding balances has not been carried out.

Provides information about whether a settlement of balances has been carried out.

Response parameters (pending)
Format NUMERIC(9..12)

The txid specifies the payment process within the PAYONE platform

Format NUMERIC(6..12)

PAYONE User ID, defined by PAYONE

Response Parameter (Error)
Format NUMERIC(1..6)

In case of error the PAYONE Platform returns an error code for your internal usage.

Format CHAR(1..1024)

In case of error the PAYONE Platform returns an error message for your internal usage.

Host: api.pay1.de
Content-Type: application/x-www-form-urlencoded
Payload
mid=23456 (your mid)
portalid=12345123 (your portalid)
key=abcdefghijklmn123456789 (your key)
api_version=3.10
mode=test (set to „live“ for live-requests)
request=capture
encoding=UTF-8
id[n]: 1001001,
id[n+1]: 1001002,
it[n]: goods,
it[n+1]: shipment,
no[n]: 1,
no[n+1]: 1,
pr[n]: 20000,
pr[n+1]: 500,
de[n]: Testartikel1,
de[n+1]: Transport,
va[n]: 19,
va[n+1]: 19,
amount: 20500,
currency: EUR,
sequencenumber: 1,
settleaccount: auto,
txid: 1202830913
RESPONSE
status: APPROVED,
txid: 1202830913,
add_paydata[capture_id]: TX2AAD7XN4UFGG9X,
settleaccount: yes
POST Request - Debit
Account Parameters
request
required
Fixed Value: debit
mid
required
your merchant ID, 5-digit numeric
aid
required
your subaccount ID, 5-digit numeric
portalId
required
your Portal ID, 7-digit numeric
key
required
your key value, alpha-numeric
Common Parameters
txid
required
Format NUMERIC(9..12)

The txid specifies the payment process within the PAYONE platform

sequencenumber
required
Format NUMERIC(1..3)
Permitted values 0..127

Sequence number for this transaction within the payment process (1..n), e.g. PreAuthorization: 0, 1. Capture: 1, 2. Capture: 2

Required for multi partial capture (starting with the 2nd capture)

amount
required
Format NUMERIC(1..10)
Permitted values max. +/- 19 999 999 99

Specifies the total gross amount of a payment transaction.

Value is given in smallest currency unit, e.g. Cent of Euro; Pence of Pound sterling; Öre of Swedish krona.

The amount must be less than or equal to the amount of the corresponding booking.

currency
required
Fixed Value EUR
narrative_text
optional
Format CHAR(1..81)

Dynamic text element on account statements (3 lines with 27 characters each) and credit card statements.

add_paydata[capture_id]
optional
Fixed Char(1..16)

The capture ID can be used for multiple captures and refunds, to connect a specific refund to a specific capture

use_customerdata
optional
Format LIST
Value Comment
yes

Uses current account details from debtor's master data (default)

no

Uses the last known account details in the payment process

Use account details from debtor's master data

transaction_param
optional
Format CHAR(1..50)
Permitted Symbols [0-9][A-Z][a-z][.-_/]

Optional parameter for merchant information (per payment request)

Response Parameters
Permitted Values
APPROVED
PENDING
ERROR
Response Parameter (approved)
txid
Format NUMERIC(9..12)

The txid specifies the payment process within the PAYONE platform

settleaccount
Format LIST
Value Comment
yes Settlement of outstanding balances has been carried out.
no Settlement of outstanding balances has not been carried out.

Provides information about whether a settlement of balances has been carried out.

Response Parameter (error)
errorcode
Format NUMERIC(1..6)

In case of error the PAYONE Platform returns an error code for your internal usage.

errormessage
Format CHAR(1..1024)

In case of error the PAYONE Platform returns an error message for your internal usage.

customermessage
Format CHAR(1..1024)

The customermessage is returned to your system in order to be displayed to the customer.

(Language selection is based on the end customer's language, parameter "language")

Host: api.pay1.de
Content-Type: application/x-www-form-urlencoded
Payload
mid=23456
portalid=12345123
key=abcdefghijklmn123456789
api_version=3.10
mode=test (set to „live“ for live-requests)
request=capture
encoding=UTF-8
request: refund,
aid: 54321,
sequencenumber: 2,
txid: 1202830913,
amount: -20500,
currency: EUR
RESPONSE
status: APPROVED,
txid: 1202830913

Sequence Diagrams

Server to Server Preauthorization - Capture - Refund

 

Javascript sDK - Preauthorization - Capture - Refund

 

Server to Server - Authorization - Refund

Javascript sDK - Authorization - Refund