skip to Main Content

I’m using the PayPal REST API to create and process orders of a software product. Even though we don’t ship the product, we use the purchase_units/0/shipping data to compute tax after the order has been placed by pulling it from the /v2/checkout/orders/ endpoint.

This has worked for hundreds of orders with no problem but recently an order came in where the shipping object was null.
Is that supposed to be possible? And if so, what is the correct way to pull the order’s country of origin in order to compute the tax?

2

Answers


  1. If nothing tangible is being shipped, you don’t need a shipping address as part of the transaction. Best not even collect one and set the item category as DIGITAL_GOODS for tracking purposes.

    {
      "intent": "CAPTURE",
      "purchase_units": [
        {
          "amount": {
            "currency_code": "USD",
            "value": "10",
            "breakdown": {
              "item_total": {
                "currency_code": "USD",
                "value": "10"
              }
            }
          },
          "items": [
            {
              "category": "DIGITAL_GOODS",
              "name": "Name of Item #1 (can be viewed in the upper-right dropdown during payment approval)",
              "description": "Optional description; item details will also be in the completed paypal.com transaction view",
              "unit_amount": {
                "currency_code": "USD",
                "value": "10"
              },
              "quantity": "1"
            }
          ]
        }
      ],
      "payment_method": {
        "paypal" : {
          "shippig_preference":"NO_SHIPPING" 
        }
      }
    }
    

    The billing country of the payer is returned at

    payment_source.paypal.address.country_code
    
    Login or Signup to reply.
  2. Trying to comment but that link is not working!

    Preston how do I disable shipping if the payment is made via PayPal Standard Checkout on my website but the user pays by credit card not by their PayPal account?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search