8 replies [Last post]
giorgio79@drupal.org's picture
Offline
Joined: 02/02/2008
Juice: 280

Anyone integrated Alertpay?

It seems Drupal is already on their wishlist (http://dev.alertpay.com/forums/p/122/1486.aspx) and they have a nice php script for developers.

Could anyone give me an estimate how difficult would it be to integrate it with Ubercart (lets say for an average php programmer new to Drupal) ? Smiling

Cheers,
G

giorgio79@drupal.org's picture
Offline
Joined: 02/02/2008
Juice: 280
Re: Alertpay

Here is their sample script, any tutorials on how to convert this to Ubercart?
http://dev.alertpay.com/files/folders/php/entry29.aspx

<?php

//===============================================================================
// AlertPay Instant Payment Notification (IPN)
//===============================================================================
// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE.
//===============================================================================

// Script: AlertURL.php
// Platform: PHP

// Purpose:
// --------
// The purpose of this code is to help you to understand how to process the Instant Payment Notification
// variables for Subscription Button and integrate it in your PHP site.

// How to Use:
// -----------
// Put this code into the page which you have specified as Alert URL.
// The variables being read from the _POST object in the below code are pre-defined IPN variables and the
// the conditional blocks provide you the logical placeholders to process the IPN variables. It is your responsibility
// to write appropriate code as per your requirements.

// Developer Feedback:
// --------------
// If you have any questions about this script or any suggestions, please email to: devsupport@alertpay.com.

    // Security code variable
   

$ap_SecurityCode;

   

// Customer info variables
   
$ap_CustFirstName;
   
$ap_CustLastName;
   
$ap_CustAddress;
   
$ap_CustCity;
   
$ap_CustCountry;
   
$ap_CustZip;
   
$ap_CustEmailAddress;

   

// Common transaction variables
   
$ap_ReferenceNumber;
   
$ap_Status;
   
$ap_PurchaseType;
   
$ap_Merchant;
   
$ap_ItemName;
   
$ap_ItemCode;
   
$ap_Description;
   
$ap_Quantity;
   
$ap_Amount;
   
$ap_AdditionalCharges;
   
$ap_ShippingCharges;
   
$ap_TaxAmount;
   
$ap_DiscountAmount;
   
$ap_TotalAmount;
   
$ap_Currency;
   
$ap_Test;

   

// Custom fields
   
$ap_Apc_1;
   
$ap_Apc_2;
   
$ap_Apc_3;
   
$ap_Apc_4;
   
$ap_Apc_5;
   
$ap_Apc_6;

   

// Subscription variables
   
$ap_SubscriptionReferenceNumber;
   
$ap_TimeUnit;
   
$ap_PeriodLength;
   
$ap_PeriodCount;
   
$ap_NextRunDate;
   
$ap_TrialTimeUnit;
   
$ap_TrialPeriodLength;
   
$ap_TrialAmount;

   

// Initialize variable
   
setSecurityCodeVariable();

        if (

$ap_SecurityCode != "W2cTGHv8v6ELEflpBndaQg")
        {
           
// The Data is NOT sent by AlertPay.
            // Take appropriate action
       
}
        else
        {
            if (
$ap_Test == "1")
            {
               
// Your site is currently being integrated with AlertPay IPN for TESTING PURPOSES
                // ONLY. Don't store any information in your Production database and don't process
                // this transaction as a real order.
           
}
            else
            {
               
// Initialize variables
               
setCustomerInfoVariables();
               
setCommonTransactionVariables();

               

// Initialize the custom field variables.
               
setCustomFields();

               

// If the transaction is subscription-based (recurring payment), initialize the
                // Subscription variables too.
               
if ($ap_PurchaseType == "Subscription")
                {
                   
setSubscriptionVariables();
                }

                if (

strlen($ap_ReferenceNumber) == 0 && $ap_TrialAmount != "0")
                {
                   
// Invalid reference number. The reference number is invalid because the ap_ReferenceNumber doesn't
                    // contain a value and the ap_TrialAmount is not equal to 0.
               
}
                else
                {
                    if (
$ap_Status == "Success")
                    {
                       
// Transaction is complete. It means that the amount was paid successfully.
                        // Process the order here.

                        // Process non-subscription order.
                       

if ($ap_PurchaseType != "Subscription")
                        {
                           
// NOTE: The subscription variables are not applicable here. Don't use them.
                       
}
                       
// Process the subscription order. Use ap_SubscriptionReferenceNumber to uniquely identify
                        // this particular subscription transaction.
                       
else
                        {
                           
// Check whether the trial is free or not
                           
if ($ap_TrialAmount == "0")
                            {
                               
// Process the free trial here.
                                // NOTE: The ap_ReferenceNumber is always empty for trial periods and therefore you
                                // should not use it.
                           
}
                            else
                            {
                               
// The is not a free trial and ap_TrialAmount contains some amount and the
                                // ap_ReferenceNumber contains a valid transaction reference number.
                           
}
                        }
                    }
                    else
                    {
                       
// Transaction cancelled means seller explicitely cancelled the subscription or AlertPay                                
                        // cancelled or it was cancelled since buyer didnt have enough money after resheduling after two times.
                        // Take Action appropriately
                   
}
                }
            }
    }

   

// Security code variable
   
function setSecurityCodeVariable()
    {
        global
$ap_SecurityCode = $_POST['ap_securitycode'];
    }
   
   
// Customer info variables
   
function setCustomerInfoVariables()
    {
        global
$ap_CustFirstName =$_POST['ap_custfirstname'];
        global
$ap_CustLastName = $_POST['ap_custlastname'];
        global
$ap_CustAddress = $_POST['ap_custaddress'];
        global
$ap_CustCity = $_POST['ap_custcity'];
        global
$ap_CustCountry = $_POST['ap_custcountry'];
        global
$ap_CustZip = $_POST['ap_custzip'];
        global
$ap_CustEmailAddress = $_POST['ap_custemailaddress'];
        global
$ap_PurchaseType = $_POST['ap_purchasetype'];
        global
$ap_Merchant = $_POST['ap_merchant'];
    }
   
   
// Common transaction variables
   
function setCommonTransactionVariables()
    {
        global
$ap_ItemName = $_POST['ap_itemname'];
        global
$ap_Description = $_POST['ap_description'];
        global
$ap_Quantity = $_POST['ap_quantity'];
        global
$ap_Amount = $_POST['ap_amount'];
        global
$ap_AdditionalCharges=$_POST['ap_additionalcharges'];
        global
$ap_ShippingCharges=$_POST['ap_shippingcharges'];
        global
$ap_TaxAmount=$_POST['ap_taxamount'];
        global
$ap_DiscountAmount=$_POST['ap_discountamount'];
        global
$ap_TotalAmount = $_POST['ap_totalamount'];
        global
$ap_Currency = $_POST['ap_currency'];
        global
$ap_ReferenceNumber = $_POST['ap_referencenumber'];
        global
$ap_Status = $_POST['ap_status'];
        global
$ap_ItemCode = $_POST['ap_itemcode'];
        global
$ap_Test = $_POST['ap_test'];
    }
   
   
// Subscription variables
   
function setSubscriptionVariables()
    {
        global
$ap_SubscriptionReferenceNumber = $_POST['ap_subscriptionreferencenumber'];
        global
$ap_TimeUnit = $_POST['ap_timeunit'];
        global
$ap_PeriodLength=$_POST['ap_periodlength'];
        global
$ap_PeriodCount=$_POST['ap_periodcount'];
        global
$ap_NextRunDate=$_POST['ap_nextrundate'];
        global
$ap_TrialTimeUnit=$_POST['ap_trialtimeunit'];
        global
$ap_TrialPeriodLength=$_POST['ap_trialperiodlength'];
        global
$ap_TrialAmount=$_POST['ap_trialamount'];
    }

   

// Custom fields
   
function setCustomFields()
    {
        global
$ap_Apc_1 = $_POST['apc_1'];
        global
$ap_Apc_2 = $_POST['apc_2'];
        global
$ap_Apc_3 = $_POST['apc_3'];
        global
$ap_Apc_4 = $_POST['apc_4'];
        global
$ap_Apc_5 = $_POST['apc_5'];
        global
$ap_Apc_6 = $_POST['apc_6'];
    }

?>
kommurub's picture
Offline
Joined: 09/18/2008
Juice: 6
Are you still looking at developing this module?

I never worked with any module development in PHP/Drupal/Ubercart, but have good experience with programming (Java).

Just wondering if I can help some way in this. Are you still interested in developing this?
I am generally so busy, but will commit to pull at least an hour or two per week.

We've got the nice PHP script example, just have to find good examples for ubercart payment modules.

Alertpay branding & its pricing point of view, It's well worth developing an ubercart module for this.

Regards,
B

berny80's picture
Offline
Joined: 01/05/2009
Juice: 11
Hey i m interested too!

Hi Georgio,
I would be very interested in a module in the integration of Alertpay...i m not a developer, and i had to choose Joomla for this problem...and i prefer so much Drupal for all the rest of the website development, an help for that would be so cool!
If anyone knows how to do that, contact me please! Smiling
Bye

blisstering's picture
Offline
Joined: 03/11/2010
Juice: 19
AlertPay Integration for Drupal | Blisstering Solutions

We at Blisstering Solutions, are glad to inform you that we have successfully developed AlertPay Integration Module for Drupal 6. It provides a way to integrate Ubercart with AlertPay.

It allows online users to buy products using the AlertPay payment gateway. This module is integrated with the Ubercart module for eCommerce solutions in Drupal

Blisstering Solutions is an open source consulting company based in San Francisco Bay Area, specializing in custom and white/private label solutions at the convergence of Web, Voice and Mobile. Over the years, we have developed an array of cost effective solutions for various services based on open source technologies.
To know more please visit: www.blisstering.com

You can download the module here : http://www.blisstering.com/alert-pay-integration-drupal

Blisstering Solutions

cryo's picture
Offline
Joined: 01/23/2010
Juice: 10
Alertpay Module

We created a alertpay payment gateway module for a client.<
Features include:

  • simplenews newsletter - auto subscription
  • has a alertpay limit excess response
  • has a call back request form
  • You can download it here http://dwslimited.com/downloads/alertpay-gateway-module-ubercart-v2
    Visit us at Design Web Solutions Ltd www.dwslimited.com

    aneuryzma's picture
    Offline
    Joined: 07/06/2010
    Juice: 195
    Re: Alertpay

    Great thanks, your module is helping me a lot. I just get this error:

    https://deluxe-organics.com/cart/alertpay/complete
    The requested page could not be found.

    In other words, it seems that cart/alertpay/complete is not correctly handled...
    thanks

    cryo's picture
    Offline
    Joined: 01/23/2010
    Juice: 10
    Hi aneuryzma Yes the alertpay

    Hi aneuryzma
    Yes the alertpay module does work. Perhaps its your configuration.

    Cheers

    aneuryzma's picture
    Offline
    Joined: 07/06/2010
    Juice: 195
    Re: Alertpay

    ok, sorry I've a more important question..

    Alertpay offers an option to change shipping address. I really don't like this, because each country has a different shipping rate (included in the total I pass to Alertpay).

    Consequently a customer could set a country in my website, pay a low shipping rate, and then change the shipping address in Alert Pay without updating the shipping costs.

    ps. There is also a field shipping_costs in AlertPay parameters, but still Alertpay provides an option to change shipping country even if that parameter is specified. I don't get why, it is not logical.

    Is there a way to hide that option on Alertpay.com website ?
    thanks