当前位置: 首页>>代码示例>>PHP>>正文


PHP PayPal::CallbackResponse方法代码示例

本文整理汇总了PHP中PayPal::CallbackResponse方法的典型用法代码示例。如果您正苦于以下问题:PHP PayPal::CallbackResponse方法的具体用法?PHP PayPal::CallbackResponse怎么用?PHP PayPal::CallbackResponse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PayPal的用法示例。


在下文中一共展示了PayPal::CallbackResponse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isset

$shipping_country_code = isset($_POST['SHIPTOCOUNTRY']) ? $_POST['SHIPTOCOUNTRY'] : '';
// Here, we may setup static shipping and tax options, or we could hit a 3rd party
// web service API (eg. UPS, FedEx, USPS) to gather rates in real-time.
//
//
//
// Now we can generate a response for PayPal based on our new shipping values we got back from our carrier API.
$CBFields = array();
// Gather shipping options.  If you're pulling rates from a carrier API you would be looping through
// their response in order to populate $ShippingOptions.  Here, we're doing it manually for sample purposes.
$ShippingOptions = array();
$Option = array('l_shippingoptionisdefault' => 'true', 'l_shippingoptionname' => 'UPS', 'l_shipingpoptionlabel' => 'UPS', 'l_shippingoptionamount' => '5.00', 'l_taxamt' => '0.00', 'l_insuranceamount' => '1.00');
array_push($ShippingOptions, $Option);
$Option = array('l_shippingoptionisdefault' => 'false', 'l_shippingoptionname' => 'UPS', 'l_shipingpoptionlabel' => 'UPS', 'l_shippingoptionamount' => '20.00', 'l_taxamt' => '0.00', 'l_insuranceamount' => '1.00');
array_push($ShippingOptions, $Option);
$callback_data_request_array = array('CBFields' => $CBFields, 'ShippingOptions' => $ShippingOptions);
// Now we pass the data into the class library which will return an NVP string
$callback_data_response = $paypal->CallbackResponse($callback_data_request_array);
// Gather the request data that PayPal sent us in case we need to log it somehow to see what's available.
$request_content = '';
foreach ($_POST as $var => $val) {
    $request_content .= '&' . $var . '=' . urldecode($val);
}
// Pass the shipping/tax data into the library to obtain an NVP string that we'll
// simply output as a web service response back to PayPal.
$response_content_body = '';
$response_content = $paypal->NVPToArray($callback_data_response);
foreach ($response_content as $var => $val) {
    $response_content_body .= $var . ': ' . urldecode($val) . '<br />';
}
echo $callback_data_response;
开发者ID:Joaquinsemp,项目名称:patriestausado,代码行数:31,代码来源:paypal.nvp.callback.php


注:本文中的PayPal::CallbackResponse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。