PayPal v2 introduces the PayPal Checkout, featuring a RESTful API solution that includes standard checkout, PayPal Express, and the innovative PayPal Vault functionality. These versatile and powerful payment solutions are designed to enhance the e-commerce experience for both merchants and their customers. By allowing customers to quickly complete transactions using their PayPal accounts, this integration helps reduce cart abandonment and speeds up the payment process.
PayPal v2 streamlines authentication and approval steps, ensuring a secure, efficient, and user-friendly checkout experience for your e-commerce platform. Beyond the standard checkout, the platform also offers the flexibility to use the JavaScript SDK to render PayPal buttons and respond to various PayPal events.
With the standard PayPal implementation, the user is expected to be redirected to a new window / tab by the integrating partner and this flow is explained in details: PayPal Redirect Flow
PayPal Checkout v2 with PayPal SDK , provides a more easy end-user handling approach by simplifying the redirection process and customer's return to merchant's page. In principle, the merchant’s site renders the PayPal Button and delegates most of the user handling to PayPal, reducing checkout complexity and dropouts.
Mode details on PayPal SDK can be found here PayPal information
PayPal allows the configuration of the initiation script via Query parameters to help define specific content or actions based on the data being passed. Each piece of data sent contains:
In this example, the script includes the following query parameters:
<script src="https://www.paypal.com/sdk/js?client-id=Axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&merchant-id=LXXXXXXXXXXXXX¤cy=EUR&intent=authorize&locale=de_DE&commit=true&vault=false&disable-funding=card,sepa,bancontact&enable-funding=paylater"></script>
For debug purpose you can also add the parameter
debug: true/false
Merchants have two options for rendering the PayPal button: they can opt for a dynamic PayPal button or use the standard JavaScript SDK to create buttons and respond to key events (such as onApprove, onError, onCancel, and onShippingChange).
The JavaScript Button Renderer offers a simple and efficient way to integrate the PayPal button into your website, enhancing both functionality and user experience. To ensure the PayPal button operates smoothly and provides a seamless checkout process, you'll need to prepare the following components:
|
Information on Order Request implementation using our SDKs can be found here : Server SDK Documentation
Log in to your PayPal account and click on Account Settings under your profile.
Click on Business Information, and you will see your Merchant ID on the right-hand side.
Simple example flow for a PayPal SDK payment via Commerce Platform
paymentProductId |
840 |
requiresApproval |
boolean
|
redirectionData.returnUrl |
For SDK Flow , user will not be redirected to this URL but due to legacy and interoperability between flows, this URL still needs to be passed in the request. |
tokenize |
boolean
|
paymentProcessingToken |
The unique Id which needed to facilitate payments against a stored account. Usable for speeding up checkout process by asking customer to complete transaction using his stored PayPal account or , when customer is not present, to complete a transaction. ( e,g. : Subscription charge ) . Please notice that if tokenize = "true", the paymentProcessingToken will not be considered, and a new process to store consumer account will be initiated. To initiate a payment against a stored account, paymentProcessingToken has to contain the Token ID and tokenize = "false". |
paymentProduct840SpecificInput.fraudNetId |
A unique ID determined by the merchant, to link a Paypal transaction to a FraudNet PayPal risk session. Only applicable to customer-initiated transactions, when the FraudNet SDK is used, and to be passed in the API request the same tracking ID value (FraudNet Session Identifier). This SDK is available here https://developer.paypal.com/docs/checkout/apm/pay-upon-invoice/fraudnet/ |
paymentProduct840SpecificInput.javaScriptSdkFlow |
Required parameter which defines how PayPal is being integrated inside the checkout page. boolean true = the current integration uses PayPal SDK |
paymentProduct840SpecificInput.javaScriptSdkFlow |
Required parameter which defines how PayPal is being integrated inside the checkout page. boolean true = the current integration uses PayPal SDK |
paymentProduct840SpecificInput.action |
Required parameter which one value "CONFIRM_ORDER_STATUS" it signals process is finished on merchant side. |
Creating a Commerce Case with the initial Checkout including a reference, information about the customer and the items in the shopping cart.
POST Commerce Case
|
|
This call, will be initiated by the PayPal SDK when the user clicks the button and the SDK's createOrder function, will call an endpoint from your server where the PayPal ID is expected to be responded with. When this happens, create an Order Request following the standard API implementation API Order Request. You can find the PayPal required ID it in the response under payPalTransactionId and return it to the SDK.
POST Order
|
|
After onEvent notification is received from PayPal with transaction status ( either onApproved , onCancel or onError ) , a Complete request is needed before any other Order ( retry ) can be initiated ( for the same checkout ). This will allow for the status to be propagated across the Commerce platform and facilitate a new order if needed.
POST Order
|
|
You can identify the corresponding transaction by the field createPaymentResponse.payment.id in the order response. The status PENDING_CAPTURE shows that the amount is authorized and the payment gateway is waiting for a capture.
|
Full Deliver to capture the complete order amount.
POST Deliver
|
|
The payment gateway informs you via webhook about the successful capture.
|