Beispiel #1
0
    private void OnPayCallback(int code, JsonData jsonOrder)
    {
        log(string.Format("UCCallbackMessage - OnPayCallback: code={0}", code));

        ////输出支付回调信息到页面(接入后删除)
        //GameMain.setSdkMessage (string.Format ("UCCallbackMessage - OnPayCallback: code={0}", code));

        if (code == UCStatusCode.SUCCESS)
        {
            string orderId     = (string)jsonOrder ["orderId"];
            float  orderAmount = (float)jsonOrder ["orderAmount"];
            int    payWayId    = (int)jsonOrder ["payWayId"];
            string payWayName  = (string)jsonOrder ["payWayName"];

            //充值下单成功,游戏应对下单结果进行处理,一般需把订单号、下单金额、支付渠道ID、支付渠道名称等信息上传到游戏服务器进行保存
            log(string.Format("UCCallbackMessage - received order info: code={0}, orderId={1}, orderAmount={2:0.00}, payWayId={3}, payWayName={4}",
                              code, orderId, orderAmount, payWayId, payWayName));

            ThirdPartyPlatform.OnPayForCommodity(true, orderId);
            //游戏根据需要进行订单处理,一般需要把订单号传回游戏服务器,在服务器上保存
        }
        else if (code == UCStatusCode.PAY_USER_EXIT)
        {
            //充值界面已关闭,回到游戏画面,游戏应根据实际需要决定是否进行画面刷新
        }
        else
        {
            //充值调用失败
        }
    }
    public void paymentNotify(string args)
    {
        ParseReceiveParams(args);

        string result = GetReceiveParam(KeyResult);
        string error  = GetReceiveParam(KeyError);

        Debug.Log("[U3d2NdReceiver]: paymentNotify------------------- the result is " + result);
        Debug.Log("[U3d2NdReceiver]: paymentNotify------------------- the error is " + error);

        string orderId        = GetReceiveParam(KeyOrderId);
        string productId      = GetReceiveParam(KeyProductId);
        string productName    = GetReceiveParam(KeyProductName);
        string price          = GetReceiveParam(KeyProductPrice);
        string origPrice      = GetReceiveParam(KeyProductOrigPrice);
        string count          = GetReceiveParam(KeyProductCount);
        string payDescription = GetReceiveParam(KeyPayDescription);

        Debug.Log("[U3d2NdReceiver]: paymentNotify------------------- the orderId is " + orderId);
        Debug.Log("[U3d2NdReceiver]: paymentNotify------------------- the productId is " + productId);
        Debug.Log("[U3d2NdReceiver]: paymentNotify------------------- the productName is " + productName);
        Debug.Log("[U3d2NdReceiver]: paymentNotify------------------- the price is " + price);
        Debug.Log("[U3d2NdReceiver]: paymentNotify------------------- the origPrice is " + origPrice);
        Debug.Log("[U3d2NdReceiver]: paymentNotify------------------- the count is " + count);

        if (IsSuccess())
        {
            ThirdPartyPlatform.OnPayForCommodity(IsSuccess(), orderId);

            Statistics.INSTANCE.ChargeEvent(orderId, "91", productName, count, price);
        }
        else
        {
            ThirdPartyPlatform.OnPayForCommodity(IsSuccess(), orderId);
        }


        /*
         * switch(code){
         *                      case NdErrorCode.ND_COM_PLATFORM_SUCCESS:
         *                      Toast.makeText(mCtx, "购买成功", Toast.LENGTH_SHORT).show();
         *                      break;
         *              case NdErrorCode.ND_COM_PLATFORM_ERROR_PAY_FAILURE:
         *                      Toast.makeText(mCtx, "购买失败", Toast.LENGTH_SHORT).show();
         *                      break;
         *              case NdErrorCode.ND_COM_PLATFORM_ERROR_PAY_CANCEL:
         *                      Toast.makeText(mCtx, "取消购买", Toast.LENGTH_SHORT).show();
         *                      break;
         *              case NdErrorCode.ND_COM_PLATFORM_ERROR_PAY_ASYN_SMS_SENT:
         *                      Toast.makeText(mCtx, "订单已提交,充值短信已发送", Toast.LENGTH_SHORT).show();
         *                      break;
         *              case NdErrorCode.ND_COM_PLATFORM_ERROR_PAY_REQUEST_SUBMITTED:
         *                      Toast.makeText(mCtx, "订单已提交", Toast.LENGTH_SHORT).show();
         *                      break;
         *              default:
         *                      Toast.makeText(mCtx, "购买失败", Toast.LENGTH_SHORT).show();
         *              }
         * */
    }
