magentopaypalmagento2magento-rest-api

Paypal rest api get order details for an order palced with nvp api


I have a Magento2 shop with default checkout module that is placing orders using nvp api. I need to later get the order from paypal and do some action based on its status but from the rest api ( /v2/checkout/orders/{id}) i only get results for orders created with the same rest api, not the ones that are placed during checkout (with nvp api).

I have configured a sandbox account on paypal and the business account that is used for nvp api calls have access to the app created in paypal for rest.

Is this mix of api calls allowed at paypal? Or it might be a problem with the paypal sandbox configuration?

Thanks


Solution

  • You wouldn't use the v2/orders API for this, as orders are only used for creating transactions, not referencing them after the fact.

    For later referencing completed transactions you would use the v2/payments API, particularly a 'get' for a completed capture. Here is the documentation.

    Whether this works for transactions made with the NVP API is not something I've tested; if not, you would need the NVP GetTransactionDetails.