Paypal payment process integration with automated function

1

Stats

3,971 visits, 6,110 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 16 Jan, 2013. Last updated 19 Feb, 2019

Firs of all excuse me for my English, is not my native language.

Disclaimer: I don't recommend anyone to use the files i give in this tutorial in a production server, I'm no responsible of any lost, hack, liability or any other thing that happen for the use of this files.

The purpose of this tutorial is to guide people in the payment process integration with Paypal, but you need to study a little to make great things happen.

Requirements:

- Paypal account (you at least must know how to use it)

- Web Server with PHP (no free host, unless you find a great free PHP host with cURL built in, try to find at least a shared host. Note that is for testing purposes, i recommend you for real environment your own VPS, AWS and so on)

Where going to use the Instant Payment Notification (IPN) service from paypal.

Short description: Instant Payment Notification (IPN) is a message service that notifies you of events related to PayPal transactions. You can use it to automate back-office and administrative functions, such as fulfilling orders, tracking customers, and providing status and other information related to a transaction.

For use this service we're going to need 4 files:

- The listener (ipn.php)

- A certify (cacert.pem)

- A pay form (payform.php)

- The check items file (itemcheck.php)

The listener will receive the Paypal transactions and if the transaction is ok it will create a file in your server inside a folder called "pays" with the id of the player.

The certify as always, you need a key for transactions.

The pay form is where you copy your html from your paypay account.

The check items file is the one that finds if the user already pay for the weapon and if so, show to the player. You can find a capx file with an ajax query to this file.

You can download all those files here:

http://www.xerira.com/paypal/paypal.zip

Put all the files in your server for example:

example.com/paypal/ipn.php

example.com/paypal/cacert.php

example.com/paypal/payform.php

example.com/paypal/itemcheck.php

You can put where you want but remember that path because we need for the next step.

Now we need to enable the service in our account so you need to log in to your Paypal account, then you land in My Account tab, under the same tab we need to go on the Profile link:

Then go on the link Instant Payment Notification Preferences:

Set the settings for our IPN:

Now we must fill the Notification URL field with the URL where we place the listener (ipn.php), then select the Receive IPN messages (Enabled) option to get the notifications when someone makes a payment and Save.

Now you should see you current settings, in my case I use one of my testing domains xerira.com/paypal so this is how my settings looks like:

Now that all is up, every payment we receive will be listened by our listener (ipn.php), currently supported payments are eCheck, Express Checkout, Cart Checkout, Web Accept, Refunds, eBay Checkout and Reversal.

So lets create a payment button under the merchant services tab:

When you finish your button copy the code that paypal generates:

And paste into the payform (payform.php)

Now every pay VERIFIED will create a file with the name of the player inside a folder called pays on your server (this is a really lazy validation way, just to omit databases and all the complex things).

You can find a paypal sandbox here: http://www.xerira.com/paypal/

to test the entire project.

Notice that this is not the only way to make an integration with a payment processing service, is just a way or approach to do that.

Remember that in a real production server you will need a lot of things, I always recomend to get a robust framework that speed up the development and help with the intrusion protection, xss/sql injections, active records, ORM's and all those nice things and keep in mind that payments are not straight forward, you will need a solid coding like sessions for the users or at least a token, databases to track the payment and login, your listener must be able to handle bad request, pending request, refunds, frauds, bad connections, lost transactions and keep a record of your customers payments just in case things going wrong, taxes, tickets and all the heavy back-end that a game needs.

Hope this guide gives you a light on the road.

  • 1 Comments

  • Order by
Want to leave a comment? Login or Register an account!
  • 为了成功完成加拿大代写 academicsaviour.com/ca ,您需要了解标准纸张格式。

    1)摘要主要是让导师一眼就知道文章的内容。总之,这是本文的总结和灵魂所在。

    2)导言:主要讲述文章写作本主题的各个方面和部分,并大致说明文章的结构、为什么使用这种结构以及达到什么样的目的。

    3)文献综述是指引用的背景,包括以前的研究和一些自己的评论。参考什么并指出。应注意数据参考的权威性和及时性,因此这一部分需要很长时间。

    4)方法论是一种定性或定量分析方法。

    5)分析results、结论和建议就是results。这需要权威的依据和理论来证明。主要通过上述方法发现了什么?并总结他们的建议。

    6)参考文献需要注意:参考文献的来源、学术权威、及时性和数量。

    7)检查细节。