开发者

integration of paypal on drupal site

hi every on I have created paypal integration while registering i.e. paid registration. my code is following in module

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);
                            }
             }
}

and for success return page

function imagemenu_menu()
{
    $items['imagemenu'] = array(
    'title' => 'Ad开发者_StackOverflowd 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);
}

here every thing is working fine but does not display data returned from paypal.

any help will be appriciated Thanks


Why not just use the existing PayPal module for Drupal? You're re-inventing the wheel here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