Paypal Shipping Dropdown默认方法

时间:2013-03-13 16:37:12

标签: html button paypal default shipping

我的PayPal个人资料运费计算器,标准运费和取件中设置了2个运费选项。我希望Standard成为我的“立即购买”按钮的默认值。在买家结账的下拉菜单中,默认为Pickup(我有$ 0选项)。我找不到如何更改它,以便标准出现为默认值。 (“Pickup”将是例外,应该有意图选择。)是否有我可以放入按钮代码的HTML行,或者我可以用来更改默认送货方式的按钮“变量”,以便它不仅仅是跳上最便宜的选择?

1 个答案:

答案 0 :(得分:1)

如果您使用网站付款标准立即购买和添加到购物车按钮,则无法执行此操作。它默认为最便宜的选项。您可以设置默认传送的唯一方法是使用Instant Update Callback API。这可用于使用购物车上传方法或快速结账设置默认送货。您可以在第55页上看到有关API here以及开发人员指南here的信息。以下是有时用于测试的PHP回调脚本的简单示例,如果它可以帮助您更好地理解它。我不确定您将用什么语言编写脚本代码。

<?php

foreach ($_POST as $key => $value) {
$value = urlencode(stripslashes($value));
$req = "&$key=$value";
}

// Populate variables into local variables
$method = $_POST['METHOD'];
$version = $_POST['CALLBACKVERSION'];
$token = $_POST['TOKEN'];
$currencycode = $_POST['CURRENCYCODE'];
$localecode = $_POST['LOCALECODE'];
$street = $_POST['SHIPTOSTREET'];
$street2 = $_POST['SHIPTOSTREET2'];
$city = $_POST['SHIPTOCITY'];
$state = $_POST['SHIPTOSTATE'];
$country = $_POST['SHIPTOCOUNTRY'];
$zip = $_POST['SHIPTOZIP'];

// Setting shipping based on country first
// Then setting shipping based on state if the country is U.S.
// Echo response back to PayPal
if ($country == "US"){
    if ($state == "NE"){
    echo "METHOD=CallbackResponse&OFFERINSURANCEOPTION=true&L_SHIPPINGOPTIONNAME0=UPS&L_SHIPPINGOPTIONLABEL0=Ground&L_SHIPPINGOPTIONAMOUNT0=3.00&L_TAXAMT0=1.00&L_INSURANCEAMOUNT0=9.00&L_SHIPPINGOPTIONISDEFAULT0=true";
    }elseif ($state == "KS"){ 
    echo "METHOD=CallbackResponse&OFFERINSURANCEOPTION=true&L_SHIPPINGOPTIONNAME0=UPS&L_SHIPPINGOPTIONLABEL0=Ground&L_SHIPPINGOPTIONAMOUNT0=6.00&L_TAXAMT0=12.00&L_INSURANCEAMOUNT0=81.00&L_SHIPPINGOPTIONISDEFAULT0=true";
    }else{
    echo "METHOD=CallbackResponse&NO_SHIPPING_OPTION_DETAILS=1&CALLBACKVERSION=61";
    }
}elseif ($country == "CA"){
    echo "METHOD=CallbackResponse&NO_SHIPPING_OPTION_DETAILS=1&CALLBACKVERSION=61";
}else{
    echo "METHOD=CallbackResponse&OFFERINSURANCEOPTION=true&L_SHIPPINGOPTIONNAME0=UPS&L_SHIPPINGOPTIONLABEL0=Ground&L_SHIPPINGOPTIONAMOUNT0=10.00&L_TAXAMT0=2.00&L_INSURANCEAMOUNT0=2.00&L_SHIPPINGOPTIONISDEFAULT0=true";
}

?>