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. These instructions are used for the 4.x uncompiled (4.00-4.13) and compiled (4.14-4.2x) versions of Merchant. Please follow the initial install instructions for your version.
Initial Install

PayPal main module

Merchant version 4.13 and older

  • New Installation of our Payment via PayPal module
    • Go to admin:modules:add module and click the link
    • 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
    • Select admin:stores:payment configuration and assign the module
    • Click the tab at the top and update the settings
  • Update of prior version of our Payment via PayPal module
    • Go to admin:modules
    • Scroll down to Payment via PayPal and click the link
    • Use the Merchant admin upload feature to upload the paypal.mv module
    • Select Overwrite and update the older version
    • Select admin:stores:payment configuration
    • Click the tab at the top and update the settings

Merchant version 4.14 and newer

  • New Installation of our Payment via PayPal-R module
    • Go to admin:modules:add module and click the link
    • Use the Merchant admin upload feature to upload the paypalr.mvc module
    • Once uploaded, click the Add button to add it to the mall/domain
    • Select admin:stores:payment configuration and assign the module
    • Click the tab at the top and update the settings
  • Replace prior version of our Payment via PayPal (compiled) with Payment via PayPal-R (compiled) module
    • Go to admin:modules:add module and click the link
    • Use the Merchant admin upload feature to upload the paypalr.mvc module
    • Once uploaded, click the Add button to add it to the mall/domain
    • Select admin:stores:payment configuration and assign the module
    • Click the tab at the top and update the settings
    • If the message appears to convert references in the orders database, check the box and update. Once updated you can remove the old version of Payment via PayPal.
    • If there is no message it means the prior PayPal module is either not ours or has been inactivate so that the data cannot be retrieved
  • Replace prior version of our Payment via PayPal (uncompiled) with Payment via PayPal-R (compiled) module - Note: This must be done before you run the upgrade.mvc to upgrade an uncompiled store to a compiled store. If it is not done beforehand, you need to go back up to the "New Installation of our Payment via PayPal-R module" section.
    • Rename the file u2cstop.mvc to paypal.mvc
    • FTP it to the modules/payment/paypal.mvc location in the path that matches your new merchant version, eg. Merchant2/4.23/modules/payment/paypal.mvc Overwrite the paypal.mvc that is supplied by Miva Corp
    • Run the upgrade.mvc to upgrade your store
    • After a successful upgrade, go to admin:modules:add module and click the link
    • Use the Merchant admin upload feature to upload the paypalr.mvc module
    • Once uploaded, click the Add button to add it to the mall/domain
    • Select admin:stores:payment configuration and assign the module
    • Click the tab at the top and update the settings
    • If the message appears to convert references in the orders database, check the box and update. Once updated you can remove the old version of Payment via PayPal.
  • Update of prior version of our Payment via PayPal-R module. Note: This is a new module as of April 27, 2004. If you did not obtain our PayPal module after that date, you are not updating the Payment via PayPal-R module. Rather, you are replacing an earlier Payment via PayPal with the Payment via PayPal-R.
    • Go to admin:modules
    • Scroll down to Payment via PayPal-R and click the link
    • Use the Merchant admin upload feature to upload the paypalr.mvc module
    • Select Overwrite and update the older version
    • Select admin:stores:payment configuration
    • Click the tab at the top and update the settings

If you are unsure which scenario above applies to you, contact us with as much info about your current and past PayPal modules as you can supply. We will also need your order number, Merchant version and full url to your merchant.mv(c) in order to better advise you.

CIM Auxiliary System Extension module - ONLY Merchant version 4.14 and newer

  • New Installation of the CIM Auxiliary System Extension module
    • Go to admin:modules:add module and click the link
    • Use the Merchant admin upload feature to upload the cim_aux.mvc module
    • Once uploaded, click the Add button to add it to the mall/domain
    • Select admin:stores:system extension configuration and assign the module
    • No configuration settings are needed for this module
  • Update of prior version of the CIM Auxiliary System Extension module
    • Go to admin:modules
    • Scroll down to CIM Auxiliary System Extension and click the link
    • Use the Merchant admin upload feature to upload the cim_aux.mvc module
    • Select Overwrite and update the older version
    • Select admin:stores:system extension configuration

Required PayPal stub files - Merchant version 4.13 and older

FTP the paypal_1.mv and paypal_2.mv to the Merchant root directory, e.g. 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.

Required PayPal stub files - Merchant version 4.14 and newer

FTP the paypal_1.mvc and paypal_2.mvc to the Merchant root directory, e.g. Merchant2/ This is the same directory that your merchant.mvc 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.

PayPal Reports: If you are using the compiled version of Merchant (4.14+) you can also upload the optional reports module for creating summary reports. Individual payment details are available through the basic PayPal module (fig 1). The summary reports provide more info for broader time periods and multiple transactions (fig 2, 3).

Warning: 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.


Configuration Settings
Enter data into the applicable input fields.


Merchant Script Name
In most cases this is merchant.mv (merchant.mvc compiled) However, some people have changed this to things like catalog.mv, store.mv, etc. Use the current file 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. This option is not in the compiled version of Merchant.

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.

Currency you accept as Default
PayPal.com allows you to accept money in the currency of some countries other than US dollars. Check with paypal.com to see if yours is available and what the currency code is. You first login at paypal.com and then go to page https://www.paypal.com/cgi-bin/webscr?cmd=p/sell/mc/mc_wa The three letter codes are what is used in this field. You only enter one of them into the PayPal module admin screen. That is your default.

PayPal Logo URL (Merchant 2.0-4.13 uncompiled)
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.

PayPal Logo URL (Merchant 4.14+ compiled)
When the customer checks out, the PayPal logos can be displayed on the checkout screens. 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(s) 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. You can even enter multiple logos separated with a comma. The first should be the PayPal logo, but the rest can be the various other images permitted by PayPal.

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.

Invoice Messages (HTML and plain text) - compiled version
This message appears in the order confirmation emails. You can pass on specific info about PayPal payment processing and even include the transaction ID. It works with OpenUI emails and our Mail Manager notification emails.

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.

Additional Security Checks - compiled version
Leave these unchecked until you have tested the module and have it working. Once you are certain the module works correctly you MUST check these last two boxes and test again. Hackers have found ways of beating some of the other paypal systems, so I implemented these checks to reduce known hacker exploits. 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.


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. Note: This section is not applicable to compiled Merchant.

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>
Personal PayPal account is not compatible with compiled versions of Merchant. If your PayPal account is personal, you will need to use an older version of the PayPal module. Contact us for info.

2) Optionally, 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 for Merchant version less than 4.10.

<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>

In the meremail.mv and custeml starting with Merchant 4.10, locate the line:
<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ SendEmail( l.to,l.from,l.cc,l.subject,l.headers,l.message ) }">
Add the following immediately preceeding that line:
<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ Module_Find_ID( Orders.d.pay_id ) }">
<MvIF EXPR = "{Modules.d.code EQ 'paypal'}">
<MvASSIGN NAME = "l.message" VALUE = "{l.message $ asciichar(10) $ 'Payment method: ' $ Modules.d.name}">
</MvIF>

If you are using compiled Miva Merchant, file names ending with .mv above need to be changed to mvc. Then you will need to re-compile the meremail.mv into meremail.mvc.


Editing Option (not applicable to compiled versions of Merchant)

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

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 (merchant.mvc compiled). When the customer is at the PayPal site, merchant.mv (merchant.mvc compiled) is not being refreshed periodically.


Optional Phone-in Module

The phonein.mvc is an optional file that does not need to be installed. Use it only if you want to have a phone-in option for customers. You would still need a terminal or virtual terminal to process the credit card numbers. That service is not free. For example, paypal.com has a virtual terminal for $20 per month plus per transaction fees.


Frequently Asked Questions
Q: The payment is made at PayPal.com but the store orders are never updated. The customer does not get an email and the order does not show up in admin.
A: If this happens on every order your IPN posting is not correct between paypal.com and your Miva Merchant store. First, make sure you FTPd the intermediate handler files paypal_1.mv and paypal_2.mv (mvc if compiled) to the root Merchant2 directory. Also, make sure that the PayPal ID that you entered in the module's admin configuration screen is your correct and "verified" business or premier PayPal ID. You then have two options:
1) Check the box in the paypal module admin screen to send the IPN URL as a hidden input. Be sure you have nothing entered at paypal.com for IPN URL preference.
2) Go to paypal.com to your Profile:preferences. Then under IPN, check the box and enter the URL to post to. There is a sample URL on your paypal module admin screen which you can view for format. Modify it for your domain. An alternative way to get the IPN URL is to check the box as in option 1 above. Create an order and proceed to checkout. At the last checkout screen at your store, you can view the source to copy and paste to paypal.com the hidden input called notify_url. Then go back and uncheck the box in your paypal module admin. This will ensure that the IPN URL info is used only from the preferences that you entered at paypal.com. Note: This method cannot be used if your store is using the same paypal.com account as other Miva Merchant stores. Some people have multiple stores using one paypal.com account so the IPN URL has to be supplied by the paypal module in the store using it.
A: If this happens only with some PayPal orders, then there is a transient Internet communication problem. Your server may be down when the paypal.com server tries to post the order completion data. Or the paypal.com server responsible for posting may go down between when the customer pays and the queue is ready to send your posting. Due to heavy traffic, posting may not be instantaneous. Since mid-December 2002, I have seen the time between customer payment and the paypal.com IPN being posted as long as 45 minutes. If the customer goes back to your store and starts shopping around again, their previous order number will be deleted before the paypal.com server makes its posting. Hence, the order will never get completed. Likewise, if you have your basket timeout set below that length of time, there will be no order for the paypal.com server to complete. You should make your basket timeout at least two hours. You should also include information in the paypal module's admin screen "Additional Instructions" (so the customer will see it at checkout) about transient delays before the order is finalized.

