Paypal integration - GetExpressCheckoutDetails PaymentActionNotInitiated - paypal

I am working to implement a Paypal Express Checkout. I have setup a Paypal developer and sandbox account including a Personal Sandbox test account to act as the buyer. I am implementing a SOAP solution and so far have been able to complete the following steps
Submit SetExpressCheckout request
Use token from SetExpressCheckout response to redirect user to Paypal payment page
Login to Paypal test using the Personal Sandbox test account. Once logged in I am taken to a 'Review your information' page. when I select 'Continue' on this page I end up back on the page I submitted as the Return URL.
From the Return URL page I submit a GetExpressCheckoutDetails request. On the response the CheckoutStatus always has a value of PaymentActionNotInitiated.
I have tried several sandbox accounts (verified and not verified) and the results are always the same. What would be causing this.
Sample of the SetExpressCheckout request is below
<soapenv:Envelope>
<soapenv:Header>
<urn:RequesterCredentials>
<urn1:Credentials>
<urn1:Username>sandbox_username</urn1:Username>
<urn1:Password>sandbox_passwword</urn1:Password>
<urn1:Signature>sandbox_signature</urn1:Signature>
</urn1:Credentials>
</urn:RequesterCredentials>
</soapenv:Header>
<soapenv:Body>
<urn:SetExpressCheckoutReq>
<urn:SetExpressCheckoutRequest
<urn1:DetailLevel>ReturnAll</urn1:DetailLevel>
<urn1:ErrorLanguage>en_US</urn1:ErrorLanguage>
<urn1:Version>119.0</urn1:Version>
<urn1:SetExpressCheckoutRequestDetails>
<urn1:OrderTotal currencyID="EUR">13.08</urn1:OrderTotal>
<urn1:ReturnURL>https://url/paypalreturnurl.htm</urn1:ReturnURL>
<urn1:CancelURL>https://url/paypalcancelurl.htm</urn1:CancelURL>
<urn1:OrderDescription>Invoice Num 31650</urn1:OrderDescription>
<urn1:InvoiceID>31650</urn1:InvoiceID>
<urn1:PaymentAction>Sale</urn1:PaymentAction>
</urn1:SetExpressCheckoutRequestDetails>
</urn:SetExpressCheckoutRequest>
</urn:SetExpressCheckoutReq>
</soapenv:Body>
</soapenv:Envelope>

You will need to complete Doexpresscheckout to complete the payment. After payment is complete
you will get CHECKOUTSTATUS=PaymentActionCompleted

Related

How to excute in Rest API if the return_url request lost after user has paid

I am integrating Express Checkout payments in my web by using REST API, and setting the payment intent to sale for making an immediate payment.
Here follows my steps:
1. create a direct payment by /v1/payments/payment, and set redirect_urls;
2. redirect the buyer using the approval_url in the response of step1;
3. when the buyer approves the payment, the full page will be redicrected to the url that I've been provided in redirect_urls, and then I will execute the payment to complete the payment.
My question here:
what if the redirect_url lost in my step3? The buyer paid but I wouldn't be notified. I would not receive the PAYMENT.SALE.COMPLETED webhook neither because I didn't execute the payment.

how to set CreateRecurringPaymentsProfile IPN

Step 1.
request with SetExpressCheckout
if get success then redirect to paypal
Step 2. curl request with method DoExpressCheckoutPayment With notify url
( getting response only one time )
step 3 if get success response then curl request with method CreateRecurringPaymentsProfile
is my process flow right to create an intent payment and make a recurring profile ?
and my problem is that i not getting any IPN response when, payment automatically after 1 day.
How to fix this.
Login in to http://developer.paypal.com/webapps/developer/applications/accounts
Create an Business (merchant account) account and login to http://sandbox.paypal.com/ with your
Business (merchant account) and password and click on profile then click **Instant Payment Notification preferences and set your ipn url

Paypal Sandbox ExpressCheckout NVP not creating transaction

I'm trying to integrate PayPal Classic API NVP to our website but I'm having issues with the SetExpressCheckout API call.
I'm using the useraction=commit parameter for the payer to confirm the sale directly at PayPal.
My issue is after "Pay now" is clicked, PayPal redirects to the URL I send as RETURNURL but I don't see the transaction on the sandbox account or by using TransactionSearch.
These are the parameters I send for checkout:
METHOD=SetExpressCheckout
EMAIL=payerEmail
SOLUTIONTYPE=Sole
RETURNURL=myReturnUrl
CANCELURL=myCancelUrl
PAYMENTREQUEST_0_AMT=30.00
PAYMENTREQUEST_0_ITEMAMT=30.00
PAYMENTREQUEST_0_CURRENCYCODE=USD
PAYMENTREQUEST_0_CUSTOM=myCustomId
PAYMENTREQUEST_0_PAYMENTACTION=Sale
L_PAYMENTREQUEST_0_QTY0=1
L_PAYMENTREQUEST_0_AMT0=30.00
L_PAYMENTREQUEST_0_NAME0=myProduct
After payment, PayPal redirects to
myReturnUrl?token={Token}&PayerID={PayerId}
It's normal. The transaction is set, but you need to complete it using the DoExpressCheckoutPayment api operation.
More information and an example here: https://devtools-paypal.com/guide/expresscheckout/dotnet?success=true&token=EC-7BD474648D4932937&PayerID=WNW7LMW2UXQJG

