Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove shipping option in PayPal REST API

Tags:

json

paypal

I have a problem and cannot solve it for a quite while. I am implementing the PayPal express checkout and cannot remove the shipping since website is selling marketing and don't need shipping options. I have this JSON with the configuration and from the documentation and some other posts I should implement the "no_shipping" attribute to value of 1. But I cannot find where should I place this line. Or maybe this is done differently. Appreciate any kind of help.

$_SESSION['expressCheckoutPaymentData'] = '{
                                  "transactions":[
                                     {
                                        "amount":{
                                           "currency":"USD",
                                           "total":"320",
                                           "details":{

                                              "subtotal":"300"

                                           }
                                        },
                                        "description":"creating a payment",
                                        "item_list":{
                                           "items":[
                                              {
                                                 "name":"Camera",
                                                 "quantity":"1",
                                                 "price":"300",
                                                 "sku":"1",
                                                 "currency":"USD"
                                              }
                                           ]
                                        }
                                     }
                                  ],
                                  "payer":{
                                     "payment_method":"paypal"
                                  },
                                  "intent":"sale",
                                  "redirect_urls":{
                                     "cancel_url":"'.$cancelUrl.'",
                                     "return_url":"'.$placeOrderUrl.'"
                                  }
                               }';
like image 388
R4ziel Avatar asked Nov 08 '22 07:11

R4ziel


1 Answers

Try this:

$_SESSION['expressCheckoutPaymentData'] = '{
    "payment": {
        "transactions": [{
            "amount": {
                "currency": "USD",
                "total": "320",
                "details": {

                    "subtotal": "300"

                }
            },
            "description": "creating a payment",
            "item_list": {
                "items": [{
                    "name": "Camera",
                    "quantity": "1",
                    "price": "300",
                    "sku": "1",
                    "currency": "USD"
                }]
            }
        }]
    },
    "experience": {
        "input_fields": {
            "no_shipping": 1
        }
    }
}';
like image 68
Paul Chris Jones Avatar answered Nov 15 '22 06:11

Paul Chris Jones