how to set CreateRecurringPaymentsProfile IPN - paypal

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

Related

Getting Transaction details on Enhanced recurring payment service

My application comprises of a subscription service. I have implemented the section using Paypal standard. What i did to make a recurring a recurring profile is to do a SetExpressChekout call initially and then with the response token, i redirect the browser to Paypal and there he could login to Paypal and accept the terms and condition for the payment and then the browser will be redirect back to the url i specified as the return url with token as the query string. With this token i make a doexpresscheckout api call and then convert the transaction to a recurring profile, the profile id, transaction id will be stored in database for refund transaction, recurring profile cancellation etc. And also this profile id is needed in IPN which logs further recurring payment transaction in my database successfully. Everything works fine in this environment.
Now my customer needs to have credit card transaction along with Paypal transaction. For that he has sign up for enhanced recurring payment. I have created a subscription button with item name amount currency success and cancel url and generated the html for the hosted buton and pasted it in my form. On clicking the button the browser gets redirected to paypal and i could pay with both paypal and credit card. Once the payment is completed and i am redirecting back to success url. but my success url query sting only contains auth parameter. I am getting no idea on how to use this parameter to get the details of the recurring payment like profile id and transaction id to log to my database. If it is received only via IPN how could i know whether the profile id belongs to which user.
Thanks and regards
With Website Payments Standard you can set the custom parameter to contain specific data about the user.
For example;
<input type="hidden" name="custom" value="hashedStringofUserID">
This data will subsequently be returned in the IPN POST payload's custom key.

How am I supposed to capture a payment 1 day after its authorization if the PayPal token expires after 3 hours?

I'm using the express checkout API through the ActiveMerchant gem in a Ruby on Rails app. The whole authorize and capture flow works just fine when is done within 3 hours. But after that my token expires and I lose the transaction. Even if the authorize and capture documentation says that the authorization is valid for 3 days (at least according to https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/howto_admin_authcapture).
So, how can I capture the transaction after the token has expired?
You shouldn't have to be passing your token. You should be following the flow below.
Make your SetExpressCheckout API call and set payment action to authorization (A)
Get token back
Redirect buyer over to PayPal with to token to login and agree to payment
Buyer gets redirected back to your site with token and payer id returned
You can then execute your GetExpressCheckoutDetails API call using the token.(this step is optional)
Then you perform the DoExpressCheckoutPayment API where you pass over the token and set the payment action to authorization (A)
Then then completes the Express Checkout authorization.
Now you would go back a day or two later and perform your DoCapture API where you send over the transaction id that was returned from your DoExpressCheckoutPayment API earlier. You don't send over the token again here. Once you complete the DoCapture, the funds should then show in your account.

Use paypal Express checkout in minimum steps using nvp in asp.net

I want to use paypal express checkout in my application in minimum steps
like:
click on paypal button-> verify account on paypal-> back with token to my application ->
confirm the payment->successful msg ->credited into my account(user not redirect to paypal) only get success message on application
currently paypal confirm the payment of user in paypal site but i want it to my application
and user only once redirect to paypal site for account verification rest all process done in to my backhand side of asp.net application
I guess that's the way Paypal works.And where is a call to getExpressCheckoutDetails.
If you want paypal shipping details on your webpage you need to make call to this method.
It will return you shipping detail and then create a button for say "Pay" and call doExpressCheckout method of PaypalAPI to complete your transaction :D
You can try this as a starting point: https://paypal-labs.com/integrationwizard/ecpaypal/main.php (SSL is expired or invalid so you'll have to add security exception, but it works)

Paypal shipment details

I am using PayPal Adaptive payments (chained payments).
If I set:
1. CREATE payment
2. In the SetPaymentOptions -> Requires shipping address selection = true
3. When I redirect user for the https://www.sandbox.paypal.com/webscr&cmd=_ap-payment&paykey=[PA KEY] user after authentication is not shown any prompt for shipping address
why?
Accordingly to the
https://www.x.com/developers/paypal/documentation-tools/api/pay-api-operation
when using CREATE I should do: CREATE – Use this option to set up the payment instructions with SetPaymentOptions and then execute the payment at a later time with the ExecutePayment.
But as soon as I try to run ExecutePayment I get the following information:
This payment request must be authorized by the sender
How can I set additional payment options then?
The ExecutePayment call would only be used if you're utilizing delayed chained payments. Otherwise, the payment still happens as soon as the buyer logs in and approves it, so there is no need for ExecutePayment. Calling it at that point results in the error you're getting, that the paykey was already used.
Did the sender actually authorize the payment?
The flow should be like:
Call Pay API operation with actionType as CREATE
If paymentExecStatus=CREATED and ack=SUCCESS, obtain payKey (here, keep detailLevel=ReturnAll in RequestEnvelope field of your Pay API request)
Redirect user to Paypal https://www.sandbox.paypal.com/webscr?cmd=_ap-payment&paykey=YOUR_PAYKEY_ABOVE
If user approves payment, you will be redirected to your returnURL sent as a part of Pay API request
Verify approval status using PaymentDetails API operation
Later you can execute the payment thus setup in step 4 using ExecutePayment API operation. Send the same payKey you obtained in step 2.
You have got error code 550001 since the user approval seems to be not yet done successfully. It may be due to:
The application did not redirect user/sender to Paypal for authorization
OR
The user did not enter correct login details
OR
There were not sufficient funds available
etc.

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.