Esempio n. 1
0
        /// <summary>
        ///
        /// 本示例介绍对余额提现和查看用户余额明细对象/对象列表
        /// 余额的消费、退款请查看 OrderDemo 示例
        /// 查看用户当前余额请使用查看 User 对象接口
        ///
        /// </summary>
        public static void Example(string appId)
        {
            var uid      = "test_user_001";
            var orParams = new Dictionary <string, object>
            {
                { "app", appId },
                { "uid", uid },
                { "merchant_order_no", new Random().Next(1, 999999999) },
                { "channel", "wx" }, // 充值接口需要设置支付渠道
                { "amount", 1 },
                { "currency", "cny" },
                { "client_ip", "127.0.0.1" },
                { "subject", "Your Subject" },
                { "body", "Your Body" },
                { "description", "Your description" },
            };

            var wdParams = new Dictionary <string, object>
            {
                { "amount", 1 },
                { "order_no", "20160829133002" },
                { "description", "withdraw request" },
                { "extra", new Dictionary <string, object>
                  {
                      { "card_number", "6225210207073918" },
                      { "user_name", "姓名" },
                      { "open_bank_code", "0102" },
                      { "prov", "上海" },
                      { "city", "上海" }
                  } },
            };

            Console.WriteLine("****创建提现 Withdrawal 对象(发起提现申请)****");
            var wd = Withdrawal.Request(appId, wdParams);

            Console.WriteLine(wd);
            Console.WriteLine();

            Console.WriteLine("****提现完成 Withdrawal 对象****");
            Console.WriteLine(Withdrawal.Confirm(appId, wd.Id));
            Console.WriteLine();

            Console.WriteLine("****查看用户交易明细 Balance Transaction 对象列表****");
            var balanceList = BalanceTransaction.List(appId);

            Console.WriteLine(balanceList);
            Console.WriteLine();

            Console.WriteLine("****查看用户交易明细 Balance Transaction 对象****");
            Console.WriteLine(BalanceTransaction.Retrieve(appId, balanceList.Data.First().Id));
            Console.WriteLine();
        }
Esempio n. 2
0
        /// <summary>
        /// jdpay-渠道余额体现申请
        /// </summary>
        /// <param name="appId"></param>
        /// <returns></returns>
        public static Withdrawal jdpayWithdrawal(string appId)
        {
            var createParams = new Dictionary <string, object>
            {
                { "order_no", "2016111000035" },         //提现订单号,unionpay 为1~16位的纯数字;alipay 为 1 ~ 64 位不能重复的数字字母组合;allinpay 为通联商户号(10位数字) + 不重复流水号组合(10~30位 字母数字组合);wx_pub 规定为 1 ~ 50 位不能重复的数字字母组合;jdpay为 1~64 位不能重复的数字字母组合;
                { "amount", 1 },                         //体现金额。
                { "user_fee", 0 },                       //用户需要承担的手续费。
                { "channel", "jdpay" },                  //提现使用渠道。银联:unionpay,支付宝:alipay,微信:wx_pub,通联:allinpay,京东:jdpay。(v1.34.1)
                { "user", "user_001" },                  //用户 ID。
                { "description", "Your description" },   //描述
                { "extra", new Dictionary <string, object> {
                      { "account", "6214850288888888" }, //收款人银行卡号或者存折号。
                      { "name", "张三" },                  //	收款人姓名。
                      { "open_bank_code", "0308" } //开户银行编号。
                  } },
                //{"settle_account", "320217081417114300000501"}    //使用结算账户提现,不需要填写 channel 和 extra 相关参数,同时填写时,结算账号不生效
            };

            return(Withdrawal.Request(appId, createParams));
        }
Esempio n. 3
0
        /// <summary>
        /// alipay-渠道余额体现申请
        /// </summary>
        /// <param name="appId"></param>
        /// <returns></returns>
        public static Withdrawal alipayWithdrawal(string appId)
        {
            var createParams = new Dictionary <string, object>
            {
                { "order_no", "2016111000032" },         //提现订单号,unionpay 为1~16位的纯数字;alipay 为 1 ~ 64 位不能重复的数字字母组合;allinpay 为通联商户号(10位数字) + 不重复流水号组合(10~30位 字母数字组合);wx_pub 规定为 1 ~ 50 位不能重复的数字字母组合;jdpay为 1~64 位不能重复的数字字母组合;
                { "amount", 1 },                         //体现金额。
                { "user_fee", 0 },                       //用户需要承担的手续费。
                { "channel", "alipay" },                 //提现使用渠道。银联:unionpay,支付宝:alipay,微信:wx_pub,通联:allinpay,京东:jdpay。(v1.34.1)
                { "user", "user_001" },                  //用户 ID。
                { "description", "Your description" },   //描述
                { "extra", new Dictionary <string, object> {
                      { "account", "*****@*****.**" }, //收款人的支付宝账号。
                      { "name", "张三" },                  //收款人姓名。
                      { "account_type", "ALIPAY_USERID" } //收款方账户类型。ALIPAY_USERID:支付宝账号对应的支付宝唯一用户号,以 2088 开头的 16 位纯数字组成;ALIPAY_LOGONID:支付宝登录号,支持邮箱和手机号格式。
                  } },
                //{"settle_account", "320217081417114300000501"}    //使用结算账户提现,不需要填写 channel 和 extra 相关参数,同时填写时,结算账号不生效
            };

            return(Withdrawal.Request(appId, createParams));
        }
Esempio n. 4
0
        /// <summary>
        /// wx_pub/wx-渠道余额体现申请
        /// </summary>
        /// <param name="appId"></param>
        /// <returns></returns>
        public static Withdrawal wxPubWithdrawal(string appId)
        {
            var createParams = new Dictionary <string, object>
            {
                { "order_no", "2016111000033" },       //提现订单号,unionpay 为1~16位的纯数字;alipay 为 1 ~ 64 位不能重复的数字字母组合;allinpay 为通联商户号(10位数字) + 不重复流水号组合(10~30位 字母数字组合);wx_pub 规定为 1 ~ 50 位不能重复的数字字母组合;jdpay为 1~64 位不能重复的数字字母组合;
                { "amount", 1000 },                    //体现金额。
                { "user_fee", 0 },                     //用户需要承担的手续费。
                { "channel", "wx_pub" },               //提现使用渠道。银联:unionpay,支付宝:alipay,微信:wx_pub,通联:allinpay,京东:jdpay。(v1.34.1)
                { "user", "user_001" },                //用户 ID。
                { "description", "Your description" }, //描述
                { "extra", new Dictionary <string, object> {
                      { "open_id", "wxopenid" },       //收款人的 open_id。
                      { "name", "张三" },                //收款人姓名。
                      { "force_check", false } //是否强制校验收款人姓名。仅当 user_name 参数不为空时该参数生效。
                  } },
                //{"settle_account", "320217081417114300000501"}    //使用结算账户提现,不需要填写 channel 和 extra 相关参数,同时填写时,结算账号不生效
            };

            return(Withdrawal.Request(appId, createParams));
        }