I'm using MassPay in the sandbox to pay two recipients. The MassPay response simply says "SUCCESS". I expected a "success" / "fail" outcome for each payee. What if one of the payments is unsuccessful. Does MassPay automatically reverse the successful payment so that neither get paid?
Could you point me at the API Documentation that explains how it works, I'm stuck on the request/response field documentation.
Here's some XML representing my request / response pair:
<?xml version="1.0" encoding="utf-16"?>
<MassPayReq xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MassPayRequest>
<DetailLevel />
<ReceiverType>EMAILADDRESS</ReceiverType>
<ButtonSource>PayPal_SDK</ButtonSource>
<MassPayItem>
<MassPayRequestItemType>
<ReceiverEmail>payee1#blah.co.nz</ReceiverEmail>
<Amount>
<currencyID>NZD</currencyID>
<value>330.00</value>
</Amount>
<UniqueId>XXXXXXXXXXXXXX1</UniqueId>
</MassPayRequestItemType>
<MassPayRequestItemType>
<ReceiverEmail>payee2#blah.co.nz</ReceiverEmail>
<Amount>
<currencyID>NZD</currencyID>
<value>193.80</value>
</Amount>
<UniqueId>XXXXXXXXXXXXXXXX2</UniqueId>
</MassPayRequestItemType>
</MassPayItem>
</MassPayRequest>
</MassPayReq>
<?xml version="1.0" encoding="utf-16"?>
<MassPayResponseType xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Timestamp>2014-05-08T01:44:47Z</Timestamp>
<Ack>SUCCESS</Ack>
<CorrelationID>c53adacbd0e76</CorrelationID>
<Errors />
<Version>109.0</Version>
<Build>10918103</Build>
</MassPayResponseType>
Hmm, almost midnight... I'm thinking that after I get the MassPay response, maybe I should be polling to check the status of each payment by calling the GetTransactionDetails operation passing in the UniqueId?
UPDATE: Nope, GetTransactionDetails is not the way.
Maybe try upping the Detail Level.
UPDATE: Nope, that's not the way.
It's been suggested to rely on Instant Payment Notifications (IPN) to receive the result of processing individual mass pay items.
Now, how to configure the IPN url for my sandbox merchant account since the MassPay request does not allow an IPN url to be given.
It's been suggested to rely on Instant Payment Notifications (IPN) to
receive the result of processing individual mass pay items.
That's exactly it.
MassPay is batched, the 'ACK=Success' merely means "hey, success! You've submitted the requests!".
If you need to track the outcome, use IPN.
See PayPal's new REST Payouts API. It's designed to solve numerous Mass Payments short comings.
https://developer.paypal.com/docs/integration/direct/payouts-overview/
You can use the payout API in an asynchronous mode (like MassPay batch), or choose use the synchronous mode, where you'll be limited to processing a single payout at a time - and where the API response will contain the transaction status for the payout you just requested.
Note that the new API makes it easier to POST your batch, in one call, and then GET your batch's transaction request status in a second call.
Related
I have the following flow with Paypal:
I create a payment with intent "order", and I redirect the user to Paypal's website.
Once the user returns, I execute the payment.
Then, I authorize the order.
At this point, I can still look up the payment or the order and I get expected result.
Finally, I capture the order.
After I capture the order, I can't lookup the payment with /v1/payments/payment/PAY-XYZ or retrieve the order with /v1/payments/orders/O-ABC. I get a 500 Internal Service Error.
Before you tell me to send debug id to Paypal because I stumbled upon their bug: I tried, but they are not responding. I had them on the phone, sent support requests, etc. I got no reply from them, so I have to turn to community.
After capture, I can still lookup a payment by listing payment resources. Since I store paypal's create time, I send a GET request that looks like:
/v1/payments/payment?start_time=2016-06-21T09:08:56Z&end_time=2016-06-21T09:08:58Z
Sure enough, I can get the payment object back, but that looks awfully hacky to me.
The reason why I need the entire payment object is because I need a definitive information about the status of the payment. E.g. I can stumble upon a network error when I send a capture request and I won't get capture ID, so I can't check what's going on. Or I can miss a webhook event (for any reason, e.g. bug in my code), and the payment can become refunded without me knowing, so it would be ver nice to be able to fetch a payment.
I noticed the REST API documentation here https://developer.paypal.com/docs/api/payments/#payment_get says that I should use that endpoint for incomplete payments, but I don't understand why I can't check the order, or why list payment resources works, but fetching a single payment doesn't.
Retrieving the payment used to work though, so I could look up related_resources of transactions of the response (like I can do now with listing all payments by date).
My question is: what is the recommended way to get the definitive information about a payment?
Also, if someone from Paypal is reading this, here are some debug_id's so you can perhaps look into it: 3ffa3007a7561 (result of https://api.sandbox.paypal.com/v1/payments/orders/O-3PA36862ST053572T) or 85576d66784cd (response from https://api.sandbox.paypal.com/v1/payments/payment/PAY-7N237030X85089344K5UQIKI)
This happens on both sandbox and live.
Thanks,
Dejan
We are building a new website for a take-away service and are integrating with PayPal Express (Using the NVP API). As orders are dispatched the same evening eCheck payments have been disabled.
The process we're going to follow is as below:
User places order with PayPal and when using DoExpressCheckoutPayment the action used is Authorization
The takeaway confirms the order and a DoCapture request is made setting the complete type to COMPLETE
It is my understanding that at this point, so long as the response status indicates it has COMPLETED that the funds are guaranteed. In fact, apart from very rare scenarios, it should usually be guaranteed at the point of Authorization.
Therefore I do not see the requirement for the IPN? There are no further notifications to be received with a given transaction. I could see the benefit it we were taking eChecks but when that's disabled does it offer anything?
IPN is an optional "messaging service". Your checkout/purchase flow doesn't have any "dependency" (shouldn't as PayPal puts it).
IPN is an asynchronous message service, meaning that IPNs are not synchronized with actions on your website...
...
The IPN message service is not a real-time service. As a result, your listener may not receive an IPN message for many seconds after an event occurs. As a result, your checkout flow should not depend upon receiving an IPN message to complete. If it does, your checkout flow will be slow during periods of heavy system load and complicated, since it must handle retries.
It's been some time for me, but you are correct about IPN being very helpful if/when you support eCheck - re: notified when Paypal has cleared the check/funds (if memory serves, 1 - 3 business/banking days).
Hth...
I have been working paypal integration to an existing system of ours and successfully done tests on sandbox by using rest api and express checkouts.
Although documentation is detailed, I couldnt see anything about chargeback (i.e reverse transactions) and cancellations on rest api documentation page http://developer.paypal.com/docs/api/
So in case a user buys something successfully and the payment status becomes "completed", then there is a reverse transaction like chargeback, paypal will send a request to the return and cancel urls which are predefined while creating the related payment, or the client application has to check the payment statuses manually by rest calls? Or are there any other configs that I need to send while triggering the very first payment request?
You'll need to setup Instant Payment Notification (IPN) to handle that sort of thing.
IPN will automatically POST data about all transactions that hit your PayPal account to a URL you specify. This URL (a script) can receive the data and update your database, generate email notifications, or anything else you might want to automate based on the transactions.
You can handle all sorts of things with IPN. For chargebacks specifically, you would receive an IPN with the following params...
txn_type=new_case
case_type=chargeback
Of course, you'll get a bunch more parameters, too, but those would be how you can pick out the chargebacks and processing them accordingly.
Let's assume the PayPal REST API is used to fulfill a standard PayPal payment process. When executing the payment it is returned as 'pending', so the payment is not through, yet. The REST APi provides a payment id:
https://developer.paypal.com/docs/api/#execute-an-approved-paypal-payment
When payment is completed the URL of my IPN listener is called, however as said on this site included only a txn_id which seems to be not the same as the payment id of the REST API:
https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNIntro/#id08CKFJ00JYK
So how to match these two ids?
IPN was designed for supporting the classic APIs on PayPal and the txn_id would have matched the txn_id of a payment made with the classic API.
For payments made via the REST API, you may still be notified via IPN but unfortunately cannot match payments using ids currently. Your best option right now would be to check the attributes of the payment (amount, currency etc) and check that it matches attributes of a payment you were expecting.
Currently this is the existing option for push based notifications. The other option may be to poll at regular intervals and check the status of the payment.
There are certainly limitations to both approaches, and there is webhook support upcoming which would have push based notification support for REST payments to alleviate these issues.
The txn_id of IPN messages are also included with the REST API message but called 'sale id' there.
As recommended by PayPal I am using a combination of the PayPal API and the IPN to create a 'Adaptive Payments' flow.
When my IPN listener receives a new notification from PayPal I have two options (after security checks):
1) Use the received data to make direct actions in my website (for example set a preapproval as approved)
or instead a more secure and clean way (I think):
2) Detect the transaction type variable (or other identifier) and request more details from PayPal accordingly.
For example if the 'transaction_type' is 'Adaptive Payment Preapproval' then I will use the received 'preapproval_key' to request the preapproval details using the PreapprovalDetails API call and then use the received data of that call to set the preapproval as approved.
Is this (option 2) the better way to go?
Thanks.
In general there is probably enough information in the IPN for you to act on, but IPNs are pretty confusing what with all the optional fields and the way that there is no payment_status or txn_id on subscribe events, and no subscription information on payment events, so marrying them up can be interesting. You may well find it easier to understand if you go ahead and get the relevant information from them for each IPN via their API as you suggest.