Reputation: 33658
Using the Adaptive Payments API I acquired a pay key using the API method Pay
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 pay flow 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 pay key, it gives me (among other values):
paymentInfoList.paymentInfo(0).transactionStatus: COMPLETED
status: COMPLETED
actionType: CREATE
So apparently the payment is already executed, though I did not call the ExecutePay
method yet.
The docs state (under the topic "PayRequest Fields"):
actionType xs:string
(Required) Whether the Pay request pays the receiver or whether the Pay request is set up to create a payment request, but not fulfill the payment until the
ExecutePayment
is called.Allowable values are:
[...]
CREATE
– Use this option to set up the payment instructions withSetPaymentOptions
and then execute the payment at a later time with theExecutePayment
.
What did I miss?
Upvotes: 6
Views: 1782
Reputation: 2562
(I know it's been three years since this question was asked, but since another user referenced this question, I'll answer it anyway.)
In short, if you send the sender over to the PayPal website, and they approve the payment, the payment will complete immediately, regardless of what you set actionType
to.
The purpose of setting actionType=CREATE
is to give you a little bit of time to make additional API calls against the paykey before the payment completes. It's primarily useful when you're doing implicit payments -- e.g., those payments where the sender and the API caller are the same party (and you've set sender.useCredentials=true
, set your email address in senderEmail
, or set your secure merchant account ID in sender.accountId
), or those payments where you're using a preapproval that the sender has previously approved. Since these types of payments would normally complete right away (if you set actionType=PAY
), setting actionType=CREATE
gives you a little bit of time to make other API calls against the payment (such as SetPaymentOptions) before the payment completes.
If you're doing an explicit payment (where the sender has to go to the PayPal website to approve the payment), however, you'd just make those additional calls before sending the user over to PayPal.
Upvotes: 3
Reputation: 641
We ended up just using the Preapproval API and calling Pay with that. In the response I got to my e-mail I was told:
"PayPal does not allow you to hold any amount of money in somebody else's PayPal account and that is why we have Preapproval API."
I'm still not sure why Create appears to make the 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.
Upvotes: 3