Adaptive payment is COMPLETED, although actionType is CREATE

Using the adaptive payment API , I purchased a payment key using the Pay API method with these parameters:

 actionType: CREATE receiverList.receiver(0).email: ... receiverList.receiver(0).amount: 5 currencyCode: EUR cancelUrl: ... returnUrl: ... requestEnvelope.errorLanguage: en_US 

Then I started the embedded payment stream with this URL: https://www.sandbox.paypal.com/webapps/adaptivepayment/flow/pay?expType=light&payKey= ...

After the lightbox is closed again, when I call the PaymentDetails method on the payment key, it gives me (among other values)

 paymentInfoList.paymentInfo(0).transactionStatus: COMPLETED status: COMPLETED actionType: CREATE 

Thus, it is obvious that the payment has already been completed, although I have not yet named the ExecutePay method.

Status of docs (in the "PayRequest Fields" section):

actionType xs: string

(required) Whether the payment is required for the recipient or whether the Payment request is configured to create a payment request, but is not executed until ExecutePayment is called.

Valid Values:
[...]
CREATE - Use this option to set up payment instructions using SetPaymentOptions , and then complete the payment later. ExecutePayment .

What did I miss?

+6
source share
2 answers

We ended up using the Preapproval API and named Pay. In response, I got to my email, they told me:

 "PayPal does not allow you to hold any amount of money in somebody else PayPal account and that is why we have Preapproval API." 

I'm still not sure why Create creates a charge without requiring an ExecutePayment call, but for my workflow (which I hope is valuable to you), the Preapproval API is the way to go.

+3
source

(I know that three years have passed since this question was asked, but since another user pointed to this question, I will answer anyway.)

In short, if you send the sender to the PayPal website and approve the payment, payment will be completed immediately, regardless of whether you set actionType .

The purpose of setting actionType=CREATE is to give you some time to make additional API calls against the keyword before the payment is completed. This is primarily useful when you make implicit payments - for example, those payments in which the sender and the calling API are the same party (and you set sender.useCredentials=true , specify your email address in senderEmail or set a secure identifier agent in sender.accountId ) or those payments in which you use the prior approval that the sender previously approved. Since these types of payments usually complete immediately (if you set actionType=PAY ), setting actionType=CREATE gives you a little time to make other API calls against payment (e.g. SetPaymentOptions) before the payment is completed.

If you make an explicit payment (when the sender must go to the PayPal website to approve the payment), however, you will simply make these additional calls before sending the user to PayPal.

+3
source

Source: https://habr.com/ru/post/907738/


All Articles