Not receiving money through Paypal Express Checkout API

I developed a small payment process that uses the Express Checkout API. I'm testing the code with my friend's account with $1. My payment process is redirecting to the live paypal site, he enters his information and pays, he is redirected to my confirmation thank you page, but I never receive funds. I've checked my API credentials in the code, and they are OK. I'm receiving a token and paypal payerid info on my confirmation screen. What could be the problem?
Thank you in advance.
See my answer in Why is DoExpressCheckoutPayment required for Paypal?
In order to use Express Checkout, you must call at least the following API calls:
1. SetExpressCheckout -- to set up the transaction.
2. DoExpressCheckoutPayment -- to finalize the transaction.
If you don't call DoExpressCheckoutPayment on the 'Thank you' page, the transaction is not completed. This is by design to allow for greater flexibility
Express Checkout is intended as a drop-in solution in your own checkout process. After Express Checkout redirects you back to your site, you're supposed to show an order confirmation where the buyer can review his/her final order details before initiating a button / link which initiates the final DoExpressCheckoutPayment API call. This is why DoExpressCheckoutPayment is required.

Page Protection

I've had a difficult time working with PayPal express checkout... Basically I'm looking to protect a PAGE, not a download or anything. The user pays and they can access that page one time. And have to pay each time they want to access the page.
Does anyone have a simple PHP solution to protect my page until the person pays through PayPal? Or even a pre-written example of the PayPal code for Digital Goods for Express Checkout?
Thanks in advance.
PayPal doesn't have much to do with this -- it's all about the logic you place on your 'return page' (the page the buyer returns to after they have completed payment).
For a simple Express Checkout integration you would:
1. Call the SetExpressCheckout API
2. Supply the AMT, RETURNURL and CANCELURL
3. Retrieve the token as returned in the SetExpressCheckout response.
4. Redirect the buyer to https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-xxxtoken-herexxx&useraction=commit
5. When the buyer agrees to the payment and is returned back to your RETURNURL, call the GetExpressCheckoutDetails API and supply the token to retrieve the PayerID (alternatively; the token is also appended in the GET array for your RETURNURL)
6. Call DoExpressCheckoutPayment to finalize the payment.
7. Now that the payment is complete, do whatever logic you have to to ensure the transaction is completed and provide the buyer access to the content you wish him/her to see (could be the RETURNURL page itself, or a completely different page).
Sample (NVP) API calls would look similar to the following:
SetExpressCheckout Request
METHOD=SetExpressCheckout&USER=yourAPIuser&PWD=yourAPIpwd&SIGNATURE=yourAPIsig&VERSION=78.0&AMT=0.01&RETURNURL=http://www.your-return-url.com/&CANCELURL=http://www.cancelurl.com/
SetExpressCheckout Response
......
Ack=Success
TOKEN=EC-12345678
.......
GetExpressCheckoutDetails Request
METHOD=SetExpressCheckout&USER=yourAPIuser&PWD=yourAPIpwd&SIGNATURE=yourAPIsig&VERSION=78.0&TOKEN=EC-12345678
GetExpressCheckoutDetails Response
.....
Ack=Success
PAYERID=ABCDEFGH
......
DoExpressCheckoutPayment Request
METHOD=SetExpressCheckout&USER=yourAPIuser&PWD=yourAPIpwd&SIGNATURE=yourAPIsig&VERSION=78.0&AMT=0.01&PAYERID=ABCEDFGH&TOKEN=EC-12345678
DoExpressCheckoutPayment Response
....
Ack=Success
PAYMENTSTATUS=Completed
....
See also
SetExpressCheckout: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_SetExpressCheckout
GetExpressCheckoutDetails: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_GetExpressCheckoutDetails
DoExpressCheckoutPayment: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_DoExpressCheckoutPayment
As well as https://www.x.com/ > API Reference.
Note: I'm using "useraction=commit" in the redirect URL to PayPal because that will change the 'Continue' button on the PayPal 'Review Your Payment' to a 'Pay now' button. Thus implying the buyer will be immediately charged as soon as he clicks on that button. It's just handy.