Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6557885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:07:50+00:00 2026-05-25T13:07:50+00:00

I am looking to use use paypals Website Payments Pro Hosted Solution so we

  • 0

I am looking to use use paypals Website Payments Pro Hosted Solution so we can accept payments through paypal without our users feeling like they are leaving the site and without us having to be PCI compliant.

We are wanting this to work in this format:

  • user hits buy page for an item and selects quantity and hits buy now button
  • AJAX request is sent to server to validate quantity/calculate total etc
  • AJAX request returns url for iframe
  • Iframe is populated with the page, then once it has finished loading the iframe is shown
  • User fills in credit card details and paypal completes the transaction
  • The success page which paypal redirects the iframe to calls some javascript in the parent page to redirect to another url.

So,
I have the quantity select page,
I know how to send the data to the server and validate quantity/calculate total

What I don’t know how to do is from this point send the request to paypal to get the url for the iframe.

What I have tried doing (as a very basic standalone example) is:

<?php

class paypal {

    private $APIuser;
    private $APIpass;
    private $APIsign;
    private $APIvers = '74.0';  
    private $APIaddr = 'https://api-3t.sandbox.paypal.com/nvp';
    private $post_params = array();

    function __construct($APIuser, $APIpass, $APIsign){
        $this->APIuser = $APIuser;
        $this->APIpass = $APIpass;
        $this->APIsign = $APIsign;
    }

    function param($name, $value = null){
        $this->post_params[$name] = $value;
        return $this;
    }

    function getUrl(){

        $post = $this->post_params;
        $post['pwd']        = $this->APIpass;
        $post['user']       = $this->APIuser;
        $post['method']     = 'BMCreateButton';
        $post['version']    = $this->APIvers;
        $post['signature']  = $this->APIsign;
        $post['buttoncode'] = 'CLEARTEXT';
        $post['buttontype'] = 'PAYMENT';

        $post_string = '?';
        foreach($post as $k => $v)
            $post_string .= $k.'='.urlencode($v).'&';

        $post_string = substr($post_string, 0, -1);

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $this->APIaddr.$post_string);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        $out = curl_exec($ch);
        curl_close($ch);

        $out = explode('&', $out);
        $final = array();
        foreach($out as $k => &$v){
            $v = explode('=', $v);
            $final[$v[0]] = urldecode($v[1]);
        }
        return $final;
    }
}

//mock variables
$price = 10.00;
$APIu  = 'xxxxxxxxxx';
$APIp  = 'xxxxxxxxxx';
$APIs  = 'xxxxxxxxxx';  


$paypal = new paypal($APIu, $APIp, $APIs);
$paypal->param('L_BUTTONVAR0=subtotal', $price*$_GET['quantity']);
$paypal->param('L_BUTTONVAR1=template', 'templateD');
$resp = $paypal->getUrl();
?>
<iframe width="100%" height=100%" src="<?php echo $resp['EMAILLINK']; ?>"></iframe>

Which at first seems to work fine, until you enter your test buyers credit card details and get hit with

Please return to the payment page and correct the address.

What am I doing wrong/ what do I need to make this work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T13:07:51+00:00Added an answer on May 25, 2026 at 1:07 pm

    Actually, try the following API call and let me know if this works for you:

    METHOD=BMCreateButton&
    BUTTONTYPE=PAYMENT&
    BUTTONCODE=TOKEN&
    L_BUTTONVAR0=subtotal=11&
    L_BUTTONVAR1=tax=2&
    L_BUTTONVAR2=shipping=3&
    L_BUTTONVAR3=handling=4&
    L_BUTTONVAR4=template=templateC

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently using PayPal's Website Payments Standard to accept credit cards on my
I'm looking for a hosted payment solution that can be made to work almost
We are looking to use the MVC Framework in our SP Application. This is
I've been looking through paypal modules for D6 and I'm a little confused. I
I am looking to use Jersey without the need of installing an application server
I'm looking to use markdown in my website, and I'd like the editor (or
I am looking for a subscription solution in my app where the user can
Im looking to use a document database such as MongoDB but looking through the
I'd like to integrate paypal using Website Payments Standard. I have 2 needs. First,
I am looking to use a PHP library for uploading pictures to a web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.