Q: The orders show up in miva, but shipping charges are not included in the paypal payment. Shipping charges calculated by the shopping cart do not appear to be passed on to PayPal.
A: If you view source at the order payment screen (the screen just before you are taken to paypal.com) you should see the shipping charge as a hidden input that is being passed to paypal.com. The problem is that you have not setup your profile at paypal.com correctly. Log into your account at paypal.com and click on the tab for Profile. Then click on Shipping Calculations.
Per PayPal Technical Support
Create a shipping method, and check the button for allowing transaction based shipping to override what you have in your profile. Click on continue, then click on save. Now your shipping charges passed from your cart will over ride what is listed in the profile.
Frank I.
PayPal Certified Developer
PayPal Merchant Technical Support
Note that you will need to do this for domestic and international shipping.

Q: I'm having sudden problems with not receiving orders, though I receive notification from PayPal that I have received funds. In most cases, the email order notice finally comes through, though one today appears to be lost. In this case, PayPal reports it as order #1234. It is not in the list of orders under Order Processing. The number 1234 does not show up in the Show Basket either. I haven't made changes and everything has been working fine until now.
A: The key is you have made no changes, some orders are getting into Merchant, and those that do get in, seem to be posting with long delays. Paypal.com is probably running show due to heavy traffic. This happens every year around Christmas time. When the customer returns to your store, the background IPN has not yet posted from paypal.com back to your store. There is a note to tell them not to worry about it; that it might take 30 minutes. But if they are the curious type and go to their basket and start changing things the order number that paypal got will be deleted. Hence, when the IPN finally does post, there is no order to complete. You should have your basket timeout set to 120 or higher. You can also put a note in the order payment screen message to be aware there may be delays in paypal.com notifying your store that a payment has been made during heavy shopping seasons. They should not be concerned and by all means, do not delete the items in the basket after the payment has been made.

Q: I am seeing the following error when returning back to Miva Merchant after paying at paypal.com.
Miva Merchant has encountered a fatal error and is unable to continue. The following information may assist you in determining the cause of the error:
Error Code: OUI-00001
Description: Unknown Screen [XPROCCD]
A: Scroll back up to the section "CIM Auxiliary System Extension module - ONLY Merchant version 4.14 and newer". If you see this error, this section applies to your store. It is likely you did not install AND ASSIGN the cim_aux.mvc to the store, as that is the error you would get if it is not assigned.

Q: I am getting the following error message when return from paypal.com back to my store.
Runtime error in Merchant2/paypal_1.mvc @ [00000000:00001990]: paypal_1.mv: Line 243: MvOPEN: Error opening 'Merchant2/,Merchant2/000001,1/orders.dbf': No such file or directory
Fatal Error
A: This is being caused by the fact that your PayPal account is using PDT (Payment Data Transfer). With PDT, additional parameters are appended to the return URL as PDT is used to customize your return page with payment information. As you are using IPN already, you are getting the same parameters passed via IPN that you would through PDT. You MUST turn PDT off in your PayPal Profile under 'Website Payment Preferences'. By doing so, you will eliminate the additional parameters that are being to the return URL.

Q: I had a strange transaction. Apparently a customer canceled or didn't complete an order but was charged $.02 on their PayPal account. The item in their basket at the time cost $20+. Nothing on my website costs $.02. What is going on?
A: They tried to hack your account and place a fake order. You correctly had the security settings set in paypal module to block order totals that did not match. If you had not, they would successfully placed an order for $20 while only paying 2 cents. Always make sure the security checks are turned on, i.e. that the order total in merchant matches the amount the customer pays at paypal.com and the email address for the store (recipient) is the same email address the money goes to. Also, you must always manually compare the order total in merchant with the amount paid at paypal.com. No telling if and when hackers will figure out a new exploit.

Still have a question?
Fig 1


Fig 2


Fig 3