subscr_payment using paypal ipn simulator - php

The paypal IPN simulator "currently" (As in I'm assuming never will) does not have functionality to test the subscr_payment payment option, this is really putting a dead hault in my project. I've read that I can just create a button that simulates this, but I don't have a clue how and after looking I can't find any information on it.
I'm creating a subscription based system for hosting a special type of website, I have everything done besides for the subscription model now and it seems like it's going to be the hardest part.

It is completely possible to test recurring billing with Paypal.
There are multiple ways possible for this.
One is the paypal subscribe button and another way (which i have used) is via a subscription form.
For the subscribe button you can refer this documentation, it contains all the information you need to setup this.
For second method, you need to create a form and place all the required variable in that form.
All the required variables are listed here.
I hope this helps.

Hopefully this workaround will help you. From within the PayPal developer site, you can go to the IPN simulator, select Transaction Type as Web Accept, click Show All Fields. You can then edit txn_type to be subscr_payment, subscr_signup, etc.
It's not perfect, as it doesn't give you all of the variables, but you can put info in other entries, and use a logical to determine whether or not the correct entry exists.
Do one test subscription, so that you have the values, and then work from there.

Related

Simple Paypal Button Subscription Membership

I'm new here!
I'm trying to let my customers get recuring billing membership on my website based on this tutorial.
The button work, evverything is fine, except one thing. I need to validate that paypal really went successfull, to prevent anyone to go directly on the success page and get free membership. I noticed that it return a token=VALUE data to the success / cancel redirect.
I cannot find any $_POST or any others $_GET than that and I wonder, nor anything that could solve this in the Paypal doc (which changed a lot since last time I used it).
How can I check if the membership really went trought paypal using this token=1RXXXXXXXXH484112Y.
The return of such an integration may never happen. Reliable notification that a subscription has been created can only be done with a separate, server-side integration.
For the old HTML subscription button integration in the tutorial you reference, you can implement the old Instant Payment Notification (IPN) service.
The current solution would be to use a smart subscribe button with server side API calls to create the subscription and activate it -- with this, your server immediately knows it has been activated (because it did so itself and received the response). You can find some details on that solution here: https://stackoverflow.com/a/63908112/2069605

How to capture success on Paypal's Smart Checkout and return a Serial Key?

Introduction
Hello I'm going to sell a software using serial keys. Any person can go into my webpage and click on the paypal button to buy a serial key, they don't need to register.
What I'm trying to achieve
I need to let any person use the button and receive a serial key when the payment is done.
So the workflow would be something like:
Any person (non-registered) clicks on the button.
The paypal page shows up.
The user pays and gets redirected to a page that shows something like "Congratulations, here is your serial key: {{serialKey}}" and also receives the same serialKey via email.
What I tried
I'm trying to use Paypal's Smart Checkout but I don't understand how to implement what I need.
Right now I'm able to:
Render the button.
The button performs a request to my back to get the price (so the user can't change it and trick me).
The paypal page shows up.
On success it performs a request to my back.
On failure it restarts.
What I'm missing:
How can I check that the payment did actually succeed on the back, I mean that I received the money? Is there any way that I can post to paypal using the ID and see if I that transaction was correct?
Additional question
Is this the right approach? All I need is to let anyone click the button, pay and receive a serial key ONLY if the payment was correct. Right now it seems too complex for what I need. I don't understand everything I see on the paypal docs, if you follow it line by line the examples don't work, you have to adapt a lot of the code and I'm not sure about what I'm doing.
I also read IPN's docs but using it I won't be able to redirect the user because everything would be done in the back without the user even knowing what is happening.
Final text
Any help is appreciated. I'm asking here because I saw a lot of another questions about paypal like this one that were upvoted.
The most robust approach is to combine the PayPal Checkout front-end with a v2/orders backend for payment setup and capture.
create order
capture order
This way the capture happens from your server, so you have an immediate success/failure API response -- and can immediately do whatever you need to do to handle the business logic of the digital good purchase (serial key activation/distribution)
Once you have everything working well for the happy path, don't neglect to handle funding source failures, so that if the capture fails due to e.g. the buyer's first card being declined, this is propagated back to the UI and the buyer can select a different funding source.

Passing a custom variable from a PayPal button after a user subscribes

I am working on a subscription service for a test website of mine. I have the infrastructure in place so that when a user registers, they need to subscribe before going to their profile. How can I tell if a user has finished subscribing? I have a flag in my database that will turn to true after they subscribe, but I can't seem to figure out that last handshake.
I tried to set it up when making the button to go to "http://www.example.com/profile.php?completed=true" so that I can simply look for that completed variable, but paypal seems to ignore that. Any thoughts on how to do that?
Upon looking at a similar post on here, I could redirect to a success.php, where it can update the database flag. This is a work around, but is this the only solution? Or is there one similar to what I originally wanted to do? Thanks for your input everyone.
You should make use of Instant Payment Notification
Instant Payment Notification (IPN) is a message service that automatically notifies merchants of events related to PayPal transactions. Merchants can use it to automate back-office and administrative functions, like automatically fulfilling orders and providing customers with order status.

Paypal IPN to update 'units sold' on website

Sorry for the very basic nature of the question, but I've been searching for two days and I'm still not sure how to do this.
I've got a paypal cart/store set up. How do I leverage either paypal IPN or a third party service to identify one specific item of the three items I have for sale, and send me a notification that a copy has been purchased, and then update a counter on my original website?
Again, just suggestions or a guideline would be greatly appreciated - even to point me in the right direction. Thank you.
A basic guideline for you:
have a sandbox account (I assume you already do)
create there a seller and buyer account
set IPN setting for seller account to your testing URL (where you will be checking for certain data returned)
for the URL mentioned above create a php file with IPN validator
and go here https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_IPNandPDTVariables#id08CTB0S055Z to check variables you will be searching for.
I assume you would need to pick num_cart_items and loop throug possible item_nameX variables returned.
You don't need to code anything to validate IPN, use some of these classes:
http://www.micahcarrick.com/php-paypal-ipn-integration-class.html
http://www.phpclasses.org/package/2249-PHP-Process-Paypal-payment-interactions.html

How can I link PayPal PDT transaction to specific order?

I see many examples of how to display transaction information to a user with PDT. I cannot find a way to associate a Paypal payment with a specified ID so that when the transaction is completed, I can update that ID in the database as paid.
How am I supposed to get an ID that I specify back from Paypal so I know what the payment is for? I cannot use the email address or name or anything else. It must be an ID that I specify.
I see some people using item_number, but I am using a Paypal encrypted button so I cannot add on form variables to post to Paypal when the user clicks the pay now button.
I see this on websites all the time, so I know there must be some way to do this. I just can't find it anywhere...
Thank you
Most often people encrypt their own buttons and use either the custom field which gets sent pack to you, or the item number field. Look into how to encrypt your own buttons with PHP.
PayPal offers a sample in their SDK which can be found here.
I stumbled upon this excellent piece that succinctly lays out how to make dynamic encrypted paypal buttons. It is just what I needed. Thanks for pointing me in the right direction!
http://www.stellarwebsolutions.com/en/articles/paypal_button_encryption_php.php

Categories