Paypal Rest Api - recurring payment issue - php

I'm trying to setup recurring payments in Paypal for my website using REST API, and I have 2 questions/problems:
Can't see transaction details in the paypal checkout page:
For one time payment, I know how to display transaction details by providing values for item_list (as in https://developer.paypal.com/docs/api/).
However I don't know what values we should provide so that recurring payment profile will be shown on checkout page as well.
In the below picture(left side) you can see that no information is presented to the client regarding the payment amount and setup fees.
If I switch to production environment when the user tries to make a recurring payment, the user is redirected to the paypal website and he sees this error:
Sorry, we weren’t able to set up preapproved payments at this time.
Please return to the merchant and choose another way to pay.
So what's the issue with the recurring payment:
Why the user does not see any information regarding the payment amount in checkout paypal checkout page.
Why in production env the user gets that error message?
I'm using this documentation:
http://paypal.github.io/PayPal-PHP-SDK/sample/doc/billing/CreatePlan.html
http://paypal.github.io/PayPal-PHP-SDK/sample/doc/billing/CreateBillingAgreementWithPayPal.html
http://paypal.github.io/PayPal-PHP-SDK/sample/doc/billing/ExecuteAgreement.html
How will I be notified when a paypal client cancel the recurring payment?
It is important for my web application to know when somebody cancel the recurring payment.
I read something about webhooks, is this the way?
Can you give me some documentation?
My location is Romania, if this matters.
Thanks,
Catalin

Related

paypal Preapproval API

we are trying to add a pre-approval paypal process to our website before a user can bid on any of our items for sale. We currently accomplished this using Authorize.net but want to now integrate paypal as well.
I have been doing some research and am trying to find out if paypal even offers such a solution. The main reason for adding this verification is of course to make sure an individual actually has the money to purchase the item, some items can range from $100-$100,000. Does paypal offer a pre approval process for those types of transactions?
https://developer.paypal.com/docs/classic/api/adaptive-payments/Preapproval_API_Operation/
The Preapproval API gives your application permissions to trigger payments on a user's behalf without further approval (no login required to submit payments with a preapproval ID). There is no guarantee funds will be available when you submit this payment. A transaction with a preapproval ID could simply fail like any other transaction.
It sounds like what you're looking is the Authorization and Capture process, which is probably what you're doing with Auth.net, too.
With PayPal you can run Authorizations from credit cards directly (exactly like you do with Auth.net) and you can also do it with Express Checkout, which would be PayPal login payments.

after create CreateRecurringPaymentsProfile, profile status not changing from pending to active in paypal

I am working with Paypal recurring payment.
Paypal recurring profile will creating successfully, but initial payment will not made. and profile status will not changing even i checked it after a day.
See this screenshot of my Paypal account sc1, sc2
I think issue is not with php code. is there any other settings that i need to do? even my IPN not working because payment is not completed by Paypal.I am using Paypal express checkout api.
When you create recurring plan it is in CREATED state, you need to update it by calling update service and make it ACTIVE
As per the PayPal API, you have to explicitly update the status by calling it again.

Confirm Express Checkout on PayPal via PHP

This question asked before but didn't got any answer.Maybe things have been changed.
When you click the Express Checkout PayPal button on any webshop, it redirects you to a specific paypal login link, for paying the order.
I have been searching high and low for 3 weeks for a simple paypal php curl script that logs you in from this step, and confirms the payment, but have not been able to find anything.
I found out it is not possible to use the API for this, so its gotta be done by CURL.
I'm asking for this because I run a dropshipping website, and would like to automate certain steps, like placing and paying orders. A working code for this would help not just me, but all looking to automate buying in some form.
Thank's!
You can't log the buyer into PayPal when you redirect them to the site. The buyer has to enter their own account credentials themselves.
If you wanted to bill a buyer without requiring they log into PayPal each time you would need to use billing agreements (reference transactions) through Express Checkout. If you set up a billing agreement with a buyer you can charge a previously successful sale to bill them again for a different amount.
You cannot do what you want with Express Checkout, especially since nobody will ever enter the paypal details on your website (that is the entire point of paypal).
You can use either preapproved payments (buyers preappove payments being taken out of their account up to a certain ceiling), or reference transactions (you reference a new transaction to an older transaction. PayPal will then use the billing details of this earlier transaction to bill the user).
Preapproved payments is part of Adaptive Payments. Documentation is at https://developer.paypal.com/webapps/developer/docs/classic/adaptive-payments/integration-guide/APIntro/
You can find more details about Reference Transactions at https://cms.paypal.com/uk/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ECReferenceTxns
Note: Reference Transactions needs to be enabled on your account. This API call is not open to everyone due to the potential for abuse, so you may want to look into whether you're eligible for it before you start working on a full integation with it.
You can find more info here :https://www.paypal-community.com/t5/Merchant-services-Archive/Does-Paypal-have-a-quot-Token-Payments-quot-concept/td-p/325794
Also google "token payments" as that is what you need and most payment gateways usually support them.

How to Get the transaction details once the payment via paypal completed

I am using parallel adaptive payment. i got the php coding from following link of paypal developer` website.
https://www.paypal-labs.com/integrationwizard/adaptive/main.php
Now the transaction of amount takes place successfully. But i want to store the transactions details such as
1.transaction id,2. Amount 3.Status etc. After the returns from paypal to my website
Presently i did this with paypal sand box account
You could use IPN to get information back to your website that pertains to the transaction. You can find more on IPN on PayPal Developer's Site.

How do I get data back from Paypal so I can alter my MySQL database accordingly?

I'm just starting out with Paypal, so this is a newbie question.
I've been going through the instructions for setting up Paypal subscription service, but I think I'm looking at the wrong thing.
What I want to acheive is to get back some kind of response from Paypal so that I can update the database on my web site to mark a registered user as having paid. Basically I have a flag in the database that says if the user is subscribed or not. I want to ensure that the user is marked as paid so long as their Paypal subscription is maintained.
While the instructions linked above do say how to set up a button to receive a payment, there's nothing there about getting any data back from Paypal.
I know there are terms like IPN and sandbox that are related to what I'm trying to do, but I can't find clear instructions for how to get started on this process. I'm just circling around and not getting anywhere.
Where do I start on setting this up? Where is there a clear beginner's tutorial?
Also, I'm using PHP/Javascript/MySQL on my website.
PayPal's IPN service is what you want to use. I've used it myself to do just what you're looking to do.
Instant Payment Notification (IPN) is PayPal's message service that
sends a notification when a transaction is affected. Once IPN is
integrated, sellers can automate their back office so they don’t have
to wait for payments to come in to trigger order fulfillment. IPN can
send notifications for these transactions:
Instant payments, including Express Checkout and direct credit card payments
eCheck payments and pending, completed, or denied status payments
Pending payments
Recurring payments and subscriptions
Authorizations
Disputes, chargebacks, reversals, and refunds
You can also view notifications on PayPal’s IPN History page and
resend them if you need to. As PayPal’s interface for handling
purchase confirmation and server-to-server communications, IPN can
also be used to manage and customize a variety of APIs and
communications, including:
Customize your website's response to customer purchases in seconds
Track customers via IPN "pass-through" variables
Notify sellers who deal mostly in software downloads and other digital, online goods
Track affiliate sales and commissions
Store transaction information in your own database
For more about IPN:
Technical Overview (link to new html version of docs on developer central)
Instant Payment Notification Guide (PDF)
Code Samples
I'm not sure if its the same thing, but I just setup my friends website with Express Checkout, and I wanted to add all paid orders to an orders table in my database.
After I call SetExpressCheckout, and the user is returned to my site after going through the purchase flow on Paypal's side,
I used the information from GetExpressCheckoutDetails.
Then, if DoExpressCheckoutPayment
is successful (also called from the "callback" page) I then do the appropriate work in my database as far as logging the order details. For you in this case, it could be updating a record for the user in the database.
Hope that helps a little.

Categories