PayPal Payment Version 3.6 or Higher
Copyright © 2000, William Weiland
Overview
The purpose of this module is to allow customers to place an order at a Miva Merchant © Miva Corp. enabled store which they will then pay for using their PayPal © x.com account.
Initial Setup
Use the Merchant admin upload feature to upload the paypal.mv module. Once uploaded, click the Add button to add it to the mall/domain.

If you are updating an existing module, click Modules, then the link to the module, then the file upload feature, overwriting and updating the older version.

In admin, under your store, click on the link for Payment Configuration. Assign the module and Update it to install it in your store.

Click the link for Payment via PayPal to enter the configuration settings.

FTP the paypal_1.mv and paypal_2.mv to the Merchant root directory, eg Merchant2/ This is the same directory that your merchant.mv file is located in. It should be the same directory that you have identified the Non-Secure URL to Miva Merchant in your Admin:Domain Settings:Site Configuration. These must be FTP'd; they are not installed as modules.


Configuration Settings
Enter data into the applicable input fields.

Merchant Script Name
In most cases this is merchant.mv However, some people have changed this to things like catalog.mv, store.mv, etc. Use the current name of your store. Do not include the full URL.

PayPal ID
PayPal accounts are based on your email address. You should have already established your PayPal account before installing this module so that you will know the ID and type of account beforehand. Then enter the email address which you are using to accept funds through PayPal.

PayPal Business Account
In all likelihood your PayPal account is a business or premier account. Check the box if it is either. If your account is a personal PayPal account, the box should be UNchecked.

URL to PayPal
This is a fixed URL. However, PayPal at a later date, may change this URL. For this reason, you have the option to make the change yourself without having to get an updated version of this module. If your paypal module is defaulted to https://secure.paypal.com/cgi-bin/webscr, change it to https://www.paypal.com/cgi-bin/webscr

Conversion Rate from USD ($)
If your store is based on US dollars, this value should be 1. If your store is in other than US currency, the totals from the sale need to be converted to US dollars in order to insert the correct amounts into the PayPal screen. This rate will probably be the same as that rate you are using with the Euro Currency Module in Merchant. Whenever, the conversion rate changes you will need to edit this field in admin.

PayPal Logo URL
This only applies if you have are sending customers to a PayPal personal account. Business and Premier PayPal accounts, skip this paragraph. On the Invoice screen in Merchant, when the customer checks out, the PayPal logo needs to be displayed so that the customer will click on the link and be carried to the PayPal web site for the actual transfer of funds. The URL for this logo on the PayPal site can result in a broken image on the secure server. Hence, you will need to determine which logo you are going to use, copy it to your web site (in a virtual path below Merchant), then enter the virtual path to that logo.

Payment Method Prompt
Normally this will be PayPal. However, you may wish to change that to Payment via PayPal, PayPal Web Accept, etc.

Additional Instructions
This message appears on the Order Payment screen. It allows you to inform the customer what the payment process consists of at the PayPal site and that they need to continue through all of the screens to return to your store to display the invoice screen.

Instant Payment Notification (IPN)
PayPal will post notification of payment into a special payment log in your Merchant store on your site before the customer even returns to your store's invoice screen. It will not contain credit card details, but will give you info about the transaction. This file is for information only and should not be considered a verification. The verification can be made from a link to PayPal in the admin screen in the Order Edit section. See the admin:payment configuration screen on other details necessary to implement. This is a required step. Also, when you are setting your preferences at the PayPal site, do not setup PayPal to calculate shipping and tax. Your Miva Merchant will do that and pass the values to PayPal. You do not want PayPal to override the Merchant charges.


Editing Requirements (skip if using the OpenUI)
If you are using the Miva Merchant User Interface (mmui) you will need to make some very simple edits to the core files. Be sure to do that with a text editor (NO WYSIWYG editors) such as Programmer's File Editor (PFE) so as not to damage the mv files. ALWAYS BACKUP your unmodified mv files in case you make a mistake.

1) If your account at PayPal is a "Personal" account, you will need to edit the mmui.mv file to incorporate the hyperlink for PayPal payments to personal accounts. Do NOT make this edit if your account is a Business or Premier account. Locate the function UIModule_Invoice in the mmui.mv file. Locate the second TABLE tag in this function if using Merchant 3.x or 4.x or the first TABLE tag in this function if using Merchant 2.x:
<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0 WIDTH = "100%">
On the line before this table tag, place the following lines:

<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.module_id" VALUE = "{ Module_Find_ID( Orders.d.pay_id ) }">
<MvIF EXPR = "{Modules.d.code EQ 'paypal'}">
<MvDO FILE="{g.Module_Root$'modules/payment/paypal.mv'}" NAME="l.paypal_link" VALUE="{PaymentModule_Payment_Link()}">
</MvIF>

2) If you want to include a notation in the merchant email which type of payment the buyer used, you can insert the following lines just above the </MvSMTP> tag in your meremail.mv file.

<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Module_Find_ID( Orders.d.pay_id ) }">
<MvIF EXPR = "{Modules.d.code EQ 'paypal'}">
<MvEVAL EXPR = "{ asciichar( 10 ) $ 'Payment method: ' $ Modules.d.name }">
</MvIF>


Editing Option

You can also change the text in your invoice note if your PayPal account is a "Personal" account, not Business or Premier. To do that, scroll down in the paypal.mv file to the function called PaymentModule_Payment_Link which contains the invoice text. This function contains the link which sends the customer to PayPal personal accounts after placing their order. This should only be changed if you have some experience at mivascripting. Backup before editing.


Be Aware

Since hackers continually come up with new schemes, you must always compare the order total in Miva Merchant with the money received at PayPal. You must go to https://www.paypal.com and verify the actual payment.

With the paypal module, the link to paypal includes the product costs+tax and a separate item charge for shipping. When the customer clicks the link, they see the item cost on the 1st paypal screen at the paypal site. Hidden inputs (you can see them if you view source), include the shipping cost and grand total. As the customer inputs their CC info, the full charges and other info are on subsequent screens.

Because customers can spend a good bit of time setting up their PayPal account, you should be sure that you have a lengthy basket time out setting, e.g. 120 minutes. Typical time out error messages might be: "Your keyboard has been idle greater than 15 minutes. Therefore, your basket was automatically expired before you completed your order." or "Your basket's contents changed unexpectedly during the checkout process. Please press your browser's back button and restart the checkout process." To the customer who has been entering data at the PayPal site, this message might not make sense. The reality is that Merchant can only monitor keystrokes when they are entered in the URL containing merchant.mv. When the customer is at the PayPal site, merchant.mv is not being refreshed periodically.

In order for Merchant to "carry" the Tax Exempt ID to the final stage of checkout, the data is transmitted to the PayPal site and back when payment is finalized. This transfer is non-secure. If you are using the Business to Business Tax Exempt module and your situation requires secure transmission of the Tax ID, you will not be able to use this module. Generally the Tax ID is public record and this is not an issue.