The status quo

Now, if the products want to be connected to payment, alipay and wechat stipulate that companies must apply for it, but there is no way for individuals. The cost of registering and maintaining a company is very high. It also involves financial accounting, taxes, etc. Finally, it can be very troublesome to write off the company if it is not necessary. This can be costly for a start-up product, or for individual developers.

The solution

Is there any way that person can sign up for the native payment interface of wechat and Alipay? There are! XorPay.com is a payment service provider of wechat and Alipay. It can sign the wechat payment interface and Alipay face to face payment interface on behalf of individuals. It supports native/JSAPI/cashier/face to face/H5 payment methods.

Next, introduce the specific steps of personal applet access to pay.

Step 1: RegisterXorPay.comSubmit materials, sign wechat and Alipay, and open interfaces

The second step, refer to small program demo or according to the document docking

XorPay has a ready-made small program demo code available on GitHub

Of course, you can dock according to the document itself, small program documents

The final result is as follows:

  • In app.json add:
    "navigateToMiniProgramAppIdList": [
        "wx6eeed4ca124a1abf"
    ]
Copy the code
  • Small program jump code:
    wx.navigateToMiniProgram({
        appId: 'wx6eeed4ca124a1abf',
        path: 'pages/index/index',
        extraData: {
            'aid': '1'.#aid
            'name': 'XorPay prepaid phone'.'pay_type': 'jsapi'.'price': '0.02'.'order_id': 'm-5'.'notify_url': 'https://abc.com/notify'.'sign': md5.hexMD5('XorPay prepaid phone' + 'jsapi' + '0.02' + 'm-5' + 'https://abc.com/notify' + 'app secret'),
        },
        envVersion: 'develop',
        fail(res) {
            wx.showToast({
                title: res.errMsg,
                icon: 'none'}); }, success(res) { wx.showToast({ title:'ok',
                icon: 'none'}); }});Copy the code

Payment succeeds or cancellations jump back to your applittle with parameters:

  • Pay for success
extraData: {
    status: 'success'
}
Copy the code
  • For cancellation
extraData: {
    status: 'cancel'
}
Copy the code