# Ckeckout PayPal

**Integration Workflow**

**Sync/Async Processing**

The payment processing works in asynchronous mode. In an asynchronous workflow, a redirection takes place to allow the account holder to complete/verify the payment. After this, the account holder is redirected back to the app and the status of the payment can be queried.

**Workflow**

**Step 1:** Shopper selects PayPal payment method at checkout.&#x20;

**Step 2:** Merchant sends the initial request and redirects the shopper to the returned PayPal redirect url.&#x20;

**Step 3:** Shopper logs into his PayPal account or registers himself.&#x20;

![](https://1991843971-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGcOwWYO42hhJYXrYx1%2F-MGhhO_TGqv2dyIVCgGT%2F-MGhjvpfJkvIc9EVuFbD%2Fimage2017-8-25%2015_16_15.png?alt=media\&token=fe065989-ef63-4fc5-aad9-b427f62beca5)

**Step 4:** The shopper confirms the payment.&#x20;

![](https://1991843971-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGcOwWYO42hhJYXrYx1%2F-MGhhO_TGqv2dyIVCgGT%2F-MGhjzx4nAZrdxKMGhVy%2Fimage2017-8-25%2015_17_29.png?alt=media\&token=7d00a9e2-8cac-4b19-9fb5-571d8077ec0f)

**Step 5:** PayPal approves or declines the transaction.&#x20;

![](https://1991843971-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGcOwWYO42hhJYXrYx1%2F-MGhhO_TGqv2dyIVCgGT%2F-MGhkCcYc2q-rm1lln2g%2Fimage2017-8-25%2015_18_18.png?alt=media\&token=05115bf9-a963-47bd-8dd6-b366b79f1d0f)

**Step 6:** The shopper is redirected back to the shopperResultUrl&#x20;

**Step 7:** The merchant requests the final status of the payment

**Step 8:** The merchant confirms the the final status to the shopper.

### **Payment Widget Form**&#x20;

&#x20;    **PayPal Payment Widget Request**

```
authentication.userId=8a8294174b7ecb28014b9699220015cc
authentication.password=sy6KJsT8
authentication.entityId=8a8294174b7ecb28014b9699220015ca
merchantTransactionId=customTxId
amount=4.00
currency=EUR
paymentType=PA
cart.items[0].name=iphone
cart.items[0].quantity=1
cart.items[0].price=4.00
customParameters[PAYPAL_PAYMENTREQUEST_0_INVNUM]=abcd-1234-abced-1234
customParameters[PAYPAL_USE_NEW_VERSION]=Yes

```

### **Server-to-Server Integration**

&#x20;   **PayPal Request**

```
authentication.userId=8a8294174b7ecb28014b9699220015cc
authentication.password=sy6KJsT8
authentication.entityId=8a8294174b7ecb28014b9699220015ca
merchantTransactionId=customTxId
amount=4.00
currency=EUR
paymentType=PA
cart.items[0].name=iphone
cart.items[0].quantity=1
cart.items[0].price=4.00
customParameters[PAYPAL_PAYMENTREQUEST_0_INVNUM]=abcd-1234-abced-1234
customParameters[PAYPAL_USE_NEW_VERSION]=Yes
paymentBrand=PAYPAL
virtualAccount.accountId=CHtest123@gmail.com
shopperResultUrl=https://docs.oppwa.com
```

&#x20;**Example PayPal Response**

```
{
  "id":"8a82944954bf044c0154cefc733f1943",
  "paymentType":"PA",
  "paymentBrand":"PAYPAL",
  "amount":"92.12",
  "currency":"EUR",
  "descriptor":"0397.9339.4338 OPP_Channel_old ",
  "merchantTransactionId":"x18m-AllParamsVATest",
  "result":{
    "code":"000.200.000",
    "description":"transaction pending"
  },
  "resultDetails":{
    "ConnectorTxID3":"bf044c0154cefc733f1943",
    "ConnectorTxID2":"8a829449",
    "ConnectorTxID1":"8a82944954bf044c0154cefc733f1943"
  },
  "redirect":{
    "url":"https://test.ppipe.net/connectors/simulator;jsessionid=33D90CE2F8086217BB2FA5CB32D00969.sbg-vm-con01",
    "parameters":[
      {
        "name":"useraction",
        "value":"commit"
      },
      {
        "name":"token",
        "value":"EC-4MJ483968G697473T"
      },
      {
        "name":"ndcid",
        "value":"8a8294174b7ecb28014b9699a3cf15d1_961bf86199ee49ec960fe5ccc44a28db"
      },
      {
        "name":"connector",
        "value":"PAYPAL"
      },
      {
        "name":"cmd",
        "value":"_express-checkout"
      }
    ]
  },
  "buildNumber":"c724840a1e553b5d2f76f2f03c9ffb260a72f91d@2016-05-17 14:47:50 +0000",
  "timestamp":"2016-05-20 16:25:31+0000",
  "ndc":"8a8294174b7ecb28014b9699a3cf15d1_961bf86199ee49ec960fe5ccc44a28db"
}
```

**Test Data**&#x20;

&#x20;For testing you may use the test account details listed below. It is important to note that the system has two test modes available to cause requests to be sent to the connector simulator or to the connector's own test platform, as required:

* testMode=EXTERNAL causes test transactions to be forwarded to the processor's test system for 'end-to-end' testing
* testMode=INTERNAL causes transactions to be sent to our simulators, which is useful when switching to the live endpoint for connectivity testing

{% hint style="info" %}
This test data is only working in testMode=INTERNAL. When using testMode=EXTERNAL, you will get a pending status response in 'error in asynchronous workflow (90); Previously pending transaction timed out (100.396.103)'.
{% endhint %}

### **How to check transaction activity**

After the shopper complete the transactions, PayPal displays those transactions in the Recent activity table located on the Summary page of your PayPal account.

**Step 1**: Log in to your PayPal account.

![](https://1991843971-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGcOwWYO42hhJYXrYx1%2F-MGhhO_TGqv2dyIVCgGT%2F-MGhkKNom_58t_iieo4i%2Fimage2017-7-12%2012_24_55.png?alt=media\&token=a5323039-2314-4b4d-b46c-33819c5fc3cc)

**Step 2**: Click the table heading "Activity"\
The Activity table is displayed and shows all transaction activity for the past 30 days.

![](https://1991843971-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MGcOwWYO42hhJYXrYx1%2F-MGhhO_TGqv2dyIVCgGT%2F-MGhkPH4IrHuVl4L2SKO%2Fimage2017-7-12%2012_25_59.png?alt=media\&token=fdd5563c-cb46-48b7-aff5-b82cf3bde54e)

**Step 3**: Select options from the Active, All transactions, and All currencies menus to filter for a specific type of transaction activity. You can also use the search tool to filter activity. When viewing transaction activity, the status of payments can be:

* Completed: Transactions were successful, and funds were credited to your account.
* Cleared: Payments cleared senders' accounts, and funds were credited to your account.
* Uncleared: Payments have not cleared sender's accounts, and funds were not credited.
