PayPal Test Cases

🚧

This page is about the PayPal V2 integration

For information on PayPalExpressCheckoutDeposit see here.


# Introduction

## Pre-requisites

Before you can start testing the **PayPal payment method** it must be activated for your merchant/shop. Contact your account manager or the Support team to request this configuration.

A valid request for a **[PayPal Deposit](doc:paypal-v2)** needs to contain the following details:

* tbd

# Test Cases

## PayPal Reference Deposit (393)

**Pre-requisites**\
A PayPal Reference Deposit can only be performed if beforehand the customer has set up a successful **billing agreement**. Find here more information how to setup a new Billing Agreement for PayPal:  [Paypal Setup New Billing Agreement](doc:paypal-setup-new-billing-agreement)

Please refer to the [Paypal V2](doc:paypal-v2#paypal-reference-deposit-393) page for information how to create an initiatePayment request for a PayPal Reference Deposit (393).

#### <span style={{ color: "DodgerBlue" }}>***SUCCESS*** cases:</span>

#### **PayPal Reference Deposit*WITH* automatic capturing:**

> 📘
>
> *Pre-condition: Automatic capturing is enabled for the merchant*

| \#            | Test Case Name                        | Steps to Execute                                                                                                                                                                                                       | Expected Outcome                                                                             |
| :------------ | :------------------------------------ | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------- |
| SUCC\_PPREF01 | SUCCESSFUL *PayPal Reference Deposit* | 1\. Create a *PayPal Reference Deposit* (393) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with a payment account which has an existing *PayPal Billing Agreement* | A *Paypal Reference Deposit* payment is created and is in the state "*DepositedByProvider*". |

#### **PayPal Reference Deposit*WITHOUT* automatic capturing:**

> 📘
>
> *Pre-condition: Automatic capturing is disabled for the merchant*

<Table align={["left","left","left","left"]}>
    <thead>
    <tr>
        <th>
            \#
        </th>

        <th>
            Test Case Name
        </th>

        <th>
            Steps to Execute
        </th>

        <th>
            Expected Outcome
        </th>
    </tr>
    </thead>

    <tbody>
    <tr>
        <td>
            SUCC\_PPREF02
        </td>

        <td>
            SUCCESSFUL Capture of an initiated *PayPal Reference Deposit*
        </td>

        <td>
            1. Create a *PayPal Reference Deposit* (393) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with a payment account which has an existing PayPal Billing Agreement and the payment should be initiated in the state "*ExecutedByProvider*"

            2\. Capture the created *PayPal Reference Deposit* payment by sending the [executePaymentAction](https://developer.kalixa.com/reference#executepaymentaction) request with the actionID = 2 (Capture Payment)
        </td>

        <td>
            The *PayPal Reference Deposit* is captured successfully and is in the state "*DepositedByProvider*"
        </td>
    </tr>
    </tbody>
</Table>

#### <span style={{ color: "DodgerBlue" }}>***PENDING*** cases:</span>

| \#            | Test Case Name                     | Steps to Execute                                                                                                                                                                                                  | Expected Outcome                                                                           |
| :------------ | :--------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------- |
| PEND\_PPREF01 | PENDING *PayPal Reference Deposit* | 1\. Create a *PayPal Reference Deposit* (393) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with a specific payment data *ForcedProviderRespons\_e =\_PENDING* | A *Paypal Reference Deposit* payment is created and is in the state "*PendingOnProvider*". |

#### <span style={{ color: "DodgerBlue" }}>***ERROR*** cases:</span>

Error occurs during the "<span style={{ color: "DodgerBlue" }}>*create order*</span>" phase:

<Table align={["left","left","left","left"]}>
    <thead>
    <tr>
        <th>
            \#
        </th>

        <th>
            Test Case Name
        </th>

        <th>
            Steps to Execute
        </th>

        <th>
            Expected Outcome
        </th>
    </tr>
    </thead>

    <tbody>
    <tr>
        <td>
            ERR\_PPREF\_CO01
        </td>

        <td>
            Missing Billing Agreement
        </td>

        <td>
            1\. Create a *PayPal Reference Deposit* (393) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with a payment account which does not have an existing *PayPal Billing Agreement*
        </td>

        <td>
            A *Paypal Reference Deposit* payment is created and is in the state "*ValidationFailed*".
        </td>
    </tr>

    <tr>
        <td>
            <a id="ERR_PPREF_CO02"></a>\
            ERR\_PPREF\_CO02
        </td>

        <td>
            INVALID\_CURRENCY\_CODE
        </td>

        <td>
            1\. Create a *PayPal Reference Deposit* (393) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with a specific payment data *ForcedProviderRespons\_e =\_INVALID\_CURRENCY\_CODE*
        </td>

        <td>
            A *Paypal Reference Deposit* payment is created and is in the state "*ExecuteErrorReportedByProvider*".

            ProviderResponseMessage = *INVALID\_CURRENCY\_CODE* is returned in the response
        </td>
    </tr>

    <tr>
        <td>
            ERR\_PPREF\_CO03
        </td>

        <td>
            INVALID\_COUNTRY\_CODE
        </td>

        <td>
            1\. Create a *PayPal Reference Deposit* (393) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with a specific payment data *ForcedProviderRespons\_e =\_INVALID\_COUNTRY\_CODE*
        </td>

        <td>
            A *Paypal Reference Deposit* payment is created and is in the state "*ExecuteErrorReportedByProvider*".

            ProviderResponseMessage = *INVALID\_COUNTRY\_CODE* is returned in the response
        </td>
    </tr>

    <tr>
        <td>
            ERR\_PPREF\_CO04
        </td>

        <td>
            INTERNAL\_SERVER\_ERROR
        </td>

        <td>
            1\. Create a *PayPal Reference Deposit* (393) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with a specific payment data *ForcedProviderRespons\_e =\_INTERNAL\_SERVER\_ERROR*
        </td>

        <td>
            A *Paypal Reference Deposit* payment is created and is in the state "*ExecuteErrorReportedByProvider*".

            ProviderResponseCode = *INTERNAL\_SERVER\_ERROR* is returned in the response
        </td>
    </tr>
    </tbody>
</Table>

Error occurs during the "<span style={{ color: "DodgerBlue" }}>*capture payment for order*</span>" phase:

<Table align={["left","left","left","left"]}>
    <thead>
    <tr>
        <th>
            \#
        </th>

        <th>
            Test Case Name
        </th>

        <th>
            Steps to Execute
        </th>

        <th>
            Expected Outcome
        </th>
    </tr>
    </thead>

    <tbody>
    <tr>
        <td>
            <a id="ERR_PPREF_CPO01"></a>
            ERR\_PPREF\_CPO01
        </td>

        <td>
            COMPLIANCE<br />\_VIOLATION
        </td>

        <td>
            1\. Create a *PayPal Reference Deposit* (393) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with a specific payment data *ForcedProviderRespons\_e =\_COMPLIANCE\_VIOLATION*
        </td>

        <td>
            A *Paypal Reference Deposit* payment is created and is in the state "*DepositErrorReportedByProvider*".

            ProviderResponseMessage = *COMPLIANCE\_VIOLATION* is returned in the response
        </td>
    </tr>

    <tr>
        <td>
            ERR\_PPREF\_CPO02
        </td>

        <td>
            INVALID<br />\_RESOURCE\_ID
        </td>

        <td>
            1\. Create a *PayPal Reference Deposit* (393) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with a specific payment data *ForcedProviderRespons\_e =\_INVALID\_RESOURCE\_ID*
        </td>

        <td>
            A *Paypal Reference Deposit* payment is created and is in the state "*DepositErrorReportedByProvider*".

            ProviderResponseMessage = *INVALID\_RESOURCE\_ID* is returned in the response
        </td>
    </tr>

    <tr>
        <td>
            ERR\_PPREF\_CPO03
        </td>

        <td>
            PAYER\_ACCOUNT<br />\_LOCKED\_OR\_CLOSED
        </td>

        <td>
            1\. Create a *PayPal Reference Deposit* (393) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with a specific payment data *ForcedProviderRespons\_e =\_PAYER\_ACCOUNT<br />\_LOCKED\_OR\_CLOSED*
        </td>

        <td>
            A *Paypal Reference Deposit* payment is created and is in the state "*DepositErrorReportedByProvider*".

            ProviderResponseMessage = *PAYER\_ACCOUNT<br />\_LOCKED\_OR\_CLOSED* is returned in the response
        </td>
    </tr>

    <tr>
        <td>
            ERR\_PPREF\_CPO04
        </td>

        <td>
            PAYER\_ACCOUNT<br />\_RESTRICTED
        </td>

        <td>
            1\. Create a *PayPal Reference Deposit* (393) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with a specific payment data *ForcedProviderRespons\_e =\_PAYER\_ACCOUNT\_RESTRICTED*
        </td>

        <td>
            A *Paypal Reference Deposit* payment is created and is in the state "*DepositErrorReportedByProvider*".

            ProviderResponseMessage = *PAYER\_ACCOUNT\_RESTRICTED* is returned in the response
        </td>
    </tr>

    <tr>
        <td>
            ERR\_PPREF\_CPO05
        </td>

        <td>
            PAYER\_CANNOT\_PAY
        </td>

        <td>
            1\. Create a *PayPal Reference Deposit* (393) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with a specific payment data *ForcedProviderRespons\_e =\_PAYER\_CANNOT\_PAY*
        </td>

        <td>
            A *Paypal Reference Deposit* payment is created and is in the state "*DepositErrorReportedByProvider*".

            ProviderResponseMessage = *PAYER\_CANNOT\_PAY* is returned in the response
        </td>
    </tr>

    <tr>
        <td>
            ERR\_PPREFCPO06
        </td>

        <td>
            INTERNAL\_SERVER<br />\_ERROR
        </td>

        <td>
            1\. Create a *PayPal Reference Deposit* (393) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with a specific payment data *ForcedProviderRespons\_e =\_INTERNAL\_SERVER\_ERROR*
        </td>

        <td>
            A *Paypal Reference Deposit* payment is created and is in the state "*DepositErrorReportedByProvider*".

            ProviderResponseMessage = *INTERNAL\_SERVER\_ERROR* is returned in the response
        </td>
    </tr>

    <tr>
        <td>
            ERR\_PPREF\_CPO07
        </td>

        <td>
            BILLING\_AGREEMENT<br />\_NOT\_FOUND
        </td>

        <td>
            1\. Create a *PayPal Reference Deposit* (393) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with a specific payment data *ForcedProviderRespons\_e =\_BILLING\_AGREEMENT\_NOT\_FOUND*
        </td>

        <td>
            A *Paypal Reference Deposit* payment is created and is in the state "*DepositErrorReportedByProvider*".

            ProviderResponseMessage = *BILLING\_AGREEMENT<br />\_NOT\_FOUND* is returned in the response
        </td>
    </tr>

    <tr>
        <td>
            ERR\_PPREF\_CPO08
        </td>

        <td>
            AGREEMENT\_ALREADY<br />\_CANCELLED
        </td>

        <td>
            1\. Create a *PayPal Reference Deposit* (393) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with a specific payment data *ForcedProviderRespons\_e =\_AGREEMENT\_ALREADY\_CANCELLED*
        </td>

        <td>
            A *Paypal Reference Deposit* payment is created and is in the state "*DepositErrorReportedByProvider*".

            ProviderResponseMessage = *AGREEMENT\_ALREADY<br />\_CANCELLED* is returned in the response
        </td>
    </tr>

    <tr>
        <td>
            REF\_PPREF\_CPO01
        </td>

        <td>
            INSTRUMENT<br />\_DECLINED
        </td>

        <td>
            1\. Create a *PayPal Reference Deposit* (393) by sending a[*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with a specific payment data *ForcedProviderRespons\_e =\_INSTRUMENT\_DECLINED*
        </td>

        <td>
            A *Paypal Reference Deposit* payment is created and is in the state "*RefusedByProvider*".

            ProviderResponseMessage = *INSTRUMENT\_DECLINED* is returned in the response
        </td>
    </tr>

    <tr>
        <td>
            REF\_PPREF\_CPO02
        </td>

        <td>
            PAYEE\_BLOCKED<br />\_TRANSACTION
        </td>

        <td>
            1\. Create a *PayPal Reference Deposit* (393) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with a specific payment data *ForcedProviderRespons\_e =\_PAYEE\_BLOCKED\_TRANSACTION*
        </td>

        <td>
            A *Paypal Reference Deposit* payment is created and is in the state "*RefusedByProvider*".

            ProviderResponseMessage = *PAYEE\_BLOCKED<br />\_TRANSACTION* is returned in the response
        </td>
    </tr>

    <tr>
        <td>
            REF\_PPREF\_CPO03
        </td>

        <td>
            TRANSACTION<br />\_BLOCKED\_BY\_PAYEE
        </td>

        <td>
            1\. Create a *PayPal Reference Deposit* (393) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with a specific payment data *ForcedProviderRespons\_e =\_TRANSACTION\_BLOCKED\_BY\_PAYEE*
        </td>

        <td>
            A *Paypal Reference Deposit* payment is created and is in the state "*RefusedByProvider*".

            ProviderResponseMessage = *TRANSACTION<br />\_BLOCKED\_BY\_PAYEE* is returned in the response
        </td>
    </tr>

    <tr>
        <td>
            REF\_PPREF\_CPO04
        </td>

        <td>
            TRANSACTION<br />\_LIMIT\_EXCEEDED
        </td>

        <td>
            1\. Create a *PayPal Reference Deposit* (393) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with a specific payment data *ForcedProviderRespons\_e =\_TRANSACTION\_LIMIT\_EXCEEDED*
        </td>

        <td>
            A *Paypal Reference Deposit* payment is created and is in the state "*RefusedByProvider*".

            ProviderResponseMessage = *TRANSACTION<br />\_LIMIT\_EXCEEDED* is returned in the response
        </td>
    </tr>

    <tr>
        <td>
            REF\_PPREF\_CPO05
        </td>

        <td>
            TRANSACTION<br />\_REFUSED
        </td>

        <td>
            1\. Create a *PayPal Reference Deposit* (393) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with a specific payment data *ForcedProviderRespons\_e =\_TRANSACTION\_REFUSED*
        </td>

        <td>
            A *Paypal Reference Deposit* payment is created and is in the state "*RefusedByProvider*".

            ProviderResponseMessage = *TRANSACTION<br />\_REFUSED* is returned in the response
        </td>
    </tr>
    </tbody>
</Table>

## PayPal Redirect Deposit (394)

Please refer to the [Paypal V2](https://developer.kalixa.com/docs/paypal-v2#paypal-redirect-deposit-394) page for information how to create an initiatePayment request for a PayPal Reference Deposit (394).

#### <span style={{ color: "DodgerBlue" }}>***SUCCESS*** cases:</span>

#### **PayPal Reference Deposit*WITH* automatic capturing:**

> 📘
>
> *Pre-condition: Automatic capturing is enabled for the merchant*

<Table align={["left","left","left","left"]}>
    <thead>
    <tr>
        <th>
            \#
        </th>

        <th>
            Test Case Name
        </th>

        <th>
            Steps to Execute
        </th>

        <th>
            Expected Outcome
        </th>
    </tr>
    </thead>

    <tbody>
    <tr>
        <td>
            SUCC\_PPRED01
        </td>

        <td>
            SUCCESSFUL *PayPal Redirect Deposit*
        </td>

        <td>
            1. Create a *PayPal Redirect Deposit* (394) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with\
            the following specific payment data in addition:

            * SuccessPageUrl
            * CancelPageUrl

            2. Redirect your customer to PayPal by using the \_RedirectionUrl \_returned in the initiatePayment response

            3\. Customer logs into PayPal page and approves the order
        </td>

        <td>
            1. A *Paypal Redirect Deposit* payment is created and is in the state "*RedirectURLCreated*".\
            A \_RedirectionUrl \_is returned in the initiatePayment response

            2. Customer is redirected to PayPal Login page

            3a. Merchant is notified by PaymentService if the order has been approved by Customer and PaymentService has queried the order details including the payer details on PayPal.

            The notification includes the status of the order and the payer (Customer) related details.

            The *Paypal Redirect Deposit* payment is in the state "*ApprovedByProvider*".

            3b. Merchant is notified again by PaymentService as soon as the order has been captured successfully by PayPal.\
            (*automatic capturing*)

            4. Customer is redirected to a success page specified in the initiatePayment request

            5\. The *Paypal Redirect Deposit* payment is in the state "*DepositedByProvider*".
        </td>
    </tr>
    </tbody>
</Table>

#### **PayPal Reference Deposit*WITHOUT* automatic capturing:**

> 📘
>
> *Pre-condition: Automatic capturing is disabled for the merchant*

<Table align={["left","left","left","left"]}>
    <thead>
    <tr>
        <th>
            \#
        </th>

        <th>
            Test Case Name
        </th>

        <th>
            Steps to Execute
        </th>

        <th>
            Expected Outcome
        </th>
    </tr>
    </thead>

    <tbody>
    <tr>
        <td>
            SUCC\_PPRED02
        </td>

        <td>
            SUCCESSFUL *PayPal Redirect Deposit*
        </td>

        <td>
            1. Create a *PayPal Redirect Deposit* (394) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with\
            the following specific payment data in addition:

            * SuccessPageUrl
            * CancelPageUrl

            2. Redirect your customer to PayPal by using the \_RedirectionUrl \_returned in the initiatePayment response

            3. Customer logs into PayPal page and approves the order

            4\. Merchant can capture the created *PayPal Redirect Deposit* payment by sending the [*executePaymentAction*](https://developer.kalixa.com/reference#executepaymentaction) request with the actionID = 2 (Capture Payment)
        </td>

        <td>
            1. A *Paypal Redirect Deposit* payment is created and is in the state "*RedirectURLCreated*".\
            A \_RedirectionUrl \_is returned in the initiatePayment response

            2. Customer is redirected to PayPal Login page

            3. Merchant is notified by PaymentService if the order has been approved by Customer and PaymentService has queried the order details including the payer details on PayPal.

            The notification includes the status of the order and the payer (Customer) related details.

            The *Paypal Redirect Deposit* payment is in the state "*ApprovedByProvider*".\
            &#x9;\
            4\. Merchant is notified by PaymentService as soon as the order has been captured successfully by PayPal

            5. Customer is redirected to a success page specified in the initiatePayment request

            6\. The *Paypal Redirect Deposit* payment is in the state "*DepositedByProvider*".
        </td>
    </tr>
    </tbody>
</Table>

#### <span style={{ color: "DodgerBlue" }}>***PENDING*** cases:</span>

<Table align={["left","left","left","left"]}>
    <thead>
    <tr>
        <th>
            \#
        </th>

        <th>
            Test Case Name
        </th>

        <th>
            Steps to Execute
        </th>

        <th>
            Expected Outcome
        </th>
    </tr>
    </thead>

    <tbody>
    <tr>
        <td>
            PEND\_PPRED01
        </td>

        <td>
            PENDING *PayPal Redirect Deposit*\
            (with automatic capturing enabled)
        </td>

        <td>
            1. Create a *PayPal Redirect Deposit* (394) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with a specific payment data

            * SuccessPageUrl
            * CancelPageUrl
            * *ForcedProviderRespons\_e =\_PENDING*

            2. Redirect your customer to PayPal by using the \_RedirectionUrl \_returned in the initiatePayment response

            3\. Customer logs into PayPal page and approves the order
        </td>

        <td>
            1. A *Paypal Redirect Deposit* payment is created and is in the state "*RedirectURLCreated*".\
            A \_RedirectionUrl \_is returned in the initiatePayment response

            2. Customer is redirected to PayPal Login page

            3a. Merchant is notified by PaymentService if the order has been approved by Customer and PaymentService has queried the order details including the payer details on PayPal.

            The notification includes the status of the order and the payer (Customer) related details.

            The *Paypal Redirect Deposit* payment is in the state "*ApprovedByProvider*".

            3b. Merchant is notified again by PaymentService as soon as the order has been captured successfully by PayPal.\
            (*automatic capturing*)

            4. Customer is redirected to a pending page ???

            5\. The *Paypal Redirect Deposit* payment is in the state "*PendingOnProvider*".
        </td>
    </tr>
    </tbody>
</Table>

#### <span style={{ color: "DodgerBlue" }}>***ERROR*** cases:</span>

Error occurs during the "<span style={{ color: "DodgerBlue" }}>*create order*</span>" phase:

**Note**: The same error cases for PayPal Reference Deposit which are simulated by using a specific payment data "***ForcedProviderResponse***" can be reproduced here for PayPal Redirected Deposit (394), started with [ERR\_PPREF\_CO02](#ERR_PPREF_CO02).

<Table align={["left","left","left","left"]}>
    <thead>
    <tr>
        <th>
            \#
        </th>

        <th>
            Test Case Name
        </th>

        <th>
            Steps to Execute
        </th>

        <th>
            Expected Outcome
        </th>
    </tr>
    </thead>

    <tbody>
    <tr>
        <td>
            ERR\_PPRED\_COxx
        </td>

        <td>
            \<***Expected ForcedProviderResponse***\>
        </td>

        <td>
            1\. Create a *PayPal Redirect Deposit* (394) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with a specific payment data *ForcedProviderResponse* = \<***Expected ForcedProviderResponse***\>
        </td>

        <td>
            A *Paypal Redirect Deposit* payment is created and is in the state "*ExecuteErrorReportedByProvider*".

            ProviderResponseMessage =  \<***Expected ForcedProviderResponse***\> is returned in the response
        </td>
    </tr>
    </tbody>
</Table>

Error occurs during the "<span style={{ color: "DodgerBlue" }}>*capture payment for order*</span>" phase:

**Note**: The same error cases for PayPal Reference Deposit which are simulated by using a specific payment data "***ForcedProviderResponse***" can be reproduced here for PayPal Redirected Deposit (394), started with [ERR\_PPREF\_CPO01](#ERR_PPREF_CPO01).

<Table align={["left","left","left","left"]}>
    <thead>
    <tr>
        <th>
            \#
        </th>

        <th>
            Test Case Name
        </th>

        <th>
            Steps to Execute
        </th>

        <th>
            Expected Outcome
        </th>
    </tr>
    </thead>

    <tbody>
    <tr>
        <td>
            ERR\_PPRED\_CPOxx
        </td>

        <td>
            \<***Expected ForcedProviderResponse***\>
        </td>

        <td>
            1. Create a *PayPal Redirect Deposit* (394) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with a specific payment data *ForcedProviderResponse* = \<***Expected ForcedProviderResponse***\>

            2. Redirect your customer to PayPal by using the \_RedirectionUrl \_returned in the initiatePayment response

            3\. Customer logs into PayPal page and approves the order
        </td>

        <td>
            1. A *Paypal Redirect Deposit* payment is created and is in the state "*RedirectURLCreated*".\
            A \_RedirectionUrl \_is returned in the initiatePayment response

            2. Customer is redirected to PayPal Login page

            3a. Merchant is notified by PaymentService if the order has been approved by Customer and PaymentService has queried the order details including the payer details on PayPal.

            The notification includes the status of the order and the payer (Customer) related details.

            The *Paypal Redirect Deposit* payment is in the state "*ApprovedByProvider*".

            3b. Merchant is notified again by PaymentService that the order has NOT been captured successfully by PayPal.\
            (*automatic capturing*)

            4. Customer is redirected to a error page

            5. The *Paypal Redirect Deposit* payment  is in the state "*DepositErrorReportedByProvider*".

            ProviderResponseMessage =  \<***Expected ForcedProviderResponse***\> is sent in the payment state notification.
        </td>
    </tr>

    <tr>
        <td>
            REFUSAL<br />\_PPRED\_CPOxx
        </td>

        <td>
            \<***Expected ForcedProviderResponse***\>
        </td>

        <td>
            1. Create a *PayPal Redirect Deposit* (394) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with a specific payment data *ForcedProviderResponse* = \<***Expected ForcedProviderResponse***\>

            2. Redirect your customer to PayPal by using the \_RedirectionUrl \_returned in the initiatePayment response

            3\. Customer logs into PayPal page and approves the order
        </td>

        <td>
            1. A *Paypal Redirect Deposit* payment is created and is in the state "*RedirectURLCreated*".\
            A \_RedirectionUrl \_is returned in the initiatePayment response

            2. Customer is redirected to PayPal Login page

            3a. Merchant is notified by PaymentService if the order has been approved by Customer and PaymentService has queried the order details including the payer details on PayPal.

            The notification includes the status of the order and the payer (Customer) related details.

            The *Paypal Redirect Deposit* payment is in the state "*ApprovedByProvider*".

            3b. Merchant is notified again by PaymentService that the order has NOT been captured successfully by PayPal.\
            (*automatic capturing*)

            4. Customer is redirected to a error page

            5. The *Paypal Redirect Deposit* payment  is in the state "*RefusedByProvider*".

            ProviderResponseMessage =  \<***Expected ForcedProviderResponse***\> is sent in the payment state notification.
        </td>
    </tr>
    </tbody>
</Table>

## PayPal Reference PreAuthorisation (396)

Please refer to the [Paypal V2](https://developer.kalixa.com/docs/paypal-v2#paypal-reference-preauthorisation-396) page for information how to create an initiatePayment request for a PayPal Reference Deposit (396).

#### <span style={{ color: "DodgerBlue" }}>***SUCCESS*** cases:</span>

<Table align={["left","left","left","left"]}>
    <thead>
    <tr>
        <th>
            \#
        </th>

        <th>
            Test Case Name
        </th>

        <th>
            Steps to Execute
        </th>

        <th>
            Expected Outcome
        </th>
    </tr>
    </thead>

    <tbody>
    <tr>
        <td>
            SUCC\_PPREFPre01
        </td>

        <td>
            SUCCESSFUL *PayPal Reference PreAuthorisation*
        </td>

        <td>
            1. Specify the [shopping cart](https://developer.kalixa.com/docs/klarna-deposit#shopping-cartbasket-information-order-lines) with all required data

            2. Provide [shipping](https://developer.kalixa.com/docs/klarna-deposit#shipping-address-and-details) information

            3\. Create a *PayPal Reference PreAuthorisation* (396) by sending an [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request containing all required data mentioned in the previous steps and a payment account which has an existing *PayPal Billing Agreement*
        </td>

        <td>
            A *Paypal Reference PreAuthorisation* payment is created and is in the state "*ExecutedByProvider*".
        </td>
    </tr>
    </tbody>
</Table>

#### <span style={{ color: "DodgerBlue" }}>***PENDING*** cases:</span>

<Table align={["left","left","left","left"]}>
    <thead>
    <tr>
        <th>
            \#
        </th>

        <th>
            Test Case Name
        </th>

        <th>
            Steps to Execute
        </th>

        <th>
            Expected Outcome
        </th>
    </tr>
    </thead>

    <tbody>
    <tr>
        <td>
            PEND\_PPREFPre01
        </td>

        <td>
            PENDING *PayPal Reference PreAuthorisation*
        </td>

        <td>
            1. Specify the [shopping cart](https://developer.kalixa.com/docs/klarna-deposit#shopping-cartbasket-information-order-lines) with all required data

            2. Provide [shipping](https://developer.kalixa.com/docs/klarna-deposit#shipping-address-and-details) information

            3. Create a *PayPal Reference PreAuthorisation* (396) by sending an [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request containing all required data mentioned in the previous steps and a payment account which has an existing *PayPal Billing Agreement*

            In addition includes also a specific payment data *ForcedProviderRespons\_e =\_PENDING* in the initiatePayment request
        </td>

        <td>
            A *Paypal Reference PreAuthorisation* payment is created and is in the state "*PendingOnProvider*".
        </td>
    </tr>
    </tbody>
</Table>

#### <span style={{ color: "DodgerBlue" }}>***ERROR*** cases:</span>

Error occurs during the "<span style={{ color: "DodgerBlue" }}>*create order*</span>" phase:

<Table align={["left","left","left","left"]}>
    <thead>
    <tr>
        <th>
            \#
        </th>

        <th>
            Test Case Name
        </th>

        <th>
            Steps to Execute
        </th>

        <th>
            Expected Outcome
        </th>
    </tr>
    </thead>

    <tbody>
    <tr>
        <td>
            ERR\_PPREFPre01
        </td>

        <td>
            INVALID\_CURRENCY\_CODE
        </td>

        <td>
            1. Specify the [shopping cart](https://developer.kalixa.com/docs/klarna-deposit#shopping-cartbasket-information-order-lines) with all required data

            2. Provide [shipping](https://developer.kalixa.com/docs/klarna-deposit#shipping-address-and-details) information

            3. Create a *PayPal Reference PreAuthorisation* (396) by sending an [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request containing all required data mentioned in the previous steps and a payment account which has an existing *PayPal Billing Agreement*

            In addition includes also a specific payment data *ForcedProviderRespons\_e =\_INVALID\_CURRENCY\_CODE* in the initiatePayment request
        </td>

        <td>
            A *Paypal Reference PreAuthorisation* payment is created and is in the state "*InitiateErrorReportedByProvider*".

            ProviderResponseMessage = *INVALID\_CURRENCY\_CODE* is returned in the response
        </td>
    </tr>

    <tr>
        <td>
            ERR\_PPREFPre02
        </td>

        <td>
            INVALID\_COUNTRY\_CODE
        </td>

        <td>
            1. Specify the [shopping cart](https://developer.kalixa.com/docs/klarna-deposit#shopping-cartbasket-information-order-lines) with all required data

            2. Provide [shipping](https://developer.kalixa.com/docs/klarna-deposit#shipping-address-and-details) information

            3. Create a *PayPal Reference PreAuthorisation* (396) by sending an [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request containing all required data mentioned in the previous steps and a payment account which has an existing *PayPal Billing Agreement*

            In addition includes also a specific payment data *ForcedProviderRespons\_e =\_INVALID\_COUNTRY\_CODE* in the initiatePayment request
        </td>

        <td>
            A *Paypal Reference PreAuthorisation* payment is created and is in the state "*InitiateErrorReportedByProvider*".

            ProviderResponseMessage = *INVALID\_COUNTRY\_CODE* is returned in the response
        </td>
    </tr>
    </tbody>
</Table>

Error occurs during the "<span style={{ color: "DodgerBlue" }}>*authorize order*</span>" phase:

<Table align={["left","left","left","left"]}>
    <thead>
    <tr>
        <th>
            \#
        </th>

        <th>
            Test Case Name
        </th>

        <th>
            Steps to Execute
        </th>

        <th>
            Expected Outcome
        </th>
    </tr>
    </thead>

    <tbody>
    <tr>
        <td>
            ERR\_PPREFPre03
        </td>

        <td>
            PAYER\_ACCOUNT<br />\_LOCKED\_OR\_CLOSED
        </td>

        <td>
            1. Specify the [shopping cart](https://developer.kalixa.com/docs/klarna-deposit#shopping-cartbasket-information-order-lines) with all required data

            2. Provide [shipping](https://developer.kalixa.com/docs/klarna-deposit#shipping-address-and-details) information

            3. Create a *PayPal Reference PreAuthorisation* (396) by sending an [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request containing all required data mentioned in the previous steps and a payment account which has an existing *PayPal Billing Agreement*

            In addition includes also a specific payment data *ForcedProviderRespons\_e =\_PAYER\_ACCOUNT<br />\_LOCKED\_OR\_CLOSED* in the initiatePayment request
        </td>

        <td>
            A *Paypal Reference PreAuthorisation* payment is created and is in the state "*ExecuteErrorReportedByProvider*".

            ProviderResponseMessage = *PAYER\_ACCOUNT<br />\_LOCKED\_OR\_CLOSED* is returned in the response
        </td>
    </tr>

    <tr>
        <td>
            ERR\_PPREFPre04
        </td>

        <td>
            PAYER\_ACCOUNT<br />\_RESTRICTED
        </td>

        <td>
            1. Specify the [shopping cart](https://developer.kalixa.com/docs/klarna-deposit#shopping-cartbasket-information-order-lines) with all required data

            2. Provide [shipping](https://developer.kalixa.com/docs/klarna-deposit#shipping-address-and-details) information

            3. Create a *PayPal Reference PreAuthorisation* (396) by sending an [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request containing all required data mentioned in the previous steps and a payment account which has an existing *PayPal Billing Agreement*

            In addition includes also a specific payment data *ForcedProviderRespons\_e =\_PAYER\_ACCOUNT<br />\_RESTRICTED* in the initiatePayment request
        </td>

        <td>
            A *Paypal Reference PreAuthorisation* payment is created and is in the state "*ExecuteErrorReportedByProvider*".

            ProviderResponseMessage = *PAYER\_ACCOUNT<br />\_RESTRICTED* is returned in the response
        </td>
    </tr>

    <tr>
        <td>
            ERR\_PPREFPre05
        </td>

        <td>
            PAYER\_CANNOT\_PAY
        </td>

        <td>
            1. Specify the [shopping cart](https://developer.kalixa.com/docs/klarna-deposit#shopping-cartbasket-information-order-lines) with all required data

            2. Provide [shipping](https://developer.kalixa.com/docs/klarna-deposit#shipping-address-and-details) information

            3. Create a *PayPal Reference PreAuthorisation* (396) by sending an [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request containing all required data mentioned in the previous steps and a payment account which has an existing *PayPal Billing Agreement*

            In addition includes also a specific payment data *ForcedProviderRespons\_e =\_PAYER\_CANNOT\_PAY* in the initiatePayment request
        </td>

        <td>
            A *Paypal Reference PreAuthorisation* payment is created and is in the state "*ExecuteErrorReportedByProvider*".

            ProviderResponseMessage = *PAYER\_CANNOT\_PAY* is returned in the response
        </td>
    </tr>

    <tr>
        <td>
            ERR\_PPREFPre06
        </td>

        <td>
            BILLING\_AGREEMENT<br />\_NOT\_FOUND
        </td>

        <td>
            1. Specify the [shopping cart](https://developer.kalixa.com/docs/klarna-deposit#shopping-cartbasket-information-order-lines) with all required data

            2. Provide [shipping](https://developer.kalixa.com/docs/klarna-deposit#shipping-address-and-details) information

            3. Create a *PayPal Reference PreAuthorisation* (396) by sending an [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request containing all required data mentioned in the previous steps and a payment account which has an existing *PayPal Billing Agreement*

            In addition includes also a specific payment data *ForcedProviderRespons\_e =\_BILLING\_AGREEMENT<br />\_NOT\_FOUND* in the initiatePayment request
        </td>

        <td>
            A *Paypal Reference PreAuthorisation* payment is created and is in the state "*ExecuteErrorReportedByProvider*".

            ProviderResponseMessage = *BILLING\_AGREEMENT<br />\_NOT\_FOUND* is returned in the response
        </td>
    </tr>

    <tr>
        <td>
            ERR\_PPREFPre07
        </td>

        <td>
            AGREEMENT\_<br />ALREADY\_CANCELLED
        </td>

        <td>
            1. Specify the [shopping cart](https://developer.kalixa.com/docs/klarna-deposit#shopping-cartbasket-information-order-lines) with all required data

            2. Provide [shipping](https://developer.kalixa.com/docs/klarna-deposit#shipping-address-and-details) information

            3. Create a *PayPal Reference PreAuthorisation* (396) by sending an [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request containing all required data mentioned in the previous steps and a payment account which has an existing *PayPal Billing Agreement*

            In addition includes also a specific payment data *ForcedProviderRespons\_e =\_AGREEMENT*<br />ALREADY*CANCELLED* in the initiatePayment request
        </td>

        <td>
            A *Paypal Reference PreAuthorisation* payment is created and is in the state "*ExecuteErrorReportedByProvider*".

            ProviderResponseMessage = *AGREEMENT*<br />ALREADY*CANCELLED* is returned in the response
        </td>
    </tr>

    <tr>
        <td>
            ERR\_PPREFPre08
        </td>

        <td>
            DENIED
        </td>

        <td>
            1. Specify the [shopping cart](https://developer.kalixa.com/docs/klarna-deposit#shopping-cartbasket-information-order-lines) with all required data

            2. Provide [shipping](https://developer.kalixa.com/docs/klarna-deposit#shipping-address-and-details) information

            3. Create a *PayPal Reference PreAuthorisation* (396) by sending an [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request containing all required data mentioned in the previous steps and a payment account which has an existing *PayPal Billing Agreement*

            In addition includes also a specific payment data *ForcedProviderRespons\_e =\_DENIED* in the initiatePayment request
        </td>

        <td>
            A *Paypal Reference PreAuthorisation* payment is created and is in the state "*RefusedByProvider*".

            ProviderResponseMessage = *DENIED* is returned in the response
        </td>
    </tr>
    </tbody>
</Table>

## PayPal Redirect PreAuthorisation (395)

Please refer to the [Paypal V2](https://developer.kalixa.com/docs/paypal-v2#paypal-redirect-preauthorisation-395) page for information how to create an initiatePayment request for a PayPal Reference Deposit (395).

#### <span style={{ color: "DodgerBlue" }}>***SUCCESS*** cases:</span>

<Table align={["left","left","left","left"]}>
    <thead>
    <tr>
        <th>
            \#
        </th>

        <th>
            Test Case Name
        </th>

        <th>
            Steps to Execute
        </th>

        <th>
            Expected Outcome
        </th>
    </tr>
    </thead>

    <tbody>
    <tr>
        <td>
            SUCC\_PPREDPre01
        </td>

        <td>
            SUCCESSFUL *PayPal Redirect PreAuthorisation*
        </td>

        <td>
            1. Specify the [shopping cart](https://developer.kalixa.com/docs/klarna-deposit#shopping-cartbasket-information-order-lines) with all required data

            2. Provide [shipping](https://developer.kalixa.com/docs/klarna-deposit#shipping-address-and-details) information

            3. Create a *PayPal Redirect PreAuthorisation* (395) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request containing all required data mentioned in the previous steps and the following specific payment data in addition:

            * SuccessPageUrl
            * CancelPageUrl

            2. Redirect your customer to PayPal by using the \_RedirectionUrl \_returned in the initiatePayment response

            3\. Customer logs into PayPal page and approves the order
        </td>

        <td>
            1. A *Paypal Redirect PreAuthorisation* payment is created and is in the state "*RedirectURLCreated*".\
            A \_RedirectionUrl \_is returned in the initiatePayment response

            2. Customer is redirected to PayPal Login page and approves the payment.

            3. Merchant sends a *[handleProviderNotificationToMerchantRequest](https://developer.kalixa.com/reference#handleprovidernotificationtomerchant)* containing the data of the payment to PaymentService

            4. PaymentService queries the order details including the payer (Customer) details and related details on PayPal

            5. Automatic authorization will be triggered after successful query

            6\. The *Paypal Redirect PreAuthorisation* payment is in the state "*ExecutedByProvider*".
        </td>
    </tr>
    </tbody>
</Table>

#### <span style={{ color: "DodgerBlue" }}>***PENDING*** cases:</span>

<Table align={["left","left","left","left"]}>
    <thead>
    <tr>
        <th>
            \#
        </th>

        <th>
            Test Case Name
        </th>

        <th>
            Steps to Execute
        </th>

        <th>
            Expected Outcome
        </th>
    </tr>
    </thead>

    <tbody>
    <tr>
        <td>
            PEND\_PPREDPre01
        </td>

        <td>
            PENDING *PayPal Redirect PreAuthorisation*
        </td>

        <td>
            1. Specify the [shopping cart](https://developer.kalixa.com/docs/klarna-deposit#shopping-cartbasket-information-order-lines) with all required data

            2. Provide [shipping](https://developer.kalixa.com/docs/klarna-deposit#shipping-address-and-details) information

            3. Create a *PayPal Redirect PreAuthorisation* (395) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request containing all required data mentioned in the previous steps and the following specific payment data in addition:

            * SuccessPageUrl
            * CancelPageUrl
            * *ForcedProviderRespons\_e =\_PENDING*

            2. Redirect your customer to PayPal by using the \_RedirectionUrl \_returned in the initiatePayment response

            3\. Customer logs into PayPal page and approves the order
        </td>

        <td>
            1. A *Paypal Redirect PreAuthorisation* payment is created and is in the state "*RedirectURLCreated*".\
            A \_RedirectionUrl \_is returned in the initiatePayment response

            2. Customer is redirected to PayPal Login page and approves the payment.

            3. Merchant sends a *[handleProviderNotificationToMerchantRequest](https://developer.kalixa.com/reference#handleprovidernotificationtomerchant)* containing the data of the payment to PaymentService

            4. PaymentService queries the order details including the payer (Customer) details and related details on PayPal

            5. Automatic authorization will be triggered after successful query

            6. The *Paypal Redirect PreAuthorisation* payment is in the state "*PendingOnProvider*".

            ProviderResponseMessage = *PENDING* is returned in the response
        </td>
    </tr>
    </tbody>
</Table>

#### <span style={{ color: "DodgerBlue" }}>***ERROR*** cases:</span>

Error occurs during the "<span style={{ color: "DodgerBlue" }}>*create order*</span>" phase:

<Table align={["left","left","left","left"]}>
    <thead>
    <tr>
        <th>
            \#
        </th>

        <th>
            Test Case Name
        </th>

        <th>
            Steps to Execute
        </th>

        <th>
            Expected Outcome
        </th>
    </tr>
    </thead>

    <tbody>
    <tr>
        <td>
            ERR\_PPREDPre01
        </td>

        <td>
            INVALID\_CURRENCY\_CODE
        </td>

        <td>
            1. Specify the [shopping cart](https://developer.kalixa.com/docs/klarna-deposit#shopping-cartbasket-information-order-lines) with all required data

            2. Provide [shipping](https://developer.kalixa.com/docs/klarna-deposit#shipping-address-and-details) information

            3\. Create a *PayPal Redirect PreAuthorisation* (395) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request containing all required data mentioned in the previous steps and the following specific payment data in addition:

            * SuccessPageUrl
            * CancelPageUrl
            * *ForcedProviderRespons\_e =\_INVALID\_CURRENCY\_CODE*
        </td>

        <td>
            1. A *Paypal Redirect PreAuthorisation* payment is created and is in the state "*InitiateErrorReportedByProvider*".

            ProviderResponseMessage = *INVALID\_CURRENCY\_CODE* is returned in the response
        </td>
    </tr>

    <tr>
        <td>
            ERR\_PPREDPre02
        </td>

        <td>
            INVALID\_COUNTRY\_CODE
        </td>

        <td>
            1. Specify the [shopping cart](https://developer.kalixa.com/docs/klarna-deposit#shopping-cartbasket-information-order-lines) with all required data

            2. Provide [shipping](https://developer.kalixa.com/docs/klarna-deposit#shipping-address-and-details) information

            3\. Create a *PayPal Redirect PreAuthorisation* (395) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request containing all required data mentioned in the previous steps and the following specific payment data in addition:

            * SuccessPageUrl
            * CancelPageUrl
            * *ForcedProviderRespons\_e =\_INVALID\_COUNTRY\_CODE*
        </td>

        <td>
            1. A *Paypal Redirect PreAuthorisation* payment is created and is in the state "*InitiateErrorReportedByProvider*".

            ProviderResponseMessage = *INVALID\_COUNTRY\_CODE* is returned in the response
        </td>
    </tr>
    </tbody>
</Table>

Error occurs during the "<span style={{ color: "DodgerBlue" }}>*authorize order*</span>" phase:

<Table align={["left","left","left","left"]}>
    <thead>
    <tr>
        <th>
            \#
        </th>

        <th>
            Test Case Name
        </th>

        <th>
            Steps to Execute
        </th>

        <th>
            Expected Outcome
        </th>
    </tr>
    </thead>

    <tbody>
    <tr>
        <td>
            ERR\_PPREDPre03
        </td>

        <td>
            PAYER\_ACCOUNT<br />\_LOCKED\_OR\_CLOSED
        </td>

        <td>
            1. Specify the [shopping cart](https://developer.kalixa.com/docs/klarna-deposit#shopping-cartbasket-information-order-lines) with all required data

            2. Provide [shipping](https://developer.kalixa.com/docs/klarna-deposit#shipping-address-and-details) information

            3. Create a *PayPal Redirect PreAuthorisation* (395) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request containing all required data mentioned in the previous steps and the following specific payment data in addition:

            * SuccessPageUrl
            * CancelPageUrl
            * *ForcedProviderRespons\_e =\_PAYER\_ACCOUNT<br />\_LOCKED\_OR\_CLOSED*

            2. Redirect your customer to PayPal by using the \_RedirectionUrl \_returned in the initiatePayment response

            3\. Customer logs into PayPal page and approves the order
        </td>

        <td>
            1. A *Paypal Redirect PreAuthorisation* payment is created and is in the state "*RedirectURLCreated*".\
            A \_RedirectionUrl \_is returned in the initiatePayment response

            2. Customer is redirected to PayPal Login page and approves the payment.

            3. Merchant sends a *[handleProviderNotificationToMerchantRequest](https://developer.kalixa.com/reference#handleprovidernotificationtomerchant)* containing the data of the payment to PaymentService

            4. PaymentService queries the order details including the payer (Customer) details and related details on PayPal

            5. Automatic authorization will be triggered after successful query

            6. The *Paypal Redirect PreAuthorisation* payment is in the state "*ExecuteErrorReportedByProvider*".

            ProviderResponseMessage = *PAYER\_ACCOUNT<br />\_LOCKED\_OR\_CLOSED* is returned in the response
        </td>
    </tr>

    <tr>
        <td>
            ERR\_PPREDPre04
        </td>

        <td>
            PAYER\_ACCOUNT<br />\_RESTRICTED
        </td>

        <td>
            1. Specify the [shopping cart](https://developer.kalixa.com/docs/klarna-deposit#shopping-cartbasket-information-order-lines) with all required data

            2. Provide [shipping](https://developer.kalixa.com/docs/klarna-deposit#shipping-address-and-details) information

            3. Create a *PayPal Redirect PreAuthorisation* (395) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request containing all required data mentioned in the previous steps and the following specific payment data in addition:

            * SuccessPageUrl
            * CancelPageUrl
            * *ForcedProviderRespons\_e =\_PAYER\_ACCOUNT<br />\_RESTRICTED*

            2. Redirect your customer to PayPal by using the \_RedirectionUrl \_returned in the initiatePayment response

            3\. Customer logs into PayPal page and approves the order
        </td>

        <td>
            1. A *Paypal Redirect PreAuthorisation* payment is created and is in the state "*RedirectURLCreated*".\
            A \_RedirectionUrl \_is returned in the initiatePayment response

            2. Customer is redirected to PayPal Login page and approves the payment.

            3. Merchant sends a *[handleProviderNotificationToMerchantRequest](https://developer.kalixa.com/reference#handleprovidernotificationtomerchant)* containing the data of the payment to PaymentService

            4. PaymentService queries the order details including the payer (Customer) details and related details on PayPal

            5. Automatic authorization will be triggered after successful query

            6. The *Paypal Redirect PreAuthorisation* payment is in the state "*ExecuteErrorReportedByProvider*".

            ProviderResponseMessage = *PAYER\_ACCOUNT<br />\_RESTRICTED* is returned in the response
        </td>
    </tr>

    <tr>
        <td>
            ERR\_PPREDPre05
        </td>

        <td>
            PAYER\_CANNOT\_PAY
        </td>

        <td>
            1. Specify the [shopping cart](https://developer.kalixa.com/docs/klarna-deposit#shopping-cartbasket-information-order-lines) with all required data

            2. Provide [shipping](https://developer.kalixa.com/docs/klarna-deposit#shipping-address-and-details) information

            3. Create a *PayPal Redirect PreAuthorisation* (395) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request containing all required data mentioned in the previous steps and the following specific payment data in addition:

            * SuccessPageUrl
            * CancelPageUrl
            * *ForcedProviderRespons\_e =\_PAYER\_CANNOT\_PAY*

            2. Redirect your customer to PayPal by using the \_RedirectionUrl \_returned in the initiatePayment response

            3\. Customer logs into PayPal page and approves the order
        </td>

        <td>
            1. A *Paypal Redirect PreAuthorisation* payment is created and is in the state "*RedirectURLCreated*".\
            A \_RedirectionUrl \_is returned in the initiatePayment response

            2. Customer is redirected to PayPal Login page and approves the payment.

            3. Merchant sends a *[handleProviderNotificationToMerchantRequest](https://developer.kalixa.com/reference#handleprovidernotificationtomerchant)* containing the data of the payment to PaymentService

            4. PaymentService queries the order details including the payer (Customer) details and related details on PayPal

            5. Automatic authorization will be triggered after successful query

            6. The *Paypal Redirect PreAuthorisation* payment is in the state "*ExecuteErrorReportedByProvider*".

            ProviderResponseMessage = *PAYER\_CANNOT\_PAY* is returned in the response
        </td>
    </tr>

    <tr>
        <td>
            ERR\_PPREDPre06
        </td>

        <td>
            DENIED
        </td>

        <td>
            1. Specify the [shopping cart](https://developer.kalixa.com/docs/klarna-deposit#shopping-cartbasket-information-order-lines) with all required data

            2. Provide [shipping](https://developer.kalixa.com/docs/klarna-deposit#shipping-address-and-details) information

            3. Create a *PayPal Redirect PreAuthorisation* (395) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request containing all required data mentioned in the previous steps and the following specific payment data in addition:

            * SuccessPageUrl
            * CancelPageUrl
            * *ForcedProviderRespons\_e =\_DENIED*

            2. Redirect your customer to PayPal by using the \_RedirectionUrl \_returned in the initiatePayment response

            3\. Customer logs into PayPal page and approves the order
        </td>

        <td>
            1. A *Paypal Redirect PreAuthorisation* payment is created and is in the state "*RedirectURLCreated*".\
            A \_RedirectionUrl \_is returned in the initiatePayment response

            2. Customer is redirected to PayPal Login page and approves the payment.

            3. Merchant sends a *[handleProviderNotificationToMerchantRequest](https://developer.kalixa.com/reference#handleprovidernotificationtomerchant)* containing the data of the payment to PaymentService

            4. PaymentService queries the order details including the payer (Customer) details and related details on PayPal

            5. Automatic authorization will be triggered after successful query

            6. The *Paypal Redirect PreAuthorisation* payment is in the state "*RefusedByProvider*".

            ProviderResponseMessage = *DENIED* is returned in the response
        </td>
    </tr>
    </tbody>
</Table>

## PayPal Capture (410)

Please refer to the [Paypal V2](https://developer.kalixa.com/docs/paypal-v2#paypal-capture-410) page for information how to create an initiatePayment request for a PayPal Capture (410).

#### <span style={{ color: "DodgerBlue" }}>***SUCCESS*** cases:</span>

#### **PayPal Capture*WITH* automatic capturing:**

> 📘
>
> *Pre-condition: Automatic capturing is enabled for the merchant*

<Table align={["left","left","left","left"]}>
    <thead>
    <tr>
        <th>
            \#
        </th>

        <th>
            Test Case Name
        </th>

        <th>
            Steps to Execute
        </th>

        <th>
            Expected Outcome
        </th>
    </tr>
    </thead>

    <tbody>
    <tr>
        <td>
            SUCC\_PPCAP01
        </td>

        <td>
            SUCCESSFUL *PayPal Capture*
        </td>

        <td>
            * \*Precondition\*\*:

            1. A \[successful

            * PayPal Redirect PreAuthorisatio&#x6E;*]\([https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-3](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-3)) or a [successful *PayPal Reference PreAuthorisation*] \([https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-2](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-2)) is created and is in the state "\_ExecutedByProvider*".

            2. Create a PayPal Capture (410) by sending an [*initiatePaymentFromReference*](https://developer.kalixa.com/reference#initiatepaymentfromreference) request with\
            the following specific payment data in addition:

            \- PaymentDescription (optional)

            * UserStatementText (optional)
        </td>

        <td>
            A *Paypal Capture* payment is created and is in the state "*CapturedByProvider*".
        </td>
    </tr>
    </tbody>
</Table>

#### <span style={{ color: "DodgerBlue" }}>***PENDING*** cases:</span>

<Table align={["left","left","left","left"]}>
    <thead>
    <tr>
        <th>
            \#
        </th>

        <th>
            Test Case Name
        </th>

        <th>
            Steps to Execute
        </th>

        <th>
            Expected Outcome
        </th>
    </tr>
    </thead>

    <tbody>
    <tr>
        <td>
            PEND\_PPCAP01
        </td>

        <td>
            PENDING *PayPal Capture*
        </td>

        <td>
            Precondition:

            1. A \[successful

            * PayPal Redirect PreAuthorisatio&#x6E;*]\([https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-3](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-3)) or a [successful *PayPal Reference PreAuthorisation*] \([https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-2](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-2)) is created and is in the state "\_ExecutedByProvider*".

            2. Create a PayPal Capture (410) by sending an [*initiatePaymentFromReference*](https://developer.kalixa.com/reference#initiatepaymentfromreference) request with\
            the following specific payment data in addition:

            \- *ForcedProviderRespons\_e =\_PENDING*

            * PaymentDescription (optional)
            * UserStatementText (optional)
        </td>

        <td>
            A *Paypal Capture* payment is created and is in the state "*PendingOnProvider*".

            ProviderResponseMessage = *PENDING* is returned in the response
        </td>
    </tr>
    </tbody>
</Table>

#### <span style={{ color: "DodgerBlue" }}>***ERROR*** cases:</span>

<Table align={["left","left","left","left"]}>
    <thead>
    <tr>
        <th>
            \#
        </th>

        <th>
            Test Case Name
        </th>

        <th>
            Steps to Execute
        </th>

        <th>
            Expected Outcome
        </th>
    </tr>
    </thead>

    <tbody>
    <tr>
        <td>
            ERR\_PPCAP01
        </td>

        <td>
            PAYER\_ACCOUNT<br />\_LOCKED\_OR\_CLOSED
        </td>

        <td>
            * \*Precondition\*\*:

            1. A \[successful

            * PayPal Redirect PreAuthorisatio&#x6E;*]\([https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-3](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-3)) or a [successful *PayPal Reference PreAuthorisation*] \([https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-2](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-2)) is created and is in the state "\_ExecutedByProvider*".

            2. Create a PayPal Capture (410) by sending an [*initiatePaymentFromReference*](https://developer.kalixa.com/reference#initiatepaymentfromreference) request with\
            the following specific payment data in addition:

            \- *ForcedProviderRespons\_e =\_PAYER\_ACCOUNT<br />\_LOCKED\_OR\_CLOSED*

            * PaymentDescription (optional)
            * UserStatementText (optional)
        </td>

        <td>
            A *Paypal Capture* payment is created and is in the state "*CaptureErrorReportedByProvider*".

            ProviderResponseMessage = *PAYER\_ACCOUNT<br />\_LOCKED\_OR\_CLOSED* is returned in the response
        </td>
    </tr>

    <tr>
        <td>
            ERR\_PPCAP02
        </td>

        <td>
            PAYER\_CANNOT\_PAY
        </td>

        <td>
            * \*Precondition\*\*:

            1. A \[successful

            * PayPal Redirect PreAuthorisatio&#x6E;*]\([https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-3](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-3)) or a [successful *PayPal Reference PreAuthorisation*] \([https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-2](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-2)) is created and is in the state "\_ExecutedByProvider*".

            2. Create a PayPal Capture (410) by sending an [*initiatePaymentFromReference*](https://developer.kalixa.com/reference#initiatepaymentfromreference) request with\
            the following specific payment data in addition:

            \- *ForcedProviderRespons\_e =\_PAYER\_CANNOT\_PAY*

            * PaymentDescription (optional)
            * UserStatementText (optional)
        </td>

        <td>
            A *Paypal Capture* payment is created and is in the state "*CaptureErrorReportedByProvider*".

            ProviderResponseMessage = *PAYER\_CANNOT\_PAY* is returned in the response
        </td>
    </tr>

    <tr>
        <td>
            ERR\_PPCAP03
        </td>

        <td>
            TRANSACTION\_REFUSED
        </td>

        <td>
            * \*Precondition\*\*:

            1. A \[successful

            * PayPal Redirect PreAuthorisatio&#x6E;*]\([https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-3](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-3)) or a [successful *PayPal Reference PreAuthorisation*] \([https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-2](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-2)) is created and is in the state "\_ExecutedByProvider*".

            2. Create a PayPal Capture (410) by sending an [*initiatePaymentFromReference*](https://developer.kalixa.com/reference#initiatepaymentfromreference) request with\
            the following specific payment data in addition:

            \- *ForcedProviderRespons\_e =\_TRANSACTION\_REFUSED*

            * PaymentDescription (optional)
            * UserStatementText (optional)
        </td>

        <td>
            A *Paypal Capture* payment is created and is in the state "*CaptureRefused*".

            ProviderResponseMessage = *TRANSACTION\_REFUSED* is returned in the response
        </td>
    </tr>
    </tbody>
</Table>

## PayPal Refund (400)

Detailed information for integrating **Paypal Refunds** (400) can be found in the [Refund a PayPal Payment](doc:refund-a-paypal-payment) documentation.

* A PayPal Refund can be created from a [PayPal Reference/Redirect Deposit] \(#Refund\_ReferenceRedirectDeposit)

* A PayPal Refund can be created from a [PayPal Capture] \(#Refund\_PayPalCapture)

* A PayPal Refund can be created from a [PayPal Reference/Redirect Preauthorisation](#Refund_ReferenceRedirectPreauthorisation)

<a id="Refund_ReferenceRedirectDeposit"></a><span style= {{ color: "LimeGreen" }}>**Refund created from a PayPal Reference/Redirect Deposit**</span>

#### <span style={{ color: "DodgerBlue" }}>***SUCCESS*** cases:</span>

<Table align={["left","left","left","left"]}>
    <thead>
    <tr>
        <th>
            \#
        </th>

        <th>
            Test Case Name
        </th>

        <th>
            Steps to Execute
        </th>

        <th>
            Expected Outcome
        </th>
    </tr>
    </thead>

    <tbody>
    <tr>
        <td>
            SUCC\_PPR01
        </td>

        <td>
            SUCCESSFUL *PayPal Refund*\
            (Full refund)
        </td>

        <td>
            1. Create a [successful](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan) *PayPal Reference Deposit* (393) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with the following data:

            * Amount = 15.00
            * Currency = EUR

            2\. Create a *PayPal Refund* (400) by sending a [\_initiatePaymentFromRefe\_rence](https://developer.kalixa.com/reference#initiatepaymentfromreference) request with the following data:

            * Amount = 15.00
            * Currency = EUR
            * OriginalPaymentID = UniqueID of the payment created in step 1
        </td>

        <td>
            A *Paypal Refund* payment is created and is in the state "*Refunded*".
        </td>
    </tr>

    <tr>
        <td>
            SUCC\_PPR02
        </td>

        <td>
            SUCCESSFUL *PayPal Refund*\
            (Partial refund)
        </td>

        <td>
            1. Create a [successful](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan) *PayPal Reference Deposit* (393) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with the following data:

            * Amount = 15.00
            * Currency = EUR

            2. Create a ***successful*** *PayPal Refund* (400) by sending a [\_initiatePaymentFromRefe\_rence](https://developer.kalixa.com/reference#initiatepaymentfromreference) request with the following data:

            * Amount = 11.50
            * Currency = EUR
            * OriginalPaymentID = UniqueID of the payment created in step 1

            3\. Create a *PayPal Refund* (400) by sending a [\_initiatePaymentFromRefe\_rence](https://developer.kalixa.com/reference#initiatepaymentfromreference) request with the following data:

            * Amount = 3.50
            * Currency = EUR
            * OriginalPaymentID = UniqueID of the payment created in step 1
        </td>

        <td>
            A *Paypal Refund* payment is created and is in the state "*Refunded*".
        </td>
    </tr>
    </tbody>
</Table>

#### <span style={{ color: "DodgerBlue" }}>***PENDING*** cases:</span>

<Table align={["left","left","left","left"]}>
    <thead>
    <tr>
        <th>
            \#
        </th>

        <th>
            Test Case Name
        </th>

        <th>
            Steps to Execute
        </th>

        <th>
            Expected Outcome
        </th>
    </tr>
    </thead>

    <tbody>
    <tr>
        <td>
            PEND\_PPR01
        </td>

        <td>
            PENDING *PayPal Refund*
        </td>

        <td>
            1. Create a [successful](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan) *PayPal Reference Deposit* (393) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with the following data:

            * Amount = 15.00
            * Currency = EUR

            2\. Create a *PayPal Refund* (400) by sending a [\_initiatePaymentFromRefe\_rence](https://developer.kalixa.com/reference#initiatepaymentfromreference) request with the following data:

            * Amount = 15.00
            * Currency = EUR
            * OriginalPaymentID = UniqueID of the payment created in step 1
            * ForcedProviderRespons =  *PENDING*
        </td>

        <td>
            A *Paypal Refund* payment is created and is in the state "*PendingOnProvider*".
        </td>
    </tr>
    </tbody>
</Table>

#### <span style={{ color: "DodgerBlue" }}>***ERROR*** cases:</span>

<Table align={["left","left","left","left"]}>
    <thead>
    <tr>
        <th>
            \#
        </th>

        <th>
            Test Case Name
        </th>

        <th>
            Steps to Execute
        </th>

        <th>
            Expected Outcome
        </th>
    </tr>
    </thead>

    <tbody>
    <tr>
        <td>
            ERR\_PPR01
        </td>

        <td>
            UNSUCCESSFUL *PayPal Refund* <br /> if original payment is not in successfully captured state
        </td>

        <td>
            1. Create a [unsuccessful](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerblueerror-casesspan) *PayPal Reference Deposit* (393) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with the following data:

            * Amount = 15.00
            * Currency = EUR
            * ForcedProviderRespons = *BILLING\_AGREEMENT\_NOT\_FOUND*\
            (Payment is in the state \_DepositErrorReportedByP\_rovider)\


            2\. Create a *PayPal Refund* (400) by sending a [\_initiatePaymentFromRefe\_rence](https://developer.kalixa.com/reference#initiatepaymentfromreference) request with the following data:

            * Amount = 15.00
            * Currency = EUR
            * OriginalPaymentID = UniqueID of the payment created in step 1
        </td>

        <td>
            No *Paypal Refund* payment is created

            The following error is returned:\
            ErrorCode = 1002\
            ErrorMessage = "Refund amount exceeded! Deposit amount = 0.0000; Refunded amount = 0; Max refundable amount = 0;Refund amount = 15.00"

            .
        </td>
    </tr>

    <tr>
        <td>
            ERR\_PPR02
        </td>

        <td>
            UNSUCCESSFUL *PayPal Refund* <br /> if refund amount exceeded\
            (Full refund)
        </td>

        <td>
            1. Create a [successful](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan) *PayPal Reference Deposit* (393) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with the following data:

            * Amount = 15.00
            * Currency = EUR

            2\. Create a *PayPal Refund* (400) by sending a [\_initiatePaymentFromRefe\_rence](https://developer.kalixa.com/reference#initiatepaymentfromreference) request with the following data:

            * Amount = 15.01
            * Currency = EUR
            * OriginalPaymentID = UniqueID of the payment created in step 1
        </td>

        <td>
            No *Paypal Refund* payment is created

            The following error is returned:\
            The following error is returned:\
            ErrorCode = 1002\
            ErrorMessage = "Refund amount exceeded! Deposit amount = 15.0000; Refunded amount = 0; Max refundable amount = 0;Refund amount = 15.01"
        </td>
    </tr>

    <tr>
        <td>
            ERR\_PPR03
        </td>

        <td>
            UNSUCCESSFUL *PayPal Refund* <br /> if refund amount exceeded\
            (Partial refund)
        </td>

        <td>
            1. Create a [successful](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan) *PayPal Reference Deposit* (393) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with the following data:

            * Amount = 15.00
            * Currency = EUR

            2. Create a ***successful*** *PayPal Refund* (400) by sending a [\_initiatePaymentFromRefe\_rence](https://developer.kalixa.com/reference#initiatepaymentfromreference) request with the following data:

            * Amount = 11.00
            * Currency = EUR
            * OriginalPaymentID = UniqueID of the payment created in step 1

            2\. Create a *PayPal Refund* (400) by sending a [\_initiatePaymentFromRefe\_rence](https://developer.kalixa.com/reference#initiatepaymentfromreference) request with the following data:

            * Amount = 5.00
            * Currency = EUR
            * OriginalPaymentID = UniqueID of the payment created in step 1
        </td>

        <td>
            No *Paypal Refund* payment is created

            The following error is returned:\
            ErrorCode = 1002\
            ErrorMessage = "Refund amount exceeded! Deposit amount = 15.0000; Refunded amount = 11.0000; Max refundable amount = 4.0000;Refund amount = 5.00"
        </td>
    </tr>

    <tr>
        <td>
            ERR\_PPR04
        </td>

        <td>
            UNSUCCESSFUL *PayPal Refund* <br /> if refund currency does not matched
        </td>

        <td>
            1. Create a [successful](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan) *PayPal Reference Deposit* (393) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with the following data:

            * Amount = 15.00
            * Currency = EUR

            2\. Create a *PayPal Refund* (400) by sending a [\_initiatePaymentFromRefe\_rence](https://developer.kalixa.com/reference#initiatepaymentfromreference) request with the following data:

            * Amount = 5.00
            * Currency = GBP
            * OriginalPaymentID = UniqueID of the payment created in step 1
        </td>

        <td>
            No *Paypal Refund* payment is created

            The following error is returned:\
            ErrorCode = 309\
            ErrorMessage = "Currencies do not match! Currency of amount = EUR, but expected currency = GBP"
        </td>
    </tr>

    <tr>
        <td>
            ERR\_PPR05
        </td>

        <td>
            INTERNAL\_SERVER\_ERROR
        </td>

        <td>
            1. Create a [successful](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan) *PayPal Reference Deposit* (393) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with the following data:

            * Amount = 15.00
            * Currency = EUR

            2\. Create a *PayPal Refund* (400) by sending a [\_initiatePaymentFromRefe\_rence](https://developer.kalixa.com/reference#initiatepaymentfromreference) request with the following data:

            * Amount = 15.00
            * Currency = EUR
            * OriginalPaymentID = UniqueID of the payment created in step 1
            * ForcedProviderResponse = *INTERNAL\_SERVER\_ERROR*
        </td>

        <td>
            A *Paypal Refund* payment is created and is in the state "*RefundRefusedByProvider*".
        </td>
    </tr>

    <tr>
        <td>
            ERR\_PPR06
        </td>

        <td>
            INVALID\_RESOURCE\_ID
        </td>

        <td>
            1. Create a [successful](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan) *PayPal Reference Deposit* (393) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request with the following data:

            * Amount = 15.00
            * Currency = EUR

            2\. Create a *PayPal Refund* (400) by sending a [\_initiatePaymentFromRefe\_rence](https://developer.kalixa.com/reference#initiatepaymentfromreference) request with the following data:

            * Amount = 15.00
            * Currency = EUR
            * OriginalPaymentID = UniqueID of the payment created in step 1
            * ForcedProviderResponse = *INVALID\_RESOURCE\_ID*
        </td>

        <td>
            A *Paypal Refund* payment is created and is in the state "*RefundRefusedByProvider*".
        </td>
    </tr>
    </tbody>
</Table>

<a id="Refund_PayPalCapture"></a><span style= {{ color: "LimeGreen" }}>**Refund created from a PayPal Capture**</span>

#### <span style={{ color: "DodgerBlue" }}>***SUCCESS*** cases:</span>

#### <span style={{ color: "DodgerBlue" }}>***PENDING*** cases:</span>

#### <span style={{ color: "DodgerBlue" }}>***ERROR*** cases:</span>

<a id="Refund_ReferenceRedirectPreauthorisation"></a><span style= {{ color: "LimeGreen" }}>**Refund created from a PayPal Reference/Redirect Preauthorisation (bulk refund)**</span>

#### <span style={{ color: "DodgerBlue" }}>***SUCCESS*** cases:</span>

#### <span style={{ color: "DodgerBlue" }}>***PENDING*** cases:</span>

#### <span style={{ color: "DodgerBlue" }}>***ERROR*** cases:</span>

## PayPal Cancellation (429)

Please refer to the related [Paypal V2](https://developer.kalixa.com/docs/cancelrevert-a-paypal-payment#how-to-cancelrevert-or-release-the-remaining-amount-for-a-paypal-payment) page for information how to cancel a PayPal Reference Preauthorisation (396) or a PayPal  Redirect Preauthorisation (395).

#### <span style={{ color: "DodgerBlue" }}>***SUCCESS*** cases:</span>

<Table align={["left","left","left","left"]}>
    <thead>
    <tr>
        <th>
            \#
        </th>

        <th>
            Test Case Name
        </th>

        <th>
            Steps to Execute
        </th>

        <th>
            Expected Outcome
        </th>
    </tr>
    </thead>

    <tbody>
    <tr>
        <td>
            SUCC\_PPC01
        </td>

        <td>
            SUCCESSFUL full ***PayPal Cancellation*** of a PayPal Preauthorisation
        </td>

        <td>
            1. Create a [*successful PayPal Reference Preauthorisation*](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-2) (396) or [*PayPal Redirect Preauthorisation*](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-3) (395) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request or a [*getRedirectData*](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-3) request  with the following data:

            * Amount = 50.00
            * Currency = EUR

            The Preauthorisation payment should be in the state "**ExecutedByProvider**"

            2\. Create a *PayPal Cancellation* (429) by sending the [executePaymentAction](https://developer.kalixa.com/reference/executepaymentaction) request with the actionID = 1 (Cancel)
        </td>

        <td>
            A *Paypal Cancellation* payment with an amount of 50 EUR is created and is in the state "*Cancelled*".
        </td>
    </tr>

    <tr>
        <td>
            SUCC\_PPC02
        </td>

        <td>
            SUCCESSFUL partial ***PayPal Cancellation*** of a PayPal Preauthorisation which has a partial successful PayPal Capture payment
        </td>

        <td>
            1. Create a [*successful PayPal Reference Preauthorisation*](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-2) (396) or [*PayPal Redirect Preauthorisation*](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-3) (395) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request or a [*getRedirectData*](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-3) request  with the following data:

            * Amount = 50.00
            * Currency = EUR

            The Preauthorisation payment should be in the state "**ExecutedByProvider**"

            2. Create a [successful PayPal Capture](https://developer.kalixa.com/docs/paypal-test-cases#paypal-capture-410) by sending a [*initiatePaymentFromReferenceRequest*](https://developer.kalixa.com/reference/initiatepaymentfromreference) request with the following data:

            * Amount = 30.00
            * Currency = EUR

            The Capture payment should be in the state "**CapturedByProvider**"

            3\. Create a *PayPal Cancellation* (429) by sending the [executePaymentAction](https://developer.kalixa.com/reference/executepaymentaction) request with the actionID = 1 (Cancel)
        </td>

        <td>
            A *Paypal Cancellation* payment with an amount of 20 EUR is created and is in the state "*Cancelled*".
        </td>
    </tr>

    <tr>
        <td>
            SUCC\_PPC03
        </td>

        <td>
            SUCCESSFUL full ***PayPal Cancellation*** of a PayPal Preauthorisation which has a partial unsuccessful PayPal Capture payment
        </td>

        <td>
            1. Create a [*successful PayPal Reference Preauthorisation*](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-2) (396) or [*PayPal Redirect Preauthorisation*](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-3) (395) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request or a [*getRedirectData*](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-3) request  with the following data:

            * Amount = 50.00
            * Currency = EUR

            2. Create an [unsuccessful PayPal Capture](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerblueerror-casesspan-4) by sending a [*initiatePaymentFromReferenceRequest*](https://developer.kalixa.com/reference/initiatepaymentfromreference) request with the following data:

            * Amount = 30.00
            * Currency = EUR

            The Capture payment is in one of the following states:

            * * CaptureRefused
            * * CaptureErrorReportedByProvider
            * * CaptureCommunicationErrorOccurred

            3\. Create a \_PayPal Cancellation\* (429) by sending the [executePaymentAction](https://developer.kalixa.com/reference/executepaymentaction) request with the actionID = 1 (Cancel)
        </td>

        <td>
            A *Paypal Cancellation* payment with an amount of 50 EUR is created and is in the state "*Cancelled*".
        </td>
    </tr>
    </tbody>
</Table>

#### <span style={{ color: "DodgerBlue" }}>***ERROR*** cases:</span>

<Table align={["left","left","left","left"]}>
    <thead>
    <tr>
        <th>
            \#
        </th>

        <th>
            Test Case Name
        </th>

        <th>
            Steps to Execute
        </th>

        <th>
            Expected Outcome
        </th>
    </tr>
    </thead>

    <tbody>
    <tr>
        <td>
            ERR\_PPC01
        </td>

        <td>
            UNSUCCESSFUL ***PayPal Cancellation*** <br /> if original payment is not in successfully executed state
        </td>

        <td>
            1. Create an [*unsuccessful PayPal Reference Preauthorisation*](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerblueerror-casesspan-2) (396) or [*PayPal Redirect Preauthorisation*](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerblueerror-casesspan-3) (395) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request or a [*getRedirectData*](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-3) request  with the following data:

            * Amount = 50.00
            * Currency = EUR

            The Preauthorization payment could be in one of the following states:

            * * RedirectURLCreated
            * * InitiateRequestProvider<br />CommunicationErrorOccurred
            * * InitiateErrorReportedByProvider
            * * ExecuteErrorReportedByProvider
            * * ExecuteRequestSentToProvider<br />CommunicationErrorOccure
                * * RefusedByProvider
                * * TokenExpired
                * * PendingOnProvider

                2\. Create a *PayPal Cancellation* (429) by sending the [executePaymentAction](https://developer.kalixa.com/reference/executepaymentaction) request with the actionID = 1 (Cancel)
        </td>

        <td>
            A *Paypal Cancellation* payment is not created.\
            An error code 700 with a error message "*The action is not allowed for the payment.*" is returned in the "*cancel*" action response.
        </td>
    </tr>

    <tr>
        <td>
            ERR\_PPC02
        </td>

        <td>
            CANNOT\_BE\_VOIDED
        </td>

        <td>
            1. Create a [*successful PayPal Reference Preauthorisation*](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-2) (396) or [*PayPal Redirect Preauthorisation*](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-3) (395) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request or a [*getRedirectData*](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-3) request  with the following data:

            * Amount = 50.00
            * Currency = EUR

            2. Create a *PayPal Cancellation* (429) by sending the [executePaymentAction](https://developer.kalixa.com/reference/executepaymentaction) request with the actionID = 1 (Cancel) with the following additional data:

            \- ForcedProviderResponse = *CANNOT\_BE\_VOIDED*
        </td>

        <td>
            A *Paypal Cancellation* payment with an amount of 50 EUR is created and is in the state "*CancelRefusedByProvider*".
        </td>
    </tr>

    <tr>
        <td>
            ERR\_PPC03
        </td>

        <td>
            PREVIOUSLY\_CAPTURED
        </td>

        <td>
            1. Create a [*successful PayPal Reference Preauthorisation*](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-2) (396) or [*PayPal Redirect Preauthorisation*](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-3) (395) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request or a [*getRedirectData*](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-3) request  with the following data:

            * Amount = 50.00
            * Currency = EUR

            2. Create a *PayPal Cancellation* (429) by sending the [executePaymentAction](https://developer.kalixa.com/reference/executepaymentaction) request with the actionID = 1 (Cancel) with the following additional data:

            \- ForcedProviderResponse = *PREVIOUSLY\_CAPTURED*
        </td>

        <td>
            A *Paypal Cancellation* payment with an amount of 50 EUR is created and is in the state "*CancelRefusedByProvider*".
        </td>
    </tr>

    <tr>
        <td>
            ERR\_PPC04
        </td>

        <td>
            PREVIOUSLY\_VOIDED
        </td>

        <td>
            1. Create a [*successful PayPal Reference Preauthorisation*](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-2) (396) or [*PayPal Redirect Preauthorisation*](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-3) (395) by sending a [*initiatePayment*](https://developer.kalixa.com/reference#initiatepayment) request or a [*getRedirectData*](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-3) request  with the following data:

            * Amount = 50.00
            * Currency = EUR

            2. Create a *PayPal Cancellation* (429) by sending the [executePaymentAction](https://developer.kalixa.com/reference/executepaymentaction) request with the actionID = 1 (Cancel) with the following additional data:

            \- ForcedProviderResponse = *PREVIOUSLY\_VOIDED*
        </td>

        <td>
            A *Paypal Cancellation* payment with an amount of 50 EUR is created and is in the state "*CancelRefusedByProvider*".
        </td>
    </tr>
    </tbody>
</Table>

The following scenarios need to be covered by the merchant but cannot be tested against the PXP test system.

<Table align={["left","left","left"]}>
    <thead>
    <tr>
        <th>
            \#
        </th>

        <th>
            Test Case Name
        </th>

        <th>
            Expected Outcome
        </th>
    </tr>
    </thead>

    <tbody>
    <tr>
        <td>
            ERR\_PPC02
        </td>

        <td>
            UNSUCCESSFUL ***PayPal Cancellation*** <br /> if provider refuses the cancellation request (e.g.\
            CANNOT\_BE\_VOIDED, PREVIOUSLY\_CAPTURED, PREVIOUSLY\_VOIDED)
        </td>

        <td>
            A *Paypal Cancellation* payment  is created and is in the state "*CancelRefusedByProvider*".
        </td>
    </tr>
    </tbody>
</Table>

### PayPal Cancellation via Payment Service Admin

#### <span style={{ color: "DodgerBlue" }}>***SUCCESS*** cases:</span>

<Table align={["left","left","left","left"]}>
    <thead>
    <tr>
        <th>
            \#
        </th>

        <th>
            Test Case Name
        </th>

        <th>
            Steps to Execute
        </th>

        <th>
            Expected Outcome
        </th>
    </tr>
    </thead>

    <tbody>
    <tr>
        <td>
            SUCC\_PSA\_PPC01
        </td>

        <td>
            SUCCESSFUL full ***PayPal Cancellation*** of a PayPal Preauthorisation
        </td>

        <td>
            1. Open the payment details page of a \[successful

            * PayPal Redirect PreAuthorisatio&#x6E;*]\([https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-3](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-3)) or a [successful *PayPal Reference PreAuthorisation*] \([https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-2](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-2)) which has an amount of 50 EUR and is in the state "\_ExecutedByProvider*".

            2\. Execute the action "CancelPayment" within the Preauthorisation payment
        </td>

        <td>
            A *Paypal Cancellation* payment with an amount of 50 EUR is created and is in the state "*Cancelled*".
        </td>
    </tr>

    <tr>
        <td>
            SUCC\_PSA\_PPC2
        </td>

        <td>
            SUCCESSFUL partial ***PayPal Cancellation*** of a PayPal Preauthorisation which has a successful partial PayPal Capture
        </td>

        <td>
            1. Open the payment details page of a \[successful

            * PayPal Redirect PreAuthorisatio&#x6E;*]\([https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-3](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-3)) or a [successful *PayPal Reference PreAuthorisation*] \([https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-2](https://developer.kalixa.com/docs/paypal-test-cases#span-stylecolordodgerbluesuccess-casesspan-2)) which has an amount of 50 EUR and is in the state "\_ExecutedByProvider*".\
            And this PayPal Preauthorisation payment has a PayPal Capture payment with an amount of 30 EUR and is in state "*CapturedByProvider*"

            2\. Execute the action "CancelPayment" within the Preauthorisation payment
        </td>

        <td>
            A *Paypal Cancellation* payment with an amount of 20 EUR is created and is in the state "*Cancelled*".
        </td>
    </tr>
    </tbody>
</Table>

#### <span style={{ color: "DodgerBlue" }}>***ERROR*** cases:</span>

The "*CancelPayment*" action is only available within the "*successfully executed*" Preauthorisation payment, for this reason error cases mentioned above is not applicable for PayPal Cancellation via PS Admin.

"CancelPayment" action within the Preauthorisation payment:

<Image align="center" width="80%" src="https://files.readme.io/b6c4dbc-Untitled.jpg" />

# Negative Testing against Provider PayPal

Instead of testing against the PXP Financial MOCK using the above described test scenarios, it is also possible to test against the provider system directly.

> 📘
>
> This requires activation, please contact support...

To force a certain provider response, the following API field has to be provided:

<Table align={["left","left"]}>
    <thead>
    <tr>
        <th>
            Field
        </th>

        <th>
            Value
        </th>
    </tr>
    </thead>

    <tbody>
    <tr>
        <td>
            **ForcedProviderResponse**
        </td>

        <td>
            For ***PayPal Reference Deposit***: see the [related PayPal API documentation](https://developer.paypal.com/docs/api/orders/v2/#errors) or [tables](https://developer.kalixa.com/docs/paypal-test-cases#list-of-reproducible-error-codes-paypal-reference-deposit) below\
            For ***PayPal Refund***:  see the [related PayPal API documentation](https://developer.paypal.com/docs/api/payments/v2/#errors) or [tables](https://developer.kalixa.com/docs/paypal-test-cases#list-of-reproducible-error-codes-paypal-refund) below
        </td>
    </tr>
    </tbody>
</Table>

PayPal will respond with the same error code as sent in the field "*ForcedProviderResponse*"

A sample InitiatePayment request with the field "*ForcedProviderResponse*":

```xml
<initiatePaymentRequest xmlns="http://www.cqrpayments.com/PaymentProcessing" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <merchantID>{{merchant}}</merchantID>
    <shopID>{{shop}}</shopID>
    <merchantTransactionID>{{merchantTransactionID}}</merchantTransactionID>
    <paymentMethodID>393</paymentMethodID>
    <amount currencyCode="eur">200</amount>
    <userID>45cd3c7f-f5fb-4d44-b4bc-8b17da</userID>
    <userIP>80.121.151.158</userIP>
    <userSessionID>t02d03hwaxkrl5gmabcypwmm</userSessionID>
    <creationTypeID>1</creationTypeID>
    <specificPaymentData>
        <data xsi:type="keyStringValuePair">
            <key>PaymentDescription</key>
            <value><![CDATA[My PayPal & äüöáè payment description!]]></value>
        </data>
        <data xsi:type="keyStringValuePair">
            <key>PaymentCountryCode</key>
            <value>AT</value>
        </data>
        <data xsi:type="keyStringValuePair">
            <key>CultureInfo</key>
            <value>en-AT</value>
        </data>
        <data xsi:type="keyStringValuePair">
            <key>BrandName</key>
            <value><![CDATA[My Brand & äüöáè]]></value>
        </data>
        <data xsi:type="keyStringValuePair">
            <key>UserStatementText</key>
            <value><![CDATA[My SoftDiscriptoräüöáè]]></value>
        </data>
        <data xsi:type="keyStringValuePair">
            <key>ForcedProviderResponse</key>
            <value>INTERNAL_SERVER_ERROR</value>
        </data>
    </specificPaymentData>
    <paymentAccountID>2e6a7953-d7e7-4345-82e9-8539ece1409e</paymentAccountID>
</initiatePaymentRequest>
```

### List of reproducible errors (*PayPal Reference Deposit*)

Error occurs during the "<span style={{ color: "DodgerBlue" }}>*create order*</span>" phase:

| Value for the "ForcedProviderResponse" field | Description                                             | Expected payment state         |
| :------------------------------------------- | :------------------------------------------------------ | :----------------------------- |
| INTERNAL\_SERVER\_ERROR                      | An internal server error has occurred.                  | ExecuteErrorReportedByProvider |
| INVALID\_COUNTRY\_CODE                       | Country code is invalid.                                | ExecuteErrorReportedByProvider |
| INVALID\_CURRENCY\_CODE                      | Currency code is invalid or is not currently supported. | ExecuteErrorReportedByProvider |

Error occurs during the "<span style={{ color: "DodgerBlue" }}>*capture payment for order*</span>" phase:

| Value for the<br /> "ForcedProviderResponse" field | Description                                                                                         | Expected payment state         |
| :----------------------------------------------- | :-------------------------------------------------------------------------------------------------- | :----------------------------- |
| AGREEMENT\_ALREADY\_CANCELLED                    | The requested agreement is already cancelled.                                                       | DepositErrorReportedByProvider |
| BILLING\_AGREEMENT\_NOT\_FOUND                   | The requested Billing Agreement token was not found.                                                | DepositErrorReportedByProvider |
| COMPLIANCE\_VIOLATION                            | Transaction cannot be processed due to a possible compliance violation.                             | DepositErrorReportedByProvider |
| INSTRUMENT\_DECLINED                             | The funding instrument presented was either declined by the processor or bank.                      | RefusedByProvider              |
| INVALID\_RESOURCE\_ID                            | Specified resource ID does not exist.                                                               | DepositErrorReportedByProvider |
| PAYEE\_BLOCKED\_TRANSACTION                      | The fraud settings for this seller are such that this payment cannot be executed.                   | RefusedByProvider              |
| PAYER\_ACCOUNT\_LOCKED\_OR\_CLOSED               | Payer account is locked or closed.                                                                  | DepositErrorReportedByProvider |
| PAYER\_ACCOUNT\_RESTRICTED                       | Payer account is restricted.                                                                        | DepositErrorReportedByProvider |
| PAYER\_CANNOT\_PAY                               | Payer cannot pay for this transaction.                                                              | DepositErrorReportedByProvider |
| TRANSACTION\_BLOCKED\_BY\_PAYEE                  | The requested action could not be performed, semantically incorrect, or failed business validation. | RefusedByProvider              |
| TRANSACTION\_LIMIT\_EXCEEDED                     | Total payment amount exceeded transaction limit.                                                    | RefusedByProvider              |
| TRANSACTION\_REFUSED                             | The transaction was refused.                                                                        | RefusedByProvider              |

### List of reproducible errors (*PayPal Refund*)

| Value for the "ForcedProviderResponse" field | Description                                                                       | Expected payment state  |
| :------------------------------------------- | :-------------------------------------------------------------------------------- | :---------------------- |
| INTERNAL\_SERVER\_ERROR                      | An internal server error has occurred.                                            | RefundRefusedByProvider |
| INVALID\_RESOURCE\_ID                        | Specified resource ID does not exist. Please check the resource ID and try again. | RefundRefusedByProvider |

### List of reproducible errors (*PayPal Cancellation*)

| Value for the "ForcedProviderResponse" field | Description                                                                        | Expected payment state  |
| :------------------------------------------- | :--------------------------------------------------------------------------------- | :---------------------- |
| CANNOT\_BE\_VOIDED                           | A reauthorization cannot be voided. Please void the original parent authorization. | CancelRefusedByProvider |
| PREVIOUSLY\_CAPTURED                         | Authorization has been previously captured and hence cannot be voided.             | CancelRefusedByProvider |
| PREVIOUSLY\_VOIDED                           | Authorization has been previously voided and hence cannot be voided again.         | CancelRefusedByProvider |