Direct PayPal payment
This article shows how to redirect the customer directly to the payment gateway after clicking "Add to cart" button. This is mostly required when the membership is payed or by donations.
In this sample zip package you will find the code of mentioned process below - sample.See also: Applies to:
You need to ensure that your PayPal payment method is registered, see: www.kentico.com/docs/ecommerceguide/paypal_configuration.htm
Then you need to copy the PayPalStep.ascx file from the package to your web folder and register it as your custom checkout process step dialog and set it as the first step of the checkout process, see: devnet.kentico.com/docs/4_0/ecommerceguide/customizing_the_purchase_proce.htm
How does it work?
1) Site visitor clicks “Add to shopping cart” button
2) Site visitor is redirected to the first step of the checkout process which is your custom step (PayPal.ascx)
3) Site visitor is immediately redirected to the PayPal with initialized payment request – it is managed by PayPal provider and you don’t have to care about it.
Code in the package is commented so you can study it to understand the process and add some custom functionality if required.
In version 5 you need to pass the currency ID to the shopping cart. In sample code below is described how to get the main currency:
CurrencyInfo currency = new CurrencyInfo();
currency = CurrencyInfoProvider.GetMainCurrency();
And then you need to add the ID to the shopping cart:
this.ShoppingCartInfoObj.ShoppingCartCurrencyID = currency.CurrencyID;
Kentico CMS 3.1