在drupal网站上整合paypal

时间:2011-01-14 05:27:39

标签: drupal

你好 我在注册即付费注册时创建了paypal集成。 我的代码在模块中跟随

function paidregistration_user($op, &$edit, &$account, $category = NULL){

                switch ($op) {
        case 'validate': {

                                $paypal = array();
                                $paypal['cmd'] = '_xclick';
                                $paypal['business'] = 'sachin.acetechpvtltd@gmail.com';  // doing this here prevents email harvesting
                                $paypal['page_style'] = 'Primary';
                                $paypal['bn'] = 'PP-DonationsBF';
                                $paypal['item_name'] = 'Donation';
                                $paypal['amount'] = '200';
                                $paypal['currency_code'] = 'USD';
                                $paypal['no_shipping'] = '1';
                                $paypal['tax'] = '0';
                                $paypal['lc'] = 'US';
                                $paypal['rm'] = '1';
                                $paypal['return'] = 'http://localhost/drupaldemo/pay';
                                $paypal['cancel_return'] = 'http://localhost/drupaldemo/user/register';

                                // Append the Paypal data to the $form_values['submitted_tree']
                                $data = array_merge($edit, $paypal);

                                // Put the data in a query string
                                $query = http_build_query($data, '', '&');

                                // Set the URL to Paypal's processing site and append the query string
                                $url = 'https://www.sandbox.paypal.com/cgi-bin/webscr?' .$query;
                                drupal_goto($url);
                                print_r($_REQUEST);
                                // Set the webform's confirmation page to Paypal
                                //$node->webform['confirmation'] = $url;

             //drupal_goto();exit;
                             }
            case 'insert' :{
                            print_r($_REQUEST);
                            }
             }
}

和成功返回页面

function imagemenu_menu()
{
    $items['imagemenu'] = array(
    'title' => 'Add Image',
    'type' => MENU_NORMAL_ITEM,
    );

    $items['pay'] = array(
        'title' => 'Add Image',
        'access arguments' => array('all'),
        'page callback' => 'pay',
        'type' => MENU_NORMAL_ITEM,
    );

return $items;
}





function imagemenu_perm()
{
    return array('all');
}

function pay()
{
    print_r($_REQUEST);
}

这里的每件事情都运行正常,但不会显示从paypal返回的数据。

任何帮助都会得到满足 感谢

1 个答案:

答案 0 :(得分:0)

为什么不将现有的PayPal module用于Drupal?你在这里重新发明轮子。