';
}
}
else
{
echo '
Invalid parameters. Please try again!
';
}
?>
5. Once we have loaded all the order information in $orderObj, we can pass it
to PayPal and call SetMobileCheckout. In the example here, we are passing
only a few details, but you can pass all the details you want. The return URLs
have to be publicly accessible when you put this online.
// Pass on order information to PayPal
$param['AMT'] = $orderObj->total;
$param['CURRENCYCODE'] = 'USD';
$param['DESC'] = $orderObj->GetSummary(); // Order description
$baseURL = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER[
'REQUEST_URI'].'&mode=';
$param['RETURNURL']= $baseURL.'return';
$param['CANCELURL']= $baseURL.'cancel';
$param['INVNUM']= $orderObj->id;
$param['PHONENUM']= $orderObj->phone;
$param['CUSTOM']= session_id(); // Any custom data can be sent
$request = '';
foreach($param as $key=>$value)
Making Money via Mobile Devices
[ 144 ]
{
$request .= "&$key=".urlencode($value);
}
// perform the api callback for SetMobileCheckout with
// those values
$result = hash_call('SetMobileCheckout',$request);
// If we get success, redirect the user to PayPal
if(strtoupper($result['ACK']) == 'SUCCESS')
{
header('Location: '.
Pages:
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192