PayPal& PHP - 不设运费

时间:2016-10-07 23:33:48

标签: php paypal

我正在使用他们的REST API使用PayPal创建付款。

我已经设置好所有工作但是当我创建一个WebProfile并调用 .... LocationManager myManager; MyLocListener loc; loc = new MyLocListener(); myManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { // TODO: Consider calling // ActivityCompat#requestPermissions // here to request the missing permissions, and then overriding // public void onRequestPermissionsResult(int requestCode, String[] permissions, // int[] grantResults) // to handle the case where the user grants the permission. See the documentation // for ActivityCompat#requestPermissions for more details. return; } myManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, loc); } public class MyLocListener implements LocationListener { @Override public void onLocationChanged(Location location) { if(location != null) { // it logs after 20-25 s Log.d("Latitude :", "" + location.getLatitude()); Log.d("Latitude :", "" + location.getLongitude()); } } @Override public void onProviderEnabled(String provider) { } @Override public void onProviderDisabled(String provider) { } @Override public void onStatusChanged(String provider, int status, Bundle extras) { } } 时,没有任何变化:

PayPal

我的代码:

setNoShipping(1)

根据this post on StackOverflow,这是不可能的,但1年后仍然的情况呢?

1 个答案:

答案 0 :(得分:5)

我遇到了同样的问题,但经过一些研究和许多尝试&错误我让它工作。

您必须“创建”个人资料并将其ID添加到付款。

[...]
$webProfileId = $webProfile->create($apiContext)->getId();

$payment = new Payment();
$payment->setExperienceProfileId($webProfileId);