Unity3D how to quickly implement WeChat payment, unity3d mail payment

Source: Internet
Author: User

Unity3D: How to Implement payment quickly? unity3d email payment

Andoid version

If you have successfully integrated login and sharing, this article will help you quickly integrate payment. This article is based on payment SDK3.1.1, that is, the latest SDK so far
1) official integration documentation
2) download official resources


Download Resources

However, I believe that even if you read the official documentation, you still do not know how to integrate the payment, because the official documentation for payment is simply too .....

If you have prepared the resource package, start integration.

The resources we need are actually the following. Before we start, just switch to backup.
1) paid APPID
2) Payment dependency package> libammsdk. jar
3) an Activity class >>> WXPayEntryActivity. java

Note that this Activity class can be copied directly from the sample code downloaded to your project, this page is called when you initiate a payment (or cancel or fail) and return to your App. The page layout can be your custom layout, which can be illustrated directly:

Let's first talk about the path of this class. There are also a lot of introductions on the Internet. I just put a picture and the path is certain, and it must be like this:


WXPayEntryActivity path

Note the following two points in this class:
1. The layout in this class can be customized. If you do not need to display any layout, You need to jump to the page and delete this code.


Callback page layout

2. The following is an official processing method for processing the callback result. A dialog is directly provided, and many people will be confused. If you don't need this dialog, simply delete it, you do not need to copy the layout and resources in the official demo.


Official Handling Method

The following is my custom processing method. It is relatively simple, that is, the payment result is displayed on the Tusi. If you need to jump after the payment is successful, you can directly startActivity here, don't forget to finish ()


Custom Processing Method

We do not need to operate the other callback methods in this class.

Then we can start to pay. The payment is very simple.
Parameter List

This is the parameters we need to carry for payment. For new users, it may be confusing how do I generate these parameters? In fact, these parameters are all returned to us by the server. APPID can be saved locally, and the rest are returned to us by the server. The process is as follows:


The payment process is initiated. When the order is submitted, the parameters are configured according to the project requirements. Finally, after the server returns the parameters paid to us, we can make a pleasant payment. Here is the key step, note !!
Key steps for initiating a payment

Now we can call the payment page to make the payment.
Finally, it should be noted that many people are stuck in this step, that is, the issue of open platform signature. In fact, as long as the program signature on your mobile phone is consistent with the signature you registered on the platform, whether it is the debug version or the release version


Open Platform Signature

For the convenience of testing, I temporarily fill in my debug signature. Of course this can be changed. There will be a review period after the modification. I don't know it for a few days, and sometimes it will be very fast, before the application is coming online, remember to change it to a formal signature. I don't know the number of changes. You can Baidu it on your own!


Modify Signature

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.