Skip to content

Instantly share code, notes, and snippets.

@seagreen
Last active November 10, 2017 03:05
Show Gist options
  • Save seagreen/ea62bb83f4acc0d1a6b0 to your computer and use it in GitHub Desktop.
Save seagreen/ea62bb83f4acc0d1a6b0 to your computer and use it in GitHub Desktop.
PayPal REST API Payment Verification

Server verification of a mobile payment

Action: lookup a payment resource.

Specific directions: https://developer.paypal.com/docs/integration/mobile/verify-mobile-payment/

Inputs

  • Your app's Access Token (like for any other request).
  • Payment Id from the mobile client (e.g. "PAY-5YK922393D847794YKER7MUI").

Response

The response will be a Payment object type. This includes:

  • Payment State (must be "approved").
  • Transactions.

A Payment response can have multiple transactions, but there must only be one.

Transactions have an array that can hold Sale, Authorization, Capture, or Refund objects. The Transaction must have only a single Sale object.

The State of the Sale object must be "completed".

The Amount of the Transaction object must be examined to find the amount of the Transaction. This examination must take into account both the Total and the Currency of the Amount.

@seagreen
Copy link
Author

Am I missing anything? Particularly I'm not sure if there's anything the verifier of the payment needs to do to make sure the payment is actually being sent to the verifier, and not a payment between some other set of two parties that just happens to be public somehow.

EDIT: Cross posted to reddit. Also see the reddit discussion: https://www.reddit.com/r/paypal/comments/3l1k0y/spec_for_rest_api_payment_verification/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment