Need help buying now? +48-22-219-5163 +1-917-720-3250
My Cart

Your Cart is Empty

Need help buying now?
+48-22-219-5163 +1-917-720-3250

PayPal payment method

PayPal payment method

In order to pay for products online in a web store you may use a lot of specific services. Let us review the features of PayPal payment method, its configuration and general information about the system work.

PayPal payment types

PayPal service uses a wide range of features for configuration of online payment for a product in a web store. Below are the most popular of them:

Express-payment

It is the most popular payment type of those offered by PayPal. This is a system of express payment that allows receiving money without a seller account (it is very convenient for buying products through such services as Amazon, eBay, Alibaba). No verification documents are needed, like a credit card or a passport scan copy, etc. It would be fair to note that express-payments can only be used directly within PayPal system and cannot be installed onto your site.

Direct payment

This method can be installed on your site, you can use it to receive payments on your card with the help of simple software. For the moment, this method is only available for sellers and customers in the USA and the United Kingdom. It also offers different variants of executing payment, e.g. a payment can be postponed for a certain period of time (it is a very useful feature from the security point of view).

Regular payment

This method allows setup a schedule of money transfers, e.g. if a customer buys a product paying by installments, subscribes for paid updates or newsletters, etc.

Joint (mass) payment

This type of PayPal configuration allows receiving money from several accounts at once. As an addition to mass payments there are also adaptive payments. This is a variant of a more complicated configuration of joint payments.

Configuration

PayPal system can transfer data through HTTP combined with the protocols SOAP and NVP. Each of them is an abbreviation. NVP means Name-Value Pair, and SOAP means Simple Object Access Protocol. We will review the work with NVP as it is more flexible in configuration and is easier to be installed on a separate site.

All methods have their own specializing parameters but there are common ones. For instance, client identification is the same for both protocols:

USER – PayPal account name;
PWD – password;
VERSION - NVP API version number;
SIGNATURE – PayPal signature, it needs to be used if you have an account authorization certificate installed on your site;
METHOD – it is a parameter responsible for selected payment type.

All queries to server are sent through secure protocol HTTPS.

Direct payment configuration

Direct payment is the most popular payment type of those that can be installed on the site. The operations are always under control which helps to optimize the work of your site, control and thus increase the sales.

The main parameters of direct payment:

METHOD – set ‘DoDirectPayment’ here;
IPADDRESS – set buyer’s IP address here. If you use PHP you may get that address using $_SERVER['REMOTE_ADDR'].
PAYMENTACTION – it specifies the action that will be executed, we need to set ‘Sale’.

Bank card information:

CREDITCARDTYPE – the type of the card you are going to use – Visa, MasterCard, etc.
ACCT – the card attributes (number).
EXPDATE – the card expiration date.
CVV2 – security code from the card back side.

The card owner’s information:

FIRSTNAME, LASTNAME – name and surname should be written in separate fields; you may also set ‘Email’ as a required field to allow customer subscribe;
CITY, STATE, COUNTRYCODE, ZIP – customer’s address;
STREET, STREET2 – here only the first line may be filled.

In order to fill the product information please use the parameters: L_NAMEm, L_DESCm, L_AMTm and L_QTYm. In this case «m» is a variable that separates the parameters, it can be replaced with 0,1 or other attribute for convenience.

In order to process the transaction you need to add specific code (the process is coded as a different class separated from the store). All queries are transferred through HTTPS. You will also need to install the certificate file into your store.

$requestParams = array(
  'IPADDRESS' => $_SERVER['REMOTE_ADDR'],
  'PAYMENTACTION' => 'Sale'
);
$creditCardDetails = array(
  'CREDITCARDTYPE' => 'Card type’,
  'ACCT' => 'Card number’,
  'EXPDATE' => 'Expiration date',
  'CVV2' => 'Security code'
);
$payerDetails = array(
  'FIRSTNAME' => 'Name',
  'LASTNAME' => 'Surname',
  'COUNTRYCODE' => 'Country',
  'STATE' => 'State',
  'CITY' => 'City',
  'STREET' => 'Address',
  'ZIP' => 'Additional address information'
);
$orderParams = array(
  'AMT' => 'Price including tax',
  'ITEMAMT' => 'Price',
  'SHIPPINGAMT' => '4',
  'CURRENCYCODE' => 'Currency'
);
$item = array(
  'L_NAME0' => 'Product name',
  'L_DESC0' => 'Product description',
  'L_AMT0' => 'Cost',
  'L_QTY0' => 'Quantity'
);
$paypal = new Paypal();
$response = $paypal -> request('DoDirectPayment',
  $requestParams + $creditCardDetails + $payerDetails + $orderParams + $item
);
if( is_array($response) && $response['ACK'] == 'Success') {
  $transactionId = $response['TRANSACTIONID'];
}

 

You may find a more detailed description of PayPal configuration on the official site https://www.paypal.com/webapps/mpp/website-payments-pro.
If you have any additional questions you may contact GoMage specialists through comments to the article or on our forum http://magentoforum.com/.

The code is taken from the site https://developer.paypal.com/

Newsletter