I can't, for the life of me, find the meanings and causes of these PayPal payment states:
created; failed; pending; canceled; expired, in_progress
from the PayPal REST API documentation.
Downloading and checking the source code of rest-api-sdk-php yields nothing as well, but instead added a new state: partially_completed
Can anyone point me to the right reference?
I need to be able to handle properly when the payment execution state is anything other than approved.
The status field is not specific to RESTful interfaces at Paypal, and the api docs in that respect are not missing anything. I use the following to reference the status fields:
Paypal Status Reference
Related
I have this question regarding 2 npm PayPal packages, what is the difference between
paypal-rest-sdk and #paypal/checkout-server-sdk ? And can you implement webhooks using #paypal/checkout-server-sdk or there is no need for webhooks for this package ?
paypal-rest-sdk
checkout-server-sdk
var paypal = require('paypal-rest-sdk');
const paypal = require('#paypal/checkout-server-sdk');
All PayPal-*-SDK for every language have been deprecated for a long time and should not be used for anything. This includes the one for node that's in npm as #paypal/paypal-rest-sdk.
The Checkout-*-SDK for every language, in npm for node as #paypal/checkout-server-sdk, implements the v2/checkout/orders API (and only that API). It can still be used if desired, although I've heard it will be deprecated soon as well. Currently all developer.paypal.com documentation only references doing direct HTTPS REST API integrations, using a client id and secret to first obtain an access_token. For node in particular, there is a full stack example in the PayPal Checkout integration guide that serves as a useful starting point, although I recommend the client side onApprove function in this approval flow since that sample includes client-side error handling of the capture response (restarting or showing an error as appropriate)
As for webhooks, they are a separate matter. There is no current SDK for them. The server-side capture API response is already sufficient for normal orders API payments so you may not need webhooks for what you're doing, but if there are specific events you're interested in listening for (such as refunds or disputes that occur on PayPal.com ) you'll need to subscribe to the event(s) you want -- either in the REST app or using webhook API calls.
What HTTP status code would be suitable for this purpose? The scenario is "I cannot let you evaluate a product because you have already done it". I was thinking about forbidden 403. Is that right?
I would use 402 Payment Required. Even though it's not widely used, I feel like it's perfect for this use case.
402 Payment Required
Reserved for future use. The original intention was that this code might be used as part of some form of digital cash or micropayment scheme, as proposed, for example, by GNU Taler, but that has not yet happened, and this code is not usually used. Google Developers API uses this status if a particular developer has exceeded the daily limit on requests. Sipgate uses this code if an account does not have sufficient funds to start a call. Shopify uses this code when the store has not paid their fees and is temporarily disabled. Stripe uses this code for failed payments where parameters were correct, for example blocked fraudulent payments.
Source
use 405 Method Not Allowed - Meaning - The request method is known by the server but has been disabled and cannot be used. For example, an API may forbid DELETE-ing a resource. The two mandatory methods, GET and HEAD, must never be disabled and should not return this error code .
I am working on integrating the PayPal REST API in my Symfony 2 web app. Currently I am struggling on implementing the controller that handles the Webhooks.
This is just a event handler, that is called by the PayPal API on different event like updates to an payment.
I configured the Webhook to consume the following events:
PAYMENT.SALE.COMPLETED
PAYMENT.SALE.DENIED
PAYMENT.SALE.PENDING
PAYMENT.SALE.REFUNDED
PAYMENT.SALE.REVERSED
Now I am trying to find out, which events will contain which data. The docs only say:
resource_type string Name of the resource contained in the resource property.
So far so good. But I was not able to find any information about what event will contain what resource_type. There are really a lot of different resource_types and I have no idea which of these are allowed/possible when dealing with the different events.
Does anyone know where to find this information, since the PayPal docu itself is not very help full in this case.
I am essentially trying to get the details of any transaction ID in my PayPal account to authenticate users I am migrating to a new authentication system.
I am using the PayPal Rest API so: http://puu.sh/gdb3T/461dde2928.png and yes I have checked everything is fine, it is infact set to live with the correct id / secret.
This isn't exactly an answer to this specific question, but I have simply fixed it by using PayPal's classic API in order to get the job done.
Kind of strange the rest API doesn't let me do this.
Were getting a lot of #INTERNAL_SERVICE_ERROR's through the rest PayPal API. To get more details about the error we have been going the PayPal Tech Support. We've been able to fix some of the issues but it is taking us a lot longer than we would like. I was wondering if there was an API call that I could make that would give me the full details of the error or DebugID?
I am not sure how you are currently consuming the API, but https://developer.paypal.com/webapps/developer/docs/api/ specs the error object which has the debug_id, the PayPal internal identifier used for correlation purposes. The error object has information link and error_details object which has the detailed reasons for the error
If you are using an sdk to consume, it is possible to get the debug_id in your logs: https://github.com/paypal/rest-api-sdk-nodejs#debugging and https://github.com/paypal/rest-api-sdk-python#create-payment show ways to do that in Python and Node.
I myself am looking for the same information. But it appears the debug ID is only so Paypal support can correlate the error to a transaction event. Technically there is no other information associated with the Debug ID.
See Receiving INTERNAL_SERVICE_ERROR REST API