Getting Transaction details on Enhanced recurring payment service - paypal

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.

Related

Paypal Subscription Details

Can you help me. I need to know if PayPal has an API call to get subscription details like the enddate of the subscription?
I do the request to PayPal and get the response,
SUCCESS
transaction_subject=Name20
payment_date=10%3A42%3A50+Mar+28%2C+2014+PDT
txn_type=subscr_payment
subscr_id=I-MWMMATTBSY2M
last_name=jls
....
but I need details from suscription as enddate.
Sounds like you're using Standard Subscriptions and the "response" you're referring to would be an Instant Payment Notification (IPN)..??
Unfortunately, the standard subscriptions system doesn't have any API's to access details directly. You could switch to Express Checkout and the Recurring Payments API, though, and this would give you access to API's to obtain details and manage the profiles programatically.
If you're working with PHP you can setup Express Checkout and Recurring Payments very easily using my class library for PayPal.
The flow you'll be setting up would be as follows...
1) Call SetExpressCheckout to obtain a token and redirect the user to PayPal. The SEC request will also include a ReturnURL which is where PayPal sends the user after they've signed in and agreed to continue. You also need to make sure to include the Billing Agreement parameters in your SEC request so that the token you get will be compatible with recurring payments.
2) The user ends up back at your ReturnURL, and this is where you'll call GetExpressCheckoutDetails to obtain details about the buyer that the system now knows since they've signed in. This gives you info like the payer's name, email, address, etc. It also gives you the Payer ID you'll need for the final request.
3) Right after obtaining the details via GECD you'll call CreateRecurringPaymentsProfile to finalize the subscription profile creation.

ipn using customer business pp account

my ipn works perfectly its setup under our business PayPal account. our asp.net website is being used by multiple customers with their own members, unique by their login. as of now the cart writes to our database with the orders and sets a status code that gets changed to 'completed' via the ipn call/authentication from PayPal using our PayPal email. now, a couple want to use their own PayPal accounts, non-for profits, so in order for this to work as previously described what changes in the post variables?
ex of what i need: a member of our customer logs in to our website, adds items to their cart and chooses PayPal payment option. it writes to our database as an 'in-process' order. it opens our customer PayPal account to complete the payments then once complete it calls our ipn setup under our PayPal account and redirects back to the custom page.
again, everything is already working great just want to call their own PayPal account instead of ours w/o needing to have them setup the ipn settings under their account, but use the ipn setup under our PayPal account. members see their own customer PayPal account billing theme and the money is in their account not ours. is this possible?
do we send the ipn location url and our customer PayPal account info in the post variables?
thanks for any help
As far as processing the payment on their PayPal account, you can go about this 2 different ways. You can either use their API credentials and pass those over in the API call and the payment will be processed on their account. Second option would be to have them grant 3rd party API permissions to your API to be able to process transactions on their account. Then you would just pass over your API credentials in your API call and also pass over their email address of their PayPal account in the variable "SUBJECT". This will then process the payment on their account.
As for still haveing the IPN POST sent to your script, you will just need to pass over the IPN URL in the API call. When pass it over in the API call, it will override whatever is set in the account. For example, if you are using NVP the variable would be "NOTIFYURL".

Correlated user with subscription button

I am using paypal subscription button. but i am facing a problem. when my site user click subscription button it redirected to paypal site. and after paypal it return to my set url. It is my generated code.
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
My problem is how i correlated this user to this subscription request. Is there is any option such that i can send my user's identity on paypal so that i can fetch information from paypal regarding this user.
Or any paykey so that we got information about this transection.
You can pass your user ID for tracking users as the "item_number" or "custom" value. Both would be returned to in an IPN post and through PDT.
If you wanted to query PayPal about it you can do a GetTransactionDetails API call to look up a transaction ID and get the buyer information returned as well as the payment status.

Paypal NVP with IPN for confirmation - what ties them together

I am using PayPal with NVP API (using PHP) for express checkout. I am creating an invoice record in the database before redirecting the user to Paypal. In case the user doesn't return to my site after processing, I am using IPN to confirm the purchase and then update the invoice record that the payment is confirmed. I am still in the sandbox mode and trying to figure out how I will tie the transaction started with NVP to the confirmation I get with IPN.
I need to verify if the "PAYMENTREQUEST_n_INVNUM" sent in the NVP will come back as "invoice" in the IPN post.
It appears I cannot actually test this until I am live since the Sandbox IPN does not seem to be active with NVP initiated sandbox transactions - is this correct?
Thanks for your help.
You can test this in Sandbox. But if you're using "PayPal NVP", I assume you're using PayPal Express Checkout and calling the SetExpressCheckout and DoExpressCheckoutPayment API's.
If that's the case, you don't really need IPN, because a transaction will only be completed as soon as you call DoExpressCheckoutPayment.
In other words, buyers will always be redirected to the RETURNURL you specified in SetExpressCheckout, and the transaction is completed (or not) when you call DoExpressCheckoutPayment on this return page.
To get the invoice number, you could call GetExpressCheckoutDetails and supply the TOKEN you retrieved earlier (it's also appended to the GET of the RETURNURL).
Finally, check PAYMENTSTATUS=Completed in the DoExpressCheckoutPayment API response to see whether the transaction has completed or not.
Thank you Robert for the clarity on the process - especially useraction=commit.
I finally realized that I could turn on IPN in the Sandbox for my test seller and test NVP with IPN together. I was able to verify that PAYMENTREQUEST_0_INVNUM matches the 'INVOICE' parameter in the IPN POST.
I will use the custom field to pass customer email from my system in case they use a different email to log into paypal with, therefore allowing me to have email/invoice number pair for confirmation.

Capturing payment; express checkout

Hi
I have paypal express checkout working on my site, when user buys something the transaction goes through and the merchant is able to capture payment by clicking on the capture button on the sandbox site. Problem is that I need 'capture status' returned to the site as I need to store it in database for future use, is there a way that paypal sends some notification whenever the payment is captured by the merchant.
Thanks
PayPal IPN: https://www.paypal.com/ipn
In short, include NOTIFYURL in your SetExpressCheckout and DoExpresscheckoutPayment call and you'll receive a POST on that URL when the transaction has been captured. Look for 'PAYMENTSTATUS', as that should read 'Complete'.
Don't forget to validate the POST by sending it back to https://www.paypal.com/cgi-bin/webscr?cmd=_notify-validate and checking for a VERIFIED / INVALID response.