PayPal is one of the world’s most popular digital wallets, enabling users to pay quickly and securely online using their stored payment methods. With over 400 million users globally, PayPal supports transactions in multiple currencies and provides a trusted checkout experience across devices and platforms.
supports PayPal through all major integration types – giving merchants the flexibility to design their ideal checkout experience while benefiting from PayPal’s global reach.
Get started
Before integrating PayPal with , merchants must first complete the necessary setup within their PayPal account. These steps are essential for linking your PayPal merchant profile with .
Steps for PayPal Sandbox (Test) Environment
- Create PayPal developer account Create Paypal developer account if you do not have one.
- Create a PayPal Sandbox Account
Follow PayPal’s guide to create a sandbox business account. - Grant permissions to
Fetch the Email ID and password of your sandbox business account to login and Authorize to process transactions on your behalf. - Retrieve Your Payer ID (Account ID)
You can find the Payer ID also known as Account ID in your developer account under the specific sandbox business account. - Send Payer ID to
Once you have your Account ID, contact and request activation of PayPal in the Test environment.
Steps for PayPal Live Environment
- Signup to create a live PayPal business account
- Activate your business account.
- Grant permissions to by logging in with your account credentials and follow the steps.
- Retrieve the live Payer ID also known as Account ID from your business account
- Contact to enable PayPal in the Live environment and provide the Payer ID
Integration options
supports PayPal across all three integration types:
Hosted Payment Page
Use Create checkout session to redirect customers to a Hosted Payment Page where PayPal will appear as a payment option.
Hosted forms
For a redirect-style integration, call Create payment with:
{
...
"paymentMethods": {
"type": "PAYPAL",
"integrationType": "HOSTED"
}
}
.
Customers will be redirected to PayPal to complete the payment.
Direct integration – PayPal Smart Button
Unlike typical Direct integration, PayPal Smart Button follows a custom integration flow. Refer to the detailed instructions below to implement it correctly.
Process flow
Customer proceeds to checkout.
Your frontend loads the PayPal Smart Button. See below sample code for your reference to embed the Paypal's Smart Button on your checkout page.
Additional configuration options
Update the below line of code as per your additional configuration needs
<script type="text/javascript" src="https://www.paypal.com/sdk/js?client-id=ARCsDK7xBFxa5pnGxk8qvB0STB07fyi_yHDRrb5al6gxahj73Pxg9X2l7onP9J2IN-LqcVJojys94FLK&merchant-id=<PayerID>¤cy=<Currency>&disable-funding=giropay,sofort,sepa,card&intent=capture" data-partner-attribution-id="Computop_PSP_PCP_Test"></script>
- Funding sources: Customize allowed or disabled payment sources via
disable-fundingorenable-fundingparameters. - Pay Later support: Add
enable-funding=paylaterto show PayPal Pay Later. - Intent parameter: Must align with capture strategy:
intent=capturefor auto captureintent=authorizefor manual capture
- Funding sources: Customize allowed or disabled payment sources via
Customer clicks PayPal button to pay.
Your frontend javascript code initiates the createOrder function to call your server.
Your server makes a Create payment call with:
{ ... "paymentMethods": { "type": "PAYPAL", "integrationType": "DIRECT" } }initiates a Create order call with PayPal.
PayPal returns
orderIdin the response.returns
orderIdalong with thepayIdof the transaction.Your server returns
orderIdandpayIdto your frontend.Javascript code on your frontend initializes PayPal SDK with
orderIdto open the PayPal login window in a popup.Customer enters credentials and confirms payment.
PayPal SDK communicates with PayPal to authenticate and authorize the payment.
Paypal responds to the request.
Javascript code on your frontend calls 's callback URL.
intiates a Complete order call to PayPal.
PayPal responds to the request.
Customer is redirected to the return URL (urls.return) that was submitted by you in step 5. The return URL is suffixed with
payIdin the query parameters.The browser triggers an HTTP GET request to the return URL on your server, including the
payIdin the query string. Your server uses thispayIdto identify the payment session and proceed with retrieving the payment result.Your server makes a Retrieve payment details by Payment ID call to retrieve the responseCode of the payment.
responds with the responseCode of the payment along with other parameters.
Your server returns a success or a failure page based on the responseCode of the payment.
Express checkout
PayPal Express checkout is a streamlined, customer-friendly payment experience that enables quick purchasing by allowing users to leverage their PayPal-stored address and payment details. This flow reduces friction by pre-filling shipping details, making it ideal for repeat customers or those who want a fast, no-hassle checkout experience.
Express checkout is available on both Hosted Forms and Direct integration (PayPal Smart Button).
To support PayPal Express checkout, submit the following in your initial Create payment request:
{
...
"paymentMethods": {
"type": "PAYPAL",
"integrationType": "DIRECT", // HOSTED - for Hosted forms
"payPal": {
"expressCheckout": true
}
}
}
The process flow for Express checkout is an extension to standard flow:
- Once the initial payment request completes successfully responds with status of the payment as
AUTHORIZATION_REQUEST. Based on this you should show a confirmation page to the customer. Here customer can perform some actions like updating their address. These need to be communicated to PayPal in a subsequent Update payment details call with
eventToken=UPDATE_ORDER_DETAILS- It is possible to update the amount when finalizing the transaction. However, there are some thresholds that you should not exceed. You can contact your PayPal account manager for more details on this topic. The response comes with the status
OKif successful.
Reverse payment
Reverse an authorized but not yet captured PayPal transaction by calling Reverse payment with the original payId.
Capture payment
You can capture a PayPal payment manually using the Capture payment endpoint.
Refund payment
To issue a refund for a captured Paypal payment, use the Refund payment endpoint.
