LightBulb1 Posted December 21, 2012 Share Posted December 21, 2012 I need to add parameters to include a telephone number option and a url option for the purchaser to enter when making a purchase with the below mobile website checkout script, i need to know how and where to add the parameters, I have tried a few options but with out success, Any help would be much appreciated, <?php require_once 'PaypalMobile.php'; require_once 'Curl.php'; $paypal = new PaypalMobile(); /** * configuration for both sandbox and live NVP */ $config['env'] = 'dev'; if ($config['env'] != 'live') { $config['paypal']['api']['user'] = ''; $config['paypal']['api']['pass'] = ''; $config['paypal']['api']['signature'] = ''; $config['paypal']['api']['endpoint'] = 'https://api-3t.paypal.com/nvp'; $config['paypal']['api']['url'] = 'https://mobile.paypal.com/wc?t='; } else { $config['paypal']['api']['user'] = ''; $config['paypal']['api']['pass'] = ''; $config['paypal']['api']['signature'] = ''; $config['paypal']['api']['endpoint'] = 'https://api-3t.paypal.com/nvp'; $config['paypal']['api']['url'] = 'https://mobile.paypal.com/wc?t='; } $config['paypal']['api']['version'] = '3.0'; /** * give our library our config */ $paypal->setApiVersion($config['paypal']['api']['version']) ->setApiUrl($config['paypal']['api']['endpoint']) ->setApiUser($config['paypal']['api']['user']) ->setApiPass($config['paypal']['api']['pass']) ->setApiSignature($config['paypal']['api']['signature']); // SetMobileChechout if (!isset($_REQUEST['token']) || $_REQUEST['token'] == '') { /** * Optional params * * $params['email'] = ''; // email to propagate the login page with * $params['phonenum'] = ''; // phone number to propagate the login page with * $params['taxamt'] = ''; // tax * $params['shippingamt'] = ''; // shipping * $params['number'] = ''; // internal item number * $params['custom'] = ''; // internal returned data * $params['invnum'] = ''; // unique invoice number * $params['addressdisplay'] = '0'; // 1|0 require address * $params['sharephonenum'] = '1'; // 1|0 return customers mobile number * $params['shiptocity'] = ''; // city to propogate address form with * $params['shiptostate'] = ''; // state to propogate the address form with * $params['shiptocountry'] = ''; // country to propogate the address form with * $params['shiptozip'] = ''; // zip to propogate the address form with */ $response = $paypal->setAmt('0.50') ->setCurrencycode('GBP') ->setDesc('Mobile Website Design') ->setReturnurl('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']) ->setCancelurl('http://') ->setMobileCheckout($params); if ($paypal->getResponseStatus()) { /** * forward user off to paypal */ header('Location: '.$config['paypal']['api']['url'].urldecode($paypal->getToken())); } else { /** * error!! */ echo 'ERROR<br /><pre>'.print_r($response,1); } // DoMobileCheckout } else { $response = $paypal->setToken($_REQUEST['token']) ->doMobileCheckoutPayment(); /** * success!! */ if ($paypal->getResponseStatus()) { /** * Returned data * * $response['email'] // buyers email address * $response['payerid'] // unique buyer id * $response['payerstatus'] // status of buyers email * $response['countrycode'] // country code * $response['business'] // buyers business name * $response['phonenum'] // buyers phone number * $response['salutation'] // buyers salutation * $response['firstname'] // buyers first name * $response['middlename'] // buyers middle name * $response['lastname'] // buyers last name * $response['suffix'] // buyers suffix * * $response['custom'] // internaly returned data * $response['invnum'] // returned unique invoice number * $response['transactionid'] // external transaction id * $response['parenttransactionid'] // used for cancels and reversals * $response['receiptid'] // external receipt id * * $response['ordertime'] // current date and time * $response['amt'] // order amount * $response['currencycode'] // currency code * $response['feeamt'] // processing fee deducted * $response['exchangerate'] // exchange rate for currency conversion * * $response['transactiontype'] // send-money * $response['paymentstatus'] // Completed, Pending, or Reversed * $response['reasoncode'] // used for reversals * * $response['name'] // buyers shipping name * $response['shiptostreet'] // buyers shipping address * $response['shiptostreet2'] // buters shipping address 2 * $response['shiptocity'] // buyers shipping city * $response['shiptostate'] // buyers shipping state * $response['shiptocountry'] // buyers shipping country * $response['shiptozip'] // buyers shipping zip * $response['shiptophonenum'] // buyers shipping phone number * $response['addressowner'] // eBay or PayPal * $response['addressstatus'] // None, Confirmed, or Unconfirmed */ } else { /** * error!! */ echo 'ERROR<br /><pre>'.print_r($response,1); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/272269-php-script-for-mobile-website-checkout/ Share on other sites More sharing options...
Christian F. Posted December 22, 2012 Share Posted December 22, 2012 Have you tried looking at their documentation? Quote Link to comment https://forums.phpfreaks.com/topic/272269-php-script-for-mobile-website-checkout/#findComment-1400876 Share on other sites More sharing options...
LightBulb1 Posted December 22, 2012 Author Share Posted December 22, 2012 There is no documentation for this script, Quote Link to comment https://forums.phpfreaks.com/topic/272269-php-script-for-mobile-website-checkout/#findComment-1400917 Share on other sites More sharing options...
phpjayx Posted December 25, 2012 Share Posted December 25, 2012 I can't help you with the exact code.... I'm actually trying to understand it myself for php.... but when I had it correctly hooked up in my old ActionScript, my code was the following which was in some old documentation.... I'm assuming if you use the same variables "night_phone_a"... etc it might work. I don't know why they split it up like that.. (area code, next three digits, then last 4) paypal.night_phone_a="200"; paypal.night_phone_b="123"; paypal.night_phone_c="6789"; Quote Link to comment https://forums.phpfreaks.com/topic/272269-php-script-for-mobile-website-checkout/#findComment-1401199 Share on other sites More sharing options...
Christian F. Posted December 25, 2012 Share Posted December 25, 2012 http://www.google.no/search?client=opera&q=paypal+mobile+api+documentation&sourceid=opera&ie=utf-8&oe=utf-8&channel=suggest <- I found lots of information/documentation on the mobile API. Including a PDF (second hit) which seems quite interesting. Also, if you indeed cannot find any documentation on how to do what you want to, you need to actually study the code itself. Something I, personally, would have done anyway. That will help to ensure that you understand what it does, how it works, and (most importantly) what it doesn't do. Quote Link to comment https://forums.phpfreaks.com/topic/272269-php-script-for-mobile-website-checkout/#findComment-1401210 Share on other sites More sharing options...
LightBulb1 Posted December 26, 2012 Author Share Posted December 26, 2012 Christian F. That API scipt that you indicate is not the script that i am using, I did try that script initially but could not get it to work, for dome reason on clicking the buy now button i just got a blank lightbox screen, phpjayx any idea as to where about in my code i would add those lines ? Quote Link to comment https://forums.phpfreaks.com/topic/272269-php-script-for-mobile-website-checkout/#findComment-1401333 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.