Search code examples
paypalpaypal-rest-sdk

PayPal REST API - Order and Authorization Amounts


Taking the REST API out for a spin, and because my frame of reference is "classic API", specifically Express Checkout, I'm pretty much trying to "map" functionality.

Got things going, so this is more "conceptual" than technical..maybe someday this becomes a "wiki"...

Use case: payment_method:paypal

  1. payer_info (Paypal user) is only available after an execute

    • in order to successfully (re)calculate totals to account for shipping and tax (based on shipping address), is the proper way of doing this via order (not sale) thereby allowing an authorization and capture after such details become available (to merchant)?
    • in other words, we don't have the classic GetExpressCheckoutDetails so this seems to be the path(?)
  2. Based on this, and testing, can we assume the "maximum" of 115% (above order total) for the authorization call? Based on testing this seems to be true..otherwise "AUTHORIZATION_AMOUNT_LIMIT_EXCEEDED"


Update: In case you were wondering:

At this point the only thing that works so far is to authorize < 115%

The sum of the total open authorizations can’t exceed 115% or $75 (whichever is less) of the amount provided to PayPal when the order was created.

REF: https://developer.paypal.com/docs/integration/direct/create-process-order/


  1. In docs, payer object has status defined as:

    Status of the payer’s PayPal account. Currently supported with paypal payment_method only, but available for credit_card payment_method at a later date. Allowed values: VERIFIED or UNVERIFIED.

    It doesn't seem to be returned in either sale nor order.

    A secondary question therefore becomes, how do you "require" a verified PayPal user (is this now account level setting only - no API override)? See: flow_config

The other "missing" items are documented in the API release notes (e.g. fee).

Thanks!


Solution

  • Both order and authorize intent can be used to accomplish the flow (adjustments to authorization or capture) based on PayPal user info.

    1. execute - returns PayPal payer_info - e.g.

      "payer_info": {
        "email": "[email protected]",
        "first_name": "Ed",
        "last_name": "SF",
        "payer_id": "ABCDEFG",
        "shipping_address": {
          "recipient_name": "Ed SF",
          "line1": "111 Some street",
          "city": "San Francisco",
          "country_code": "US",
          "postal_code": "94111",
          "state": "CA"
        }
      }
      
    2. Based on the above info, if there are any adjustments needed (i.e. sales tax, shipping),

      • order can be authorized for the additional amount* (and subsequently captured)
      • authorization can be captured for the additional amount*

    *additional amount can’t exceed 115% or $75 (whichever is less) of the original order or authorization, otherwise, AUTHORIZATION_AMOUNT_LIMIT_EXCEEDED and CAPTURE_AMOUNT_LIMIT_EXCEEDED errors are raised respectively.

    This is displayed to the user when a capture greater than the orginal authorization is made:

    additional authorization message

    As far as I can tell, there isn't a similar message for an order (with adjusted amounts) - the additional authorization amount is displayed in the transaction details (only).