How to Monetize Your Mobile App in China with Ping++: Getting Started and Setup

5 min read

Ping++ is a Chinese payment platform, which provides a common payment interface through the local payment systems, including such industry giants as WeChat or AliPay. The platforms offers a free subscription plan, however, it’s limited to 1000 API requests per month. You can have a look at the whole list of the subscription plans here.

Ping++ comes in extremely handy when you need to develop an application for the Chinese market able to work with local payment systems (and further in the article you’ll understand why). What’s more, the platform allows you to collect payment statistics. So when our team needed to monetize one of the of applications we’ve been developing, we picked Ping++.

Initially, though, we considered Stripe as the main option. Recently, Stripe was announced to support AliPay and WeChat in China. Despite the optimistic tone of the news, it turned out that Stripe supports AliPay only in Hong Kong. Plus, the list of supported currencies is quite limited and doesn’t include yuan.

As for WeChat, it’s not supported by Stripe at all. We hope that’s only a temporary issue and Stripe will provide support of the payment systems for the rest of China soon. For now, though, we decided to use it for payments with credit cards. You should also know that credit card payments aren’t very popular in China, as opposed to in-app payments using WeChat or AliPay, which take 80% of all payments made in the country.

Advantages of Ping++

As we’ve mentioned in the previous point, Ping++ provides a common interface for different payment systems, which is a huge advantage both in term of overall ease of implementation and further maintenance.

Of all similar platforms in China, Ping++ is probably the most advanced and all-around solution that can spare you the effort of painful integration with Chinese payment systems. There is an official Ruby gem available by this link. It’s very simple in use and allows you to create an invoice and verify the callback after the payment.

The gem is also well documented, although there is a slight documentation-related issue that we’re going to cover in the next point. Finally, Ping++ provides the ability to work in the test mode, which corresponds to the real flow.

Disadvantages

The most significant disadvantage about Ping++ is that it’s not localized. And we’re not talking about some specific languages. The only language that’s available on the website is Chinese.

Of course, you can turn to Google translator for help, but that’s hardly the best option because the output is often inaccurate, adding even more confusion. Plus, just when you think things can’t get any worse, you’ll find out that the support team at Ping++ only communicate in Chinese.

That means when you’ve written and sent a two-page long essay asking the support team for help in any language other than Chinese, they’ll simply ignore it. Believe me, the challenge is real!

How it works

Ping++ uses the so-called “channels” when working with payment systems. For one system, there can be several channels, which, in their turn, are used for different types of payments (QR codes, in-app or website payments, etc.).

By default, all channels are inactive, so, before using this or that payment method, you need to pass the activation procedure. Luckily, on the Ping++ side, the activation doesn’t pose any challenges. For every channel, there is an instruction and requirements (for example, here you can find an example of an instruction to activate a QR code for WeChat).

Things get a bit trickier when you start configuring the payment systems. This is mostly because of three things: Chinese language, the systems themselves being sophisticated, and bureaucratic costs. While the process of filling the fields is quite clear (since the instruction says what to write), the configuration of the client app may not be that easy. In most cases, though, it all boils down to activating certain app services or features, which are necessary to work with Ping++.

You should also know about some specifics of the test mode. When activating a channel, things can work perfectly. However, when you switch to the live mode, you may stumble upon errors caused by some issues with the configurations of the payment systems.

Platform configuration

Ping++ comes with a extensive documentation to setup and work with the platform. It assumes that you’ve already created the application and use the admin panel for the first time.

Since Ping++ relies on a common interface, its workflow is very similar even for different systems. After you’ve created the hash with the required data, you create a payment invoice using pingpp. Next, either the payment invoice is forwarded to the client SDK or a QR code is created based on the link in the invoice. The user makes the payment, returning the result to the server as a callback.

After you’ve created the app, you need to go through the verification procedure, specifying the required information. This is necessary for you to be able to use the Live mode. The platform will be reminding you about this in the settings menu.

App in China

When initializing pingpp, you need to specify the AppId, which you can get in the dashboard.

App Monetization in China
This is the path to the public key, which is in the settings of the app. The secret keys for both the test and the production environments are there as well: “Test Secret Key” and “Live Secret Key” accordingly.

App Monetization in China

App Monetization in China

We recommend using your own private key. After you activate the key, simply specify the path to it in pingpp.

