How Getting a Payment Actually Works in Square
GET /v2/payments/{paymentId} returns the payment's status (such as APPROVED, COMPLETED, CANCELED, or FAILED), amount, and timestamps for a specific payment by its ID.
Real API Details
A payment isn't required to originate from an order -- Square supports charging a payment entirely on its own, so the response's order_id field can come back null for payments that were never tied to an Orders API order in the first place.
Practical Considerations
Code that assumes every payment has an associated order will break on these order-less payments -- checking for a null order_id before trying to look up "its" order avoids that failure.
