Before Getting Started
Ubercart has a very flexible payment system that allows you to connect the core credit card system up to any integrated payment gateway that accommodates credit card payments. Before starting to setup payment in your Ubercart site, you should consider what your requirements will be for processing credit card payments, what parts of the world the different companies service, and whether or not the services you're looking at have been integrated with Ubercart. Core modules are guaranteed support as long as they're a part of core, but that doesn't mean some contributed payment modules are lacking in features. If you're undecided and just want one fast that works, I'll recommend Authorize.Net. We continue to improve the core module and have registered as an affiliate with them so sign-ups through our site support Ubercart development. Be sure to shop for the best rate for you!
Testing CC Payments in Checkout
For testing, however, it is not necessary for you to setup a gateway account. Ubercart actually ships with a test gateway module that you can plug into your credit card payment method to test pass and fail transactions. Step-by-step, you have to:
- Install and configure the core Credit Card module.
- Install the Test Gateway module.
- Browse to the payment method settings form at Administer > Store administration > Configuration > Payment settings > Payment methods. Make sure "Test Gateway" is specified as the default payment gateway for the credit card payment method. (You might also make sure the enabled checkbox has been marked as well!)
- Now go add something to your cart and proceed to checkout.
You will be presented with the option to pay by credit card. When the payment method is selected, it will bring up some form elements you can use to enter your credit card information. With the test gateway module, use the card number 4111111111111111 and any valid expiration date and three digit CVV number to test successful transactions. To test a failed transaction, use the valid expiration date and CVV number with the card number 0000000000000000.
You can now test to see if your Workflow-ng configuration will operate as expected. This may include updating the order status and performing actions like role promotions, stock adjustments, file download grants, etc.
Testing CC Payments in Order Administration
When an administrator with permissions browses to an order's view page through Administer > Store administration > Orders, there will be a button labeled Process card in the payment order pane:
Clicking this will take the administrator to a credit card terminal form for the order. This form displays the order total and fields for credit card information. Unless you are operating in debug mode, these fields will show any pre-existing CC data in a truncated form. You will have to verify the amount you want to charge and fill in the CC data before submitting the form to capture the funds. The success or failure of the charge should be reflected in the order comments.
Starting with Ubercart 1.6, this form will also allow administrators to perform any of the following transaction types if supported by the payment gateway module:
- Authorization only - the funds are merely reserved on the card but not captured to the merchant's account.
- Prior-authorization capture - funds that were previously authorized may be captured.
- Charge - authorize and capture the funds at the same time.
- Reference transaction - card data stored on the payment gateway's server may be charged again.
When the time comes, you can go back to the payment method settings form and select your actual payment gateway. Most gateways allow you to run transactions in a test mode before you run live transactions. We highly recommend you do this prior to opening to ensure the connection with the payment gateway is being executed properly. This might require some typical server configuration to enable SimpleXML, cURL, or SOAP support in PHP.
If you're going to accept credit card information on your site, you should be protecting those pages with HTTPS. To do this, you will most likely have to purchase an SSL certificate and/or dedicated IP Address from your web host. That's somewhat out of the scope of this tutorial, but just know that this will be an additional business expense you should take into consideration. To add HTTPS support to your Drupal site, you should use the Secure Pages module with the settings discussed in this FAQ.