This article introduces the introduction of Google login and Google in-app purchase as well as Facebook login in their background application corresponding key and some problems encountered in the access process. Both Google Login and Google Pay mobile require corresponding keys to initiate valid login and payment requests.
Google login
-
The firebase background applies for a corresponding application, as shown in Figure 1. To create an application in the project group, you need to fill in the package name and sha-1 value.
-
After successful registration, it is necessary to go to the background of obtaining credentials, as shown in Figure 2, to obtain the corresponding Web client ID, which is used for server login and order verification after successful payment. Note that this key is used by both the client and the server.
Note:
- This content is in two backgrounds.
- ApiException: 8,10,12500,12501 and other errors may occur during login. First, you need to check whether your key is used correctly. Second, you need to open Google login permission (which is opened in the background of firebase).
- I used domestic equipment to test, and found that these status codes are unstable, and it will be normal to log in after a few clicks.
Google pay
1.Google Developer account
First, you need a Google Developer account, which costs $25.
2. Create and configure an application
Create the application in the background of Google Play, as shown in Figure 3. Then follow the relevant prompts, always fill in the corresponding information. Figure 4, Figure 5, etc. When filling in the information in Figure 4, it should be noted that an APP needs to be uploaded before the content rating and other related information can be filled in. Only when the red circle in Figure 5 is filled in, as shown in Figure 6, can the application be published.
3. Release a testable application
Go to Application Version -> Application Version to create a test application and release it according to the process. If the test account is not added, please check this article. It should be noted that after the test account is added successfully, the link of the successful application release should be sent to the tester, and the user’s consent is required to participate in the test.
Note:
-
The application needs to be successfully published to have a link that testers agree to.
-
It takes a certain amount of time for an application to be successfully launched, usually about three hours.
4. Create an item list
After the application is successfully created, go to the store in the background to publish -> In-App Goods to create a list of in-app goods. As shown in figure 8.
- Obtain the public key required by the client for payment, such as
Figure 10.
Shown below.
Through the above steps, you can test the payment process completely. Due to the addition of the test account, there is no actual fee to pay during the test payment process. View the list of items purchased by the application, as shown in Figure 11
You may encounter the following problems when testing payments
Payment was rejected
1.1 Application products may violate local policies. For example, VPN is illegal in many Countries in the Middle East. 1.2 Risk control of bank caused by frequent IP switching due to proxy VPN 1.3 The address of bound bank card is inconsistent with the address registered in Google background, which can be solved by modifying The address of Google, but this method is very complicated and the success rate is very low. 1.4 The order number client with rejected payment is composed of two strings of numbers. In the case of success, the order number is composed of GPA.number. 1.5 It is normal for payment to be rejected. I have consulted many developers of games and applications, and they have encountered payment rejection in foreign countries. It should be able to troubleshoot code problems. 1.6 Mobile phone fails to pay due to root fault
The whole process of preventing lost orders
You can’t buy goods
1.6 The version number of the APK for test payment must be the same as that of the online version, otherwise the test payment fails
Server retrieval exception
- Published new goods need to wait for the client to successfully invoke them.
Product id
andId of the server definition
Don’t match- The public key used by the client is faulty. The important thing to note here is,
Google's background
The public key is sometimes displayed with a space, refreshing the page once is normal.
You already have the item
- In-app purchases are actually two steps, the first is purchase and the second is consumption. If you buy something and don’t use it, you won’t be able to make the next purchase. Note here that if you purchased the item and consumed it unsuccessfully, then call
mHelper
To provide thequeryInventoryAsync
Methods To find out the unconsumed goods and consume the goods. This process is generally related to business logic. For example, what we do now is shown below:
The order lost
In some countries, the order will be lost, and the client will indicate that the payment is successful, but neither the server nor Google background has received the order record. I found this when I was testing Iran, but without confirmation, it’s hard to replicate.
About binding bank card payment
- To pay in real currency, you first need a credit card that supports foreign currency. Such as MAstCard, Visa, etc. You may need to switch your billing address during the process of binding your bank card. Otherwise, it will be difficult to bind your bank card. Test payment can add test account test.
The Google Pay screen cannot pop up
- Do you give Google Service
Display hover
permissions - Whether the account has already purchased goods but has not consumed them, and the payment box will not pop up
The test device service is not supported
- The version of Google Service is too low, so you need to go to the Settings of the App Store and click on the version number, prompting you to update it. The process is a bit slow, it feels like clicks don’t respond, and it’s actually downloading in the background. Need to wait a while, or need to reboot the device, etc. Just keep the app store up to date. Otherwise, the device does not support Google Pay.
About the Google Play Store upgrade
If the Google Services component on the phone is installed through three parties, it is likely that the version is lower. Version of the API that does not support payment 3. At this point, you need to upgrade Google Play Stroe. On the menu bar –> Settings –> Click version number. Then click OK. It should be noted that after clicking ok, the phone may not respond. Actually downloading. Wait for a certain period of time and restart the phone according to the network condition. The application is updated.
Initialization failed
If the version of Google service is up to date and still fails, you can solve the problem in the following ways.
-
You need to delete all Google accounts from your phone
-
Then clean all caches in Google Service and Google Play store
-
Log in to the account again.
-
The mobile phone is not installed with the components related to service, download the go installer to install the components related to the mobile phone, you need to manually update, the default downloaded version is a little old.
About not being able to buy twice
Google Pay is split into Google Buy and Google Subscribe. The goods purchased in Google are divided into two steps, one is to buy, one is to consume. If the purchase is not consumed, the next purchase will not be successful. In this case, the returned error code is 7. In this case, there is a query method, which can query the goods that are not consumed by the current device. Then, call the consumption method again to solve the problem.
Other questions:
- If I create an in-purchased item in the background, but I can use the subscription API call, I can also make a successful purchase. In the same way, subscription products can be created through in-app API calls.
Network not supported
Obviously, testing Google Pay requires using a VPN. If the network is down, then none of the above is said.
Official demo address for Google login access
https://github.com/googlesamples/google-services/tree/master/android/signin
Copy the code
Google Pay access demo
https://github.com/googlesamples/android-play-billing.git
Copy the code
Facebook login
Background address
https://developers.facebook.com/apps
Copy the code
The only thing you need to be careful about is filling in all the corresponding information completely. Because the application is in the development stage, you need to use the test account to complete the relevant tests.
The location of the KEY needs to be obtained
Apply for Login Permission
After filling in the relevant information, you need to wait for a certain period of time.
Problems encountered
Al-qeada raphServiceQueryExecutor: query error x. 3 gz: [code] [message] 1675030: an error occurred when executing the query. [extra]:
Please check whether the test account is correct. The test account must be confirmed to be correct. What I met was that my colleague used another test account. The test name was correct, but it was actually a different project test account.
See other links [links] Google Pay validate 403 error blog.csdn.net/alex_my/art…
The above is my summary of access to Google login and payment. If write wrong place or need to correct please leave a message, thank you.