内容简介:Fuck you PayPal, fuck you so fucking much!The API is the worst, the documentation is confusing, nothing works as expected.I've been trying to get PayPal integrated to add some paid plans onGoNevis.com. Been dealing PayPal API to work with the backend and f
Fuck you PayPal, fuck you so fucking much!
The API is the worst, the documentation is confusing, nothing works as expected.
I've been trying to get PayPal integrated to add some paid plans onGoNevis.com. Been dealing PayPal API to work with the backend and frontend part.
The Subscription payment flow is annoying:
- Make the subscription plans in PayPal account ( alright, this is what most of the payment gateways would do , that's ok! )
- Keep the PLAN ID and its data for later use in the database.
- User decides to subscribe for a Plan:
- Make a billing agreement with the created Plan ID.
- API response was successful:
- Find the approval_link from the API response.
- Redirect to the page.
- User Approve the Billing Agreement
- Return User to the Plan.success_url containing a "token".
- Get the token, use it to execute it Billing Agreement.
- SUCCESS:
- You and customer, live happily after!
- Show user a thank you page or just shut up and give them the premium features.
- Be sure to send an email to them and let them know you appreciate
- FAILED
- Swallow sadness because you just lost a client.
- Now debug why it failed and why you weren't able to catch that in your more than 50 unit tests and integration tests (Why you even bother writing those).
- User Cancels the billing Agreement:
- User will be returned to Plan.cancel_url.
- API response failed:
- Find the reason if you can and loose.
- Meanwhile the purchase is lost.
- Client will be looking at Ghost or WordPress.
- Swallow sadness.
In the above explanation I might have missed couple of steps, I have documented all of this on the code as well, so future me or my son or future generations after my death won't curse me while my body is shaking in the grave.
Alright, up until now I am alright with the hassle of integrating PayPal and I wouldn't even write this blog.
You know what made me to write this ? The IPN, I nstant P ayment N otification.
While looking at IPN, you will see PDT and also WebHooks, which one to choose, the one that you find more annoying of course, which one is more annoying ? apparently all of them. It seems IPN is more reliable than others.
OK, so what happened ?
For last couple of days I'm just trying to get the IPN working via the IPN Simulator in my local machine and on staging server, but that doesn't work!
When you receive a payment, PayPal will send ( HTTP POST ) you a notification about the payment ( and of course other actions ) you get the data, before processing it, you need to verify it with PayPal and no matter what I have tried, the verification failed, no matter what I did.
I tested it with Python, PHP, NodeJS, curl and nothing worked. I searched everywhere to find out why.
I think it took me 2-3 days to finally find a link to find out it's actually a bug on IPN sandbox, means it's actually a bug within PayPal server ( I'm lazy to get the github issue now ). The same code would work in the Production environment, but not the Sandbox!
You may be thinking PayPal is just like any other company, they have bugs and they fix it eventually, yes! Well, just like how they handle Open Cases and side with fucking fraudster buyers and decide in their favor. The same way I guess they limit your account because why not!
Damn it, I've been dealing with this madness for 2 days in row and now I see this is actually broken on staging/IPN simulator.
A free, open source project with one man running the whole show would have handle this by now, we're talking about evil-money-eating-always-on buyer-side-annoying-for-seller PayPal.
If you're not able to fix this, at least update the bug report so people know, that's fine if you're not working on a fix, but just let developers know.
Anyway, I've started writing this post around 1-2 year ago and it was in Draft.
We did implement the PayPal payment for GoNevis, all the features and solid error handling were made with tears. However we dropped it, legally we were not allowed to use them. Why ? because of my nationality as being an Iranian. You can read more about such problem in How I didn't get my first paying customer! (section: PayPal, the Evil, the Pain, the Stupid! )
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。