Beispiel #3
0
    void OnPayForOrderIAP(string args)
    {
        ParseReceiveParams(args);

        string orderId    = GetReceiveParam(KeyOrderId);
        string payName    = GetReceiveParam(KeyPayName);
        string receiptMD5 = GetReceiveParam(KeyiOSReceiptMD5);
        string count      = "1";    // GetReceiveParam(KeyCount);

        if (IsSuccess())
        {
            ThirdPartyPlatform.OnPayForCommodity(IsSuccess(), orderId);
            // Statistics.INSTANCE.ChargeEvent(orderId, "GFanApple", payName, count, gfanMoney);
        }
        else
        {
            ThirdPartyPlatform.OnPayForCommodity(IsSuccess(), "");
        }
    }
Beispiel #4
0
    void OnPayProduct(JsonData json)
    {
        int code = (int)json[SDKConstants.KEY_ERROR_CODE];

        switch (code)
        {
        case NdErrorCode.ND_COM_PLATFORM_SUCCESS:
            JsonData data = json[SDKConstants.KEY_JSON_DATA];

            string orderId     = (string)data[SDKConstants.KEY_ORDER_ID];
            string product     = (string)data[SDKConstants.KEY_PRODUCT_ID];
            string productName = (string)data[SDKConstants.KEY_PRODUCT_NAME];
            float  price       = (float)data[SDKConstants.KEY_PAY_MONEY];
            int    count       = (int)data[SDKConstants.KEY_PRODUCT_COUNT];

            ThirdPartyPlatform.OnPayForCommodity(true, orderId);
            // Toast.makeText(UnityPlayer.currentActivity, "购买成功", Toast.LENGTH_SHORT).show();
            break;

        case NdErrorCode.ND_COM_PLATFORM_ERROR_PAY_FAILURE:
            // Toast.makeText(UnityPlayer.currentActivity, "购买失败", Toast.LENGTH_SHORT).show();
            break;

        case NdErrorCode.ND_COM_PLATFORM_ERROR_PAY_CANCEL:
            // Toast.makeText(UnityPlayer.currentActivity, "取消购买", Toast.LENGTH_SHORT).show();
            break;

        case NdErrorCode.ND_COM_PLATFORM_ERROR_PAY_ASYN_SMS_SENT:
            // Toast.makeText(UnityPlayer.currentActivity, "订单已提交,充值短信已发送", Toast.LENGTH_SHORT).show();
            break;

        case NdErrorCode.ND_COM_PLATFORM_ERROR_PAY_REQUEST_SUBMITTED:
            // Toast.makeText(UnityPlayer.currentActivity, "订单已提交", Toast.LENGTH_SHORT).show();
            break;

        default:
            // Toast.makeText(UnityPlayer.currentActivity, "购买失败", Toast.LENGTH_SHORT).show();
            break;
        }
    }
Beispiel #5
0
    void OnPayProduct(JsonData json)
    {
        int code = (int)json[SDKConstants.KEY_ERROR_CODE];

        switch (code)
        {
        case MiErrorCode.MI_XIAOMI_GAMECENTER_SUCCESS:
            //购买成功
            JsonData data = json[SDKConstants.KEY_JSON_DATA];

            string orderId    = (string)data[SDKConstants.KEY_ORDER_ID];
            int    mibi       = (int)data[SDKConstants.KEY_PAY_MONEY];
            string customInfo = (string)data[SDKConstants.KEY_PAY_CUSTOM_INFO];

            ThirdPartyPlatform.OnPayForCommodity(true, orderId);
            break;

        case MiErrorCode.MI_XIAOMI_GAMECENTER_ERROR_PAY_CANCEL:
            //取消购买
            ThirdPartyPlatform.OnPayForCommodity(false);
            break;

        case MiErrorCode.MI_XIAOMI_GAMECENTER_ERROR_PAY_FAILURE:
            //购买失败
            ThirdPartyPlatform.OnPayForCommodity(false);
            break;

        case MiErrorCode.MI_XIAOMI_GAMECENTER_ERROR_ACTION_EXECUTED:
            //操作正在进行中
            ThirdPartyPlatform.OnPayForCommodity(false);
            break;

        default:
            //购买失败
            break;
        }
    }
    public void paymentNotify(string args)
    {
        ParseReceiveParams(args);

        U3dGfanSender.ShowToast("paymentNotify finishi...IsSuccess " + IsSuccess());
        if (IsSuccess())
        {
            string orderId        = receiveParams[KEY_ORDER_ID];
            string payName        = receiveParams[KEY_PAY_NAME];
            string payDescription = receiveParams[KEY_PAY_DESCRIPTION];
            string gfanMoney      = receiveParams[KEY_PAY_MONEY];
            string count          = receiveParams[KEY_PRODUCT_COUNT];

            ThirdPartyPlatform.OnPayForCommodity(IsSuccess(), orderId);

            Statistics.INSTANCE.ChargeEvent(orderId, "GFan", payName, count, gfanMoney);
        }
        else
        {
            string error = receiveParams[KEY_ERROR_CODE];

            ThirdPartyPlatform.OnPayForCommodity(IsSuccess(), "");
        }
    }