php – Disable shipping address option in PayPal Express Checkout-ThrowExceptions

Exception or error:

Working with the PayPal API and using the Name-Value Pair Interface PHP source codes from SDKs and Downloads: Simplify Integrations with Downloads and SDKs.

My question is similar to “Removing (or prefilling) the address details for PayPal Express Checkout” but I don’t want shipping cost/address or anything related about shipping at all.

I keep all shipping details on my system (even sometimes shipping doesn’t even apply and there is no charge for it) and I just want user to pay through PayPal without shipping address and shipping cost.

How can I disable shipping part of checkout?

How to solve:

If you’re using the newer API, you could also pass NOSHIPPING=1 (not no_shipping)

Further details about all possible parameters to the SetExpressCheckout here:

Or lookup for Payment experience in new REST API


Hey Ergec, just pass along the no_shipping parameter with a value of 1.

From PayPal’s documentation:


Do not prompt payers for shipping address. Allowable values:
0 – prompt for an address, but do not require one
1 – do not prompt for an address
2 – prompt for an address, and require one
The default is 0.


The current right answer is depracated. To fix the issue in new API we should create Payment web experience profile resource with needed parameters and attach it to request Payment .

Example in PHP:

/** Note: Define some variables yourself. */

$inputFields = new InputFields();
    ->setNoShipping(1) // Important step

$webProfile = new WebProfile();

$createProfile = $webProfile->create($apiContext);

$payment = new Payment();

$payment->setExperienceProfileId($createProfile->getId()); // Important step.


if ($payment->getState() === "created") {
    $approvalLink = $payment->getApprovalLink()

    header("Location: $approvalLink"); // Redirects user to PayPal page.

Note: You can find all above used classes by link:


To solve for this from current (2019) web client .JS, add the application_context block to the request body.

Below is an example for createSubscription() call; and I’m thinking this will work with createOrder() as well

          createSubscription: function (data, actions) {

              return actions.subscription.create({

                  'plan_id'            : 'P-123',
                  'application_context': {
                      'shipping_preference': 'NO_SHIPPING'

          onApprove: function (data, actions) {

              // ...

Thanks to the example code here:

Here’s where the field enums are listed:


Create a web profile based on the example found in the API: CreateWebProfile.php.

$createProfileResponse = require  __DIR__ . '/CreateWebProfile.php';
$payment = new Payment(); 

File path: paypal/rest-api-sdk-php/sample/payment-experience/CreateWebProfile.php


@Ergec : I tried this:

$nvpstr = "&ADDRESSOVERRIDE=1".$shiptoAddress."&L_NAME0=".$L_NAME0."&L_NAME1=".$L_NAME1."&L_AMT0=".$L_AMT0."&L_AMT1=".$L_AMT1."&L_QTY0=".$L_QTY0."&L_QTY1=".$L_QTY1."&MAXAMT=".(string)$maxamt."&ITEMAMT=".(string)$itemamt."&AMT=".$itemamt."&ReturnUrl=".$returnURL."&CANCELURL=".$cancelURL."&CURRENCYCODE=".$currencyCodeType;

It works. Here we can also use shipping address even though we are not charging any amount.

Leave a Reply

Your email address will not be published. Required fields are marked *