I am currently working on a PayPal Subscription Integration for a client. But I had some issues with PayPal, do I need to capture the funds when the subscription is activated, and do I need to capture the funds every time the next billing cycle is hit? Or do I only need to do 1 of them?
Like, how does this work?
And how do I cancel a subscription when an error occurs when the user is trying to activate his subscription? Should I just cancel it using an API request from my server, or is there a function in the PayPal JS SDK (in the frontend) to cancel it? Since there is a method to actions.restart() restart the payment flow, but that is not what I want and doesn't work actually since that gives me an error again for some reason.
It's very confusing, the documentation also isn't helping me on that and PayPal's Community forums are kinda dead.
Thank you.
When a PayPal Subscription is approved by the payer, it will become active and bill (capture) automatically. This will be immediate if no start_date is specified.
There is no server-side activation and hence no need for an actions.restart() equivalent.
(An exception to this is if you override the application_context's user_action; this changes the verbiage to indicate you are going to show a review page, and do the activation with an API call)
Cancellations are done using API calls, not the JS SDK.
Related
I'm developing a server that will detect PayPal payments to a specific PayPal account.
I've started looking into the PayPal SDK and got lost... I saw that V1 is deprecated, so I probably should use V2.
The only thing that I need is that PayPal will call my server webhook once the account receives money.
How should I do this?
The only thing that I need is that PayPal will call my server webhook
Don't do that. Use a proper server integration.
You need two routes on your server, one for 'Set Up Transaction' and one for 'Capture Transaction', documented here: https://developer.paypal.com/docs/checkout/reference/server-integration/
The best approval flow for the customer to go through is: https://developer.paypal.com/demo/checkout/#/pattern/server , as your site stays loaded in the background, and it does not redirect away from your page.
When your capture transaction API call runs successfully and completes the order, you will have an immediate response with a payment object and transaction details. Thus, there is no need for the extra asynchronous step of waiting for a separate webhook call (which is prone to errors or exceptions), and your integration will be more robust.
I have stripe already integrated and working but now I'm trying to manage some "corner cases" that can happen in a regular usage and found a case that i'm not sure how to manage.
In my platform all the products i will provide are going to be unique and buyable only once. If 2 people try to buy the same product concurrently, one of them will get it, and the other should get an error when trying to complete the payment.
Currently i have setup webhooks so the backend is able to detect the case but i don't know how to notify stripe to cancel that PaymentIntent at that exact moment, being able to notify also the user.
Is there anything i can do to achieve this? would i be able to cancel the PaymentIntent on that moment so the user can have a custom error message?
Thanks a lot!
I am working on my first Paypal site. I have a form on the site that the customer fills out with custom information. I want to take that information the user fills out and have it send a message to my email along with the payment confirmation that Paypal sends. Any Idea on how to do this? I'm using Angular and Ajax for the front-end and php for the email service. Thanks
What you want is Instant Payment Notification (IPN). It will automatically POST data about any transaction that hits your PayPal account (ie. sales, refunds, disputes, etc.) to a URL that you specify so that you can receive that data and process it accordingly.
Within your IPN script you can update your database, generate email notifications, hit 3rd party web services, etc.
It's a very powerful tool for automating lots of post-transaction processing tasks.
While demanding a custom email to you as the payment receiver, what you didn't mention is the business needs behind it, or put it in other words, what you are planning to do with the custom email.
(I think this topic could turn into a big essay... My conclusion is I'd recommend IPN or EC with IPN. But below is what was on my mind when I got the conclusion.)
The emails to receiver can be used as a primitive way to notify sellers about payments they received or other transaction events. However this requires either a person's manual work to check the emails, or a program to parse the emails and get info out of the emails. Manual work is error prone and once your business grows bigger the number of emails will be overwhelming. A program to parse the emails costs a lot to develop, is unreliable because emails by nature may be delayed (applies to the manual way above too), and as PayPal doesn't consider emails as the preferred way of notification, sellers shouldn't either - maybe the content / format may change. PayPal provides a few better ways, I'll mention later.
Thus, if you want to start small, checking your emails manually could work for a while, until it becomes overwhelming. Unfortunately this email from PayPal isn't customizable.
So here are the ways I know, starting from manual to automated:
Downloaded transaction log from your PayPal profile. This works best if you don't have to check transactions very often. If you only check transactions daily, weekly or even monthly, this works. My nonsense thinking is, it would work if someone really wants to check transactions every minute... but this is really funny.
Transaction detail report. This works only if you have a business account. It's generated daily and you have to download through sFTP. It's mainly used for end-of-day transaction checking. This can also be automated.
Instant payment notification (IPN). Sent automatically once a payment is made or transaction status changes. You need a script at an accessible URL to listen to this notification, and this script should process the IPN once it arrives, for example updating your order status. https://developer.paypal.com/webapps/developer/docs/classic/ipn/integration-guide/IPNIntro/
EC with IPN. If you use Express Checkout (EC) to receive payments, EC returns transaction status immediately with the response of your API call. But, you still need IPN because there are cases which are not triggered by API calls. This is a big topic so please check below page: https://developer.paypal.com/webapps/developer/docs/classic/products/express-checkout/
For other products, similar to #3 and #4 above.
All points above can be explained in a loooong article, or many loooong articles. I'm just too lazy to explain them here.
So conclusion again, do try #3 IPN or #4 EC with IPN.
And, all those ways above may be very confusing for people who just came into this topic. If you write down your business needs instead of demanding the email, people may be able to help in a more specific way.
I just need people to pay me on my site and I need to have statistics with the payments. I was searching for such a long time but I just couldn't find a proper code to do it.
Is there a way to just log every payment as it is made and store it, applying statistics to it later when i want to?
Thanks very much, last time i asked i was pretty much ignored
What you need is Paypal Instant Payment Notification (IPN):
See: https://developer.paypal.com/docs/classic/products/instant-payment-notification/
PHP Example: https://developer.paypal.com/docs/classic/ipn/gs_IPN/
You can enable IPN feature in PayPal account, then insert each payment into database.
Refer to
http://www.rahulsingla.com/blog/2011/11/drupal-handling-paypal-ipn-callbacks-and-saving-data-to-the-database
https://canvascode.wordpress.com/2014/07/22/how-to-set-up-paypal-integration-with-php-mysql/
I'm working on resource locking in SAP Fiori. To be more elaborate I am trying to lock a resource once a user logs in and opens my application and unlock the resource once he logs out or gets logged out.
I am aware of the onExit() event handler which is located in the main.controller.js and is called if the user performs an action which logs him out. This handles all scenarios except one: when the user's session is timed out.
Is anyone aware of a method(UI5 / Gateway layer) that is called once the session time's out?
As far as I think how this is handled is if a user's session is timed out then nothing happens until the user refreshes the screen.
At this point an Odata call is made to fetch data. Once this hits the Gateway it checks and finds out that the session has timed out and triggers a relogin action.
Correct me if I'm wrong. If right does anyone know what is the event handler which does that?
Also I have read up quite a bit about this. This falls under optimistic and pessimistic concurrency. I would like to try a pessimistic apprach and not a optimistic
approach using etags.
Thanks in advance for your time.
Also I cant officially post any code as it would be against policy, but if you have any queries please feel free to ask and I will do my best :). Plus this is more a fact finding mission.
There is no way you can trust a request to be executed from a browser to signal time out. You will end up with locked resources that shouldn't be locked due to lost connectivity, app crashing, battery drain to name a few. A classic problem for web applications!
Instead, you can construct a lock refresh mechanism. Refresh the lock every 30 seconds or so in the background. Just make sure to fetch the latest version of the resource if the lock was ever released!