App Monetization in China

Next, you need to configure the web hooks both in the test and the Live modes. A successful payment will trigger a callback with the result based on the specified address. The request will also include JSON containing the information about the payment as well as the meta data, which was specified when the payment invoice was created.

App Monetization in China

In the form, you need to specify the address to which the web hook will connect as well as the event. In our case, the event is called “charge.succeed”.

To make a request for creating a payment, you need to pass a hash with a specific information. For different channels, the requirements to the hash may vary. You can learn more about this point in the main documentation.

App Monetization in China

Ping++ channels work in a rather specific way. For example, for payment with a QR code in WeChat or AliPay, the channels “”wx_pub_qr” and “alipay_qr” are used. Likewise, for payment with a mobile app, “wx” and “alipay” are used. For payment in AliPay on a desktop PC — “alipay_pc_direct”.

To activate a channel, you need to fill in the information about your app. Also, you’ll need to properly configure the apps of the payment system and setup both the verification and the activation of required features for the payment methods. Even if a channel is activated and everything works perfectly in the test environment, an improper configuration of the payment systems will result in an error in the Live environment.

App Monetization in China

Payments using WeChat QR code

First, you need to select the channel that corresponds to a specific payment method.
App Monetization in China

After that, you need to fill in the information about the app. You can find the instruction by clicking the link to the right.

App Monetization in China
Using pingpp, you can create a request to generate a payment invoice. The hash and the required info are passed with an argument. For example:

Keep in mind that the price is specified in the minimum units. The callback comes with the information that will be used when receiving the callback with the result. If everything is fine, a payment invoice is created and then returned in the form of JSON. We’re talking about QR code, so it’s the “wx_pub_qr” that you will need to pay attention to.

From the specified address, you need to create a QR code, which will be displayed to the user. After the user scans it, they will be redirected to the WeChat’s payment app. As soon as the payment is made, the callback with the result is triggered. However, before starting to process the data from the callback, you should verify the request for security reasons. In pingpp, you can do it quite easily:

To display the result to the user, you need to initiate the watcher for verifying the status of the payment. You can find more information about this point here.

Payments with AliPay PC direct

Selecting the channel:

App Monetization in China

Next, you need to fill in the required keys:

App Minetization in China

Using ping app, you can create a request to generate an invoice. Bot the hash and the required info are passed with an argument. For example:

This returns JSON of the invoice, which you need to pass to H5 SDK. It’s a pluggable JavaScript library, to which JSON of the invoice is passed.

This method redirects the user to the corresponding payment system. After making the payment, the user is returned to the address, which was specified in the “extra” field. After that, you need to wait for the callback with the result about the payment.

Payment with mobile apps

For WeChat and AliPay, the process of configuration is identical. The only thing that’s different is the names of the channels: “wx” for Wechat and “alipay” for AliPay.

Selecting the channels:

App Monetization in China

The mobile app makes a request to the API with required parameters. The server creates a hash and a payment invoice. JSON that was received is returned to the app. Next, using the SDK, the payment is made, triggering the callback, which returns the result to the server.

In conclusion

Despite some challenges with configuration and language limitations, Ping++ is a simple and almost user-friendly payment platform, which works perfectly for the Chinese audience due to its cultural and technical specifics. More importantly, it does its job, i.e. provides easy access to the most popular Chinese payment systems without having to build ugly workarounds. It’s one of the few platforms that can do that.

If you’ve liked the article, please support with claps or leave your comments in the comment section below. Peace!

Editor's Choice

Post Image
8 min read

Migration from PostgreSQL v.9.6 to v.12.11 with minimum downtime

About a year and a half ago we had the following situation: we used PostgreSQL version 9.6 as a database, which was hosted…

Post Image
5 min read

Definition of Ready & Definition of Done

To ensure the high quality of your end products, it is important to establish quality checks before delivering them to a client. Any…

Post Image
8 min read

Leveraging Copilot, ChatGPT to Solve Technical Challenges: Case Study

Artificial intelligence (AI) tools have revolutionized how we approach technical challenges. Whether improving customer experience, optimizing business operations, or enhancing product design, AI…

Get the best content once a month!

Once a month you will receive the most important information on implementing your ideas, evaluating opportunities, and choosing the best solutions! Subscribe