I have a subscription plan ie $30 for every month and first month is free. but I am not getting any response from Paypal when somebody subscribes however I get response after one month for the first payment. Paypal does not send any response back if the first month is free ? How can I find out somebody subscribed successfully ?
Are you using standard subscription buttons or Express Checkout with Recurring Payments?
Either way, you'll get IPN's when a new subscription profile is created as well as when each payment comes through. If you're not seeing that I would check your IPN history in your PayPal account to see if you're finding errors there, and also check your web logs to see if you're finding errors there.
I'm guessing that your IPN script is failing for some reason when it gets hit for the new profile IPN's.
The txn_type value would be either subscr_signup or recurring_payment_profile_created depending on which method you're using.
Related
I have a chat site and I am going to make it possible for the users to reserve a nickname for a subscription fee per month. I have been reading up on PayPal documentation and understand how to do such using PHP with the various callbacks from PayPal to check that the initial payment has been confirmed but what I don't understand how to do is how to each month check that the subscription has still been paid/not cancelled, otherwise do something (in this case remove their subscriber account)?
You can use PayPal IPN feature https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNIntro/?mark=IPN.
Refer to https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/, there is a "profile_status" variable , PayPal can notify you if profile status is changed.
I have a website that accepts PayPal payments and I need to check old payments (like a week ago) that
appear pending on my server.
Since payments are "pending" on my server I don't have the PayPal transaction id to identify then on PayPal servers so I need another way to search for them, for example, using the "item number" that corresponds to the payment id on my site.
The final idea is to have a cron job that runs every day and checks for pending payments and retrieve their status on PayPal and try to confirm them automatically.
Is there a way to check a payment status using PayPal's api by the item number or other field?
Thanks in advance.
There is a much easier system to check on payments that are made through them and that is the Paypal IPN API.
Paypal IPN API Documentation should get you started and up and running.
Inside of the provided code from the IPN API, they have multiple methods to check for payments and if they are paid, pending, denied, etc.
Hope this helps!
We have a little problem in our system, we allow customers to pay using PayPal which is great!
But in the following situation we have this issue:
A customer pays us using PayPal.
We send the product to our customer when the transaction has completed.
A few days later, PayPal refuses to pay us because the customer have his PayPal account connected with his bank account. And the funds on that bank account is too low.
So, is there a way to let PayPal know us when this happens through API/URL call to our server ?
As Dagon mentioned, IPN is the best way to handle this.
You'll setup a listener script on your server, and every time a transaction happens on your PayPal account, the PayPal server will POST data about that account to your listener script. You'll get different parameters depending on the type of transaction that occurs. You can see a list of the types and parameters here.
You can build your email notifications, database updates, etc. into your IPN script to fully automate post-payment processing tasks.
So, in the example you've provided, what would happen is when the transaction first takes place the IPN would be triggered with a payment_status of Pending, and then you'd also see a parameter called pending_reason with a value of echeck. This tells you the payment was made, but it's an echeck which takes time to clear, so the status again is Pending instead of Completed.
A few days later when that payment does clear (or fails) you'd get another IPN with an updated payment_status. Only upon receiving an actual COMPLETED payment_status would you then would you deliver the order.
Again, this can all be automated within your IPN script.
My sent data to paypal is
"https://www.paypal.com/cgi-bin/webscr/cmd=_cart&upload=1&business=seller.email#something.com¤cy_code=USD&bn=BusinessName&return=http://www.sellersite.com&item_number_1=55&item_name_1=battery&amount_1=55&quantity_1=2&item_number_2=52&item_name_2=bat&amount_2=5&quantity_2=3"
And I want to show those sent data(item number, item name,amount,quantity) and the paypal transaction id to the buyer on "http://www.sellersite.com" after successful payment. (Suppose, the seller has the merchant account with paypal and he would enter that paypal id into database from admin section of the website. So,I would not think about his paypal account settings, my job is just to create the environment for paypal payment for the seller.)
If I write a script like
$T_ID=$_REQUEST['tx']; // or $T_ID=$_GET['tx']; **ref(tx):- "https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/howto_html_paymentdatatransfer"
$item=$_REQUEST['item_number_1']; // or $item=$_GET['item_number_1'];
Then would I get those data from paypal ?
Please tell me.
-Thanks.
It's not going to be quite that simple. You'll need to setup Payment Data Transfer (PDT) in order to get details sent back to your return URL after the buyer completes the payment.
This is useful if you're simply going to display details back to the user, but it's not recommended for updating your own database, sending out email notifications, etc. because there is no guarantee this page will ever be reached so the code won't always run.
For that sort of thing you'll want to use Instant Payment Notification (IPN). This works very similar to PDT except that it will always POST data to your IPN listener on your server regardless of whether or not the user makes it back to your return URL, and it happens outside of your checkout system all together.
I need to setup paypal auto renewal for my customers in website.
actually customer will get 30 days website access on every month payment.
if the monthly auto payment is ok we can increase "website access" days by 30.
if no it will not add any more days to customers account.
that means i need to RUN a SCRIPT from my own website to check and increase or stop customers "website access" days after each auto payment.
can we set up paypal auto renewal like this?
is there any method to run a script (mywebsite.com/renewalscript.php?customerid=123&payment=ok) after every auto renewal ?
or do you have any other idea to overcome this ?
A simple way could be to have a valid_until date column or something. When a user tries to view content, just check that field and see if they should be able to or not. Then in the IPN listener, you could push that date forward 30 days when a good payment comes in.
If you need help with creating the IPN listener, you might find my tutorial helpful.
PayPal Instant Payment Notification (IPN)
You can do this by listening to the IPN for when the txn_type is subscr_eot. When the subscription fails or is cancelled, you can disallow access.
This question explains a bit more about subscr_eot:
Subscriptions with Paypal IPN
I use this class: PHP Paypal IPN Integration Class
and check:
if($p->ipn_data['txn_type'] == 'subscr_eot')
then set their status to 0 to disallow access.
AFAIK, on every sucessfully debted subscription fee, you get an information via IPN. The "script you need to run" is the IPN script. If PayPal notifies you via IPN, your IPN script needs to handle the request/response and if valid, sets your parameters in your database. This is all done in your IPN handler script on your website.
(Remember to first answer the paypal request in this script before doing any local updates to your tables etc. if you send the request too late, paypal doesn't accept it and sends a new one later).
See https://cms.paypal.com/cgi-bin/marketingweb?cmd=_render-content&content_ID=developer/library_code_ipn_code_samples for sample code