+ Reply to Thread
Results 1 to 4 of 4

Thread: Help with PayPal button code...

  1. #1
    componentwarehouse's Avatar
    componentwarehouse is offline x10 Lieutenant componentwarehouse is an unknown quantity at this point
    Join Date
    Sep 2007
    Posts
    276

    Help with PayPal button code...

    Hi

    I am trying to put an affiliate system into my website, and I have found one that works through the PayPal button script, but Ive no idea where to put the code it gives. Can anyone help?

    PayPal button code (current):

    Code:
     
    <?php
    $url = "https://www.paypal.com/cgi-bin/webscr";
    $tax_total = $db->f("order_tax") + $db->f("order_shipping_tax");
    $discount_total = $db->f("coupon_discount") + $db->f("order_discount");
    $post_variables = Array(
    "cmd" => "_xclick",
    "upload" => "1",
    "business" => PAYPAL_EMAIL,
    "receiver_email" => PAYPAL_EMAIL,
    "item_name" => $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_NUMBER').": ". $db->f("order_id"),
    "order_id" => $db->f("order_id"),
    "invoice" => $db->f("order_number"),
    "amount" => round( $db->f("order_subtotal")+$tax_total-$discount_total, 2),
    "shipping" => sprintf("%.2f", $db->f("order_shipping")),
    "currency_code" => $_SESSION['vendor_currency'],"first_name" => $dbbt->f('first_name'),
    "last_name" => $dbbt->f('last_name'),
    "address_street" => $dbbt->f('address_1'),
    "address_zip" => $dbbt->f('zip'),
    "address_city" => $dbbt->f('city'),
    "address_state" => $dbbt->f('state'),
    "address_country" => $dbbt->f('country'),
    "image_url" => $vendor_image_url,
    "return" => SECUREURL ."index.php?option=com_virtuemart&page=checkout.result&order_id=".$db->f("order_id"),
    "notify_url" => SECUREURL ."****************************.php",
    "cancel_return" => SECUREURL ."index.php",
    "undefined_quantity" => "0",
    "test_ipn" => PAYPAL_DEBUG,
    "pal" => "NRUBJXESJTY24",
    "no_shipping" => "1",
    "no_note" => "1"
    );
    if( $page == "*********.**********" ) {
    $query_string = "?";
    foreach( $post_variables as $name => $value ) {
    $query_string .= $name. "=" . urlencode($value) ."&";
    }
    vmRedirect( $url . $query_string );
    } else {
    echo '<form action="'.$url.'" method="post" target="_blank">';
    echo '<input type="image" name="submit" src="http://images.paypal.com/images/x-click-but6.gif" border="0" alt="Make payments with PayPal, it is fast, free, and secure!" />';
    foreach( $post_variables as $name => $value ) {
    echo '<input type="hidden" name="'.$name.'" value="'.$value.'" />';
    }
    }
    ?>
    And I need to put this code into the PayPal button code somewhere:

    Code:
     
    <input type="hidden" name="notify_url" value=http://affiliate.component-warehouse...**************>
    <input type="hidden" name="custom" value="1" id="xp_pp_custom">
    <script src="http://affiliate.component-warehouse.co.uk/************" type="text/javascript"></script>
    <script type="text/javascript"><!--
    sale();
    --></script>
    It does give an example, but the code they give in the example looks nothing like my code. Can anyone help?

    Thanks
    Alex


  2. #2
    VPmase's Avatar
    VPmase is offline x10 Elder VPmase is an unknown quantity at this point
    Join Date
    Nov 2007
    Location
    Dixon, IL, USA
    Posts
    914

    Re: Help with PayPal button code...

    You put the PHP at the top of your page (the <?PHP through ?>)
    Then you put the second code where you want the button.
    Last edited by VPmase; 06-15-2008 at 12:15 PM.

  3. #3
    phpasks is offline x10 Sophmore phpasks is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    145

    Re: Help with PayPal button code...

    First PHP code part put in in your starting page
    PHP Code:
    <?php
    $url 
    "https://www.paypal.com/cgi-bin/webscr";
    $tax_total $db->f("order_tax") + $db->f("order_shipping_tax");
    $discount_total $db->f("coupon_discount") + $db->f("order_discount");
    $post_variables = Array(
    "cmd" => "_xclick",
    "upload" => "1",
    "business" => PAYPAL_EMAIL,
    "receiver_email" => PAYPAL_EMAIL,
    "item_name" => $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_NUMBER').": "$db->f("order_id"),
    "order_id" => $db->f("order_id"),
    "invoice" => $db->f("order_number"),
    "amount" => round$db->f("order_subtotal")+$tax_total-$discount_total2),
    "shipping" => sprintf("%.2f"$db->f("order_shipping")),
    "currency_code" => $_SESSION['vendor_currency'],"first_name" => $dbbt->f('first_name'),
    "last_name" => $dbbt->f('last_name'),
    "address_street" => $dbbt->f('address_1'),
    "address_zip" => $dbbt->f('zip'),
    "address_city" => $dbbt->f('city'),
    "address_state" => $dbbt->f('state'),
    "address_country" => $dbbt->f('country'),
    "image_url" => $vendor_image_url,
    "return" => SECUREURL ."index.php?option=com_virtuemart&page=checkout.result&order_id=".$db->f("order_id"),
    "notify_url" => SECUREURL ."****************************.php",
    "cancel_return" => SECUREURL ."index.php",
    "undefined_quantity" => "0",
    "test_ipn" => PAYPAL_DEBUG,
    "pal" => "NRUBJXESJTY24",
    "no_shipping" => "1",
    "no_note" => "1"
    );
    ?>
    Second portion put your button code
    where will you display button, there is put below code
    PHP Code:
    <?php
    if( $page == "*********.**********" ) {
        
    $query_string "?";
        foreach( 
    $post_variables as $name => $value ) {
        
    $query_string .= $name"=" urlencode($value) ."&";
        }
        
    vmRedirect$url $query_string );
    } else {
        echo 
    '<form action="'.$url.'" method="post" target="_blank">';
        echo 
    '<input type="image" name="submit" src="http://images.paypal.com/images/x-click-but6.gif" border="0" alt="Make payments with PayPal, it is fast, free, and secure!" />';
        foreach( 
    $post_variables as $name => $value ) {
        echo 
    '<input type="hidden" name="'.$name.'" value="'.$value.'" />';
        }
    }
    ?>
    Now done your paypal button.
    Asif Khalyani
    http://www.phpasks.com

  4. #4
    componentwarehouse's Avatar
    componentwarehouse is offline x10 Lieutenant componentwarehouse is an unknown quantity at this point
    Join Date
    Sep 2007
    Posts
    276

    Re: Help with PayPal button code...

    OK, thanks, I will try those.

    Alex


+ Reply to Thread

Similar Threads

  1. Hybrid's HTML Lessons
    By Hybrid in forum Tutorials
    Replies: 18
    Last Post: 11-28-2009, 02:12 PM
  2. How do you add paypal donate button into...
    By intertec in forum Scripts & 3rd Party Apps
    Replies: 2
    Last Post: 05-13-2008, 01:42 AM
  3. NoPayPal
    By AdView in forum Computers & Technology
    Replies: 10
    Last Post: 05-01-2008, 01:45 AM
  4. Paypal won't let me login to my forum.
    By crypticlogic in forum Free Hosting
    Replies: 2
    Last Post: 02-02-2008, 02:10 PM
  5. BB Code Guide
    By Jober68 in forum Tutorials
    Replies: 1
    Last Post: 01-10-2008, 05:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers