Disable shipping address option in PayPal Express Checkout

For others looking for this, because PayPals documentation is so GREAT (cough, cough).

NO web experience profile REQUIRED!

Using REST API V2 with Javascript/JQuery and turning "Ship To" off for an ORDER, here is the correct code example:

    createOrder: function(data, actions) {
        $('#paypalmsg').html('<b>' + 'WAITING ON AUTHORIZATION TO RETURN...' + '</b>');
        $('#chkoutmsg').hide()
        return actions.order.create({
            purchase_units: [{
                description: 'GnG Order',
                amount: {
                    value: cartTotal
                }
            }],
            application_context: {
              shipping_preference: 'NO_SHIPPING'
            }

        });
    },

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();
$inputFields->setAllowNote(true)
    ->setNoShipping(1) // Important step
    ->setAddressOverride(0);

$webProfile = new WebProfile();
$webProfile->setName(uniqid())
    ->setInputFields($inputFields)
    ->setTemporary(true);

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

$payment = new Payment();

$payment->setPayer($payer);
$payment->setIntent($intent);
$payment->setRedirectUrls($redirectUrls)
$payment->setTransactions(array($transaction));
$payment->setExperienceProfileId($createProfile->getId()); // Important step.

$payment->create($apiContext);

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: https://github.com/paypal/PayPal-PHP-SDK/tree/master/lib/PayPal/Api


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:

https://developer.paypal.com/docs/nvp-soap-api/nvp/

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:

no_shipping

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.