IJPay Documentation

repository·dev·Indexed 27 days ago

https://github.com/javen205/ijpay

A lightweight, framework-agnostic Java SDK for integrating multiple payment gateways, including WeChat Pay, Alipay, QQ Wallet, JD Pay, UnionPay, and PayPal. It provides wrappers for various payment methods such as APP payment, H5 payment, and QR code payments, and includes demo projects for JFinal, Solon, and Spring Boot.

Tokens
15.8K
Snippets
30
Records
86
Agent score
91%

What's inside IJPay

  1. Overview of QQ Wallet Payment in IJPay

    dev

    IJPay provides support for various QQ Wallet payment methods. The implementation follows a pattern similar to WeChat Pay (wxpay) within the IJPay ecosystem.

    Supported payment methods and tools include:

    • 付款码支付 (Payment Code Payment)
    • 公众号支付 (Official Account Payment)
    • 扫码支付 (Scan Code Payment)
    • APP支付 (App Payment)
    • 企业付款到余额 (Enterprise Transfer to Balance)
    • 现金红包 (Cash Red Packet)
  2. Overview of IJPay

    dev

    IJPay is a backend interface SDK designed for rapid payment module development. It is built as a lightweight utility and does not depend on any specific third-party MVC framework, making it easy to embed into any existing system.

    Key Features:

    • WeChat Pay Support: Supports multiple merchants and multiple applications, including both Ordinary Merchant and Service Provider modes. It supports overseas merchants, both Api-v3 and Api-v2 interfaces, and WeChat Public Key mode.
    • Alipay Support: Supports multiple merchants and multiple applications. Signature methods support both standard public key and public key certificate modes.
    • Framework Agnostic: Can be used in any Java environment without being tied to Spring, JFinal, or other MVC frameworks.
  3. Overview of IJPay features

    dev

    IJPay is a lightweight, module-centric payment toolset designed to be easily embedded into any system without dependency on specific MVC frameworks.

    Key features include:

    • Wide Channel Support: WeChat Pay (Multi-app/Multi-merchant, Service Provider mode, API v2/v3, Overseas), Alipay (Multi-app, Public Key and Public Key Certificate signing), UnionPay (QR scan, App, Official Account, Mini Program, JS Pay, Service Window), PayPal (Automatic AccessToken management), and JD Pay.
    • WeChat Personal Merchant Support: Supports personal WeChat merchants with official asynchronous callback notifications.
    • Lightweight: Designed for simplicity and extensibility with a small footprint.
  4. Supported WeChat Pay methods in IJPay

    dev

    IJPay supports various WeChat Pay modes including both Merchant Mode (商户模式) and Service Provider Mode (服务商模式) for the following payment methods:

    1. Payment Code (付款码支付)
    2. Official Account/JSAPI Pay (公众号支付)
    3. Native Pay (扫码支付)
    4. APP Pay (APP支付)
    5. H5 Pay (H5 支付)
    6. Mini Program Pay (小程序支付)
    7. Face Pay (人脸支付) - Service Provider Mode only
    8. Transfer to Merchant/Bank Card (企业付款到零钱/银行卡)
    9. Cash Red Packet (现金红包)
  5. Join the IJPay VIP service

    dev

    For projects with short development cycles or teams without experience in aggregated payment development, IJPay offers VIP services to provide one-on-one technical support and remote assistance.

    Pricing:

    • Single payment channel (One-on-one support): ¥ 599
    • All payment channels (One-on-one support): ¥ 2999
    • Single payment channel (Remote assistance): ¥ 799
    • All payment channels (Remote assistance): ¥ 3999

    How to join:

    1. Join the communication group: 723992875
    2. Pay via the provided QR codes and include your contact information in the remarks to join quickly.
  6. Perform UnionPay MicroPay (Card Swipe)

    dev

    To implement a card swipe payment (MicroPay), follow these steps:

    1. Build Request Parameters: Use the MicroPayModel.builder() to set parameters such as service (use ServiceEnum.MICRO_PAY.toString()), mch_id, out_trade_no, total_fee, and auth_code.
    2. Sign the Request: Call .createSign(key, SignType.MD5) on the model. Note that UnionPay barcode front-end interfaces currently only support MD5 encryption.
    3. Execute Request: Use UnionPayApi.execution(serverUrl, params) to send the request.
    4. Parse Response: Convert the returned XML string to a Map using WxPayKit.xmlToMap(xmlResult).
    5. Verify Signature: Use WxPayKit.verifyNotify(result, key, SignType.MD5) to ensure the response is authentic.
    6. Check Status: Verify the payment success by checking if status and result_code are both equal to "0".
    // 1. Build and sign request parameters
    Map<String, String> params = MicroPayModel.builder()
            .service(ServiceEnum.MICRO_PAY.toString())
            .mch_id(unionPayBean.getMachId())
            .out_trade_no(WxPayKit.generateStr())
            .body("IJPay 云闪付测试")
            .attach("聚合支付 SDK")
            .total_fee(totalFee)
            .mch_create_ip(ip)
            .auth_code(authCode)
            .nonce_str(WxPayKit.generateStr())
            .build()
            .createSign(unionPayBean.getKey(), SignType.MD5);
    
    // 2. Execute the request
    String xmlResult = UnionPayApi.execution(unionPayBean.getServerUrl(), params);
    
    // 3. Convert XML to Map
    Map<String, String> result = WxPayKit.xmlToMap(xmlResult);
    
    // 4. Verify signature
    if (!WxPayKit.verifyNotify(result, unionPayBean.getKey(), SignType.MD5)) {
        throw new Exception("Signature verification failed");
    }
    
    // 5. Check payment status
    String returnCode = result.get("status");
    String resultCode = result.get("result_code");
    if ("0".equals(returnCode) && "0".equals(resultCode)) {
        // Success
    }
  7. Configure Android Manifest for JPay

    dev

    JPay requires specific permissions and activity registrations in your AndroidManifest.xml to handle payment callbacks.

    <!-- Permissions -->
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    
    <!-- WeChat Pay Activity Registration -->
    <activity
        android:name="com.jpay.weixin.WXPayEntryActivity"
        android:configChanges="orientation|keyboardHidden|navigation|screenSize"
        android:launchMode="singleTop"
        android:theme="@android:style/Theme.Translucent.NoTitleBar" />
    <activity-alias
        android:name=".wxapi.WXPayEntryActivity"
        android:exported="true"
        android:targetActivity="com.jpay.weixin.WXPayEntryActivity" />