创建 Batch Refund 对象

创建一个 batch refund 对象来发起批量退款。

请求参数描述
app required string批量退款对应的 app 对象 ID,查看如何获取App ID
batch_no required string批量退款批次号,3-24位,允许字母和英文。
charges required array需要退款的 Charge 列表,一次最多 100 个,详见 批量退款 charges 参数说明
description required string批量退款详情,最多 255 个 Unicode 字符。针对 cmb_wallet & cmb_pc_qr 渠道最多支持 99 字节;针对 jdpay_wap 渠道最多支持 128 字节。
metadata optional hash参考元数据
批量退款 charges 参数说明
参数说明
charge required stringCharge 对象 ID。
amount optional,int退款金额。大于 0, 单位为对应币种的最小货币单位,例如:人民币为分(如退款金额为 1 元,此处请填 100)。必须小于等于可退款金额,不填默认为全额退款。
description optionan,string批量退款详情,最多 255 个 Unicode 字符。
funding_source optional,string微信及 QQ 类退款资金来源。取值范围:unsettled_funds:使用未结算资金退款;recharge_funds:微信-使用可用余额退款,QQ-使用可用现金账户资金退款。注:默认值 unsettled_funds,该参数对于微信渠道的退款来说仅适用于微信老资金流商户使用,包括 wxwx_pubwx_pub_qrwx_litewx_wapwx_pub_scan 六个渠道;新资金流退款资金默认从基本账户中扣除。该参数仅在请求退款,传入该字段时返回。

返回

返回一个 batch refund 对象或者一个错误,详见 错误

定义

POST https://api.pingxx.com/v1/batch_refunds
$batch_re = \Pingpp\BatchRefund::create();
此语言 SDK 暂不支持该接口。
此语言 SDK 暂不支持该接口。
此语言 SDK 暂不支持该接口。
此语言 SDK 暂不支持该接口。
params := &pingpp.BatchRefundParams{}
此语言 SDK 暂不支持该接口。

请求示例

curl  https://api.pingxx.com/v1/batch_refunds \
-H "Content-Type: application/json" \
-u sk_test_ibbTe5jLGCi5rzfH4OqPW9KC: \
-d '{
    "app": "app_abcdefghweqzadfs",
    "batch_no": "batchrefund20160801001",
    "description": "Batch refund description.",
    "charges": [
        {
            "charge": "ch_L8qn10mLmr1GS8e5OODmHaL4",
            "amount": 10,
            "description": "Batch refund description."       
        },
        {
            "charge": "ch_fdOmHaLmLmr1GOD4qn1dS8e5",
            "amount": 10,
            "description": "Batch refund description."
        }
    ]
}'
try {
    $batch_re = \Pingpp\BatchRefund::create(
        [
            'app' => APP_ID,
            'batch_no' => uniqid('bre'), //批量退款批次号,3-24位,允许字母和英文
            'description' => 'Your Description', //批量退款详情,最多 255 个 Unicode 字符
            'charges' => [ //需要退款的  charge id 列表,一次最多 100 个
                'ch_Dq5ibDrLurrPO808q1bP4iT8',
                'ch_TanbTO9OmjP4TGW5a1j1mPiL'
            ]
        ]
    );
    echo $batch_re;                                 // 输出 Ping++ 返回的 batch refund 对象
} catch (\Pingpp\Error\Base $e) {
    if ($e->getHttpStatus() != null) {
        header('Status: ' . $e->getHttpStatus());
        echo $e->getHttpBody();
    } else {
        echo $e->getMessage();
    }
}
待补充。
# 创建 batch_refund
batch_no = Digest::MD5.hexdigest(Time.now.to_i.to_s)[0,12]
params = {
  :app => APP_ID,
  :batch_no => batch_no, # 批量退款批次号,3-24位,允许字母和英文。
  :charges => [
    'ch_bT0eDKO8K0q9j5yLCC5G4az1',
    'ch_qPGC04zjrT4KHWzTq5OiPu5G',
    'ch_9OS0SKDiP0GS5qH8eH5GavzH'
  ],
  :description  => 'This is a batch_refund test.',
  :metadata => {
    :custom_key => 'custom_content'
  }
}

batch_refund = Pingpp::BatchRefund.create(params)
待补充。
params = {
    "app": app_id,
    "batch_no": batch_no,
    "description": "Batch refund description.",
    "charges": [
        "ch_GebHC888m5mPSmPCG48K4Gq9",
        "ch_LizXT0CabDSKOG8CuDKOm1eT",
        "ch_b50e1O0K8a1GWzrX1GqHKSK0"
    ]
}

try:
    # 创建 Batch refund 对象
    br = pingpp.BatchRefund.create(**params)
    print(">> batch transfer instance", br)
except Exception as e:
    raise
func Example_new() {
  params := &pingpp.BatchRefundParams{
    App:         "app_1Gqj58ynP0mHeX1q",
    Batch_no:    "batchrefund20160801001",
    Description: "Your Description",
    Charges: []string{
      "ch_qn5G8GH1SOCCvnv10S8mXTqP",
      "ch_SijjXL8Ki1u1arL1S49q5ifL",
    },
  }
  refunds, err := batchRefund.New(params)
  if err != nil {
    log.Fatal(err)
    return
  }
  fmt.Printf("%#v", refunds)
}
var reParams = new Dictionary<string, object>
            {
                {"app", appId},
                //批量退款批次号,3-24位,允许字母和英文
                {"batch_no", "batchrefund2016113"},
                //需要退款的  charge id 列表,一次最多 100 个
                {"charges", new List<string>
                    {
                 "ch_fn1WXHDur5qPvfffbL1uXnv9",                        					"ch_1OmvXTzr9WnPPKuf50iH4aP0"
                    }
                },
                //批量退款详情,最多 255 个 Unicode 字符
                {"description", "Batch refund description."},
                {"metadata", null}
            };

            var batchRefund = BatchRefund.Create(reParams);

返回示例

{
    "id": "151608161453545122",
    "app": "app_abcdefghweqzadfs",
    "object": "batch_refund",
    "batch_no": "batchrefund20160801001",
    "created": 1409634192,
    "description": "Batch refund description.",
    "charges": [
        {
            "charge": "ch_L8qn10mLmr1GS8e5OODmHaL4",
            "refund": null,
            "status": "created",
            "failure_msg": null,
            "amount": 10,
            "description": "Batch refund description."
        },
        {
            "charge": "ch_fdOmHaLmLmr1GOD4qn1dS8e5",
            "refund": null,
            "status": "created",
            "failure_msg": null,
            "amount": 10,
            "description": "Batch refund description."
        }
    ],
    "refunds": {
        "object": "list",
        "url":null,
        "has_more": false,
        "data": [
            {
                "id": "re_y1u944PmfnrTHyvnL0nD0iD1",
                "object": "refund",
                "order_no": "y1u944PmfnrTHyvnL0nD0iD1",
                "amount": 10,
                "created": 1409634160,
                "succeed": true,
                "status": "succeeded",
                "time_succeed": 1409634192,
                "description": "Batch refund description.",
                "failure_code": null,
                "failure_msg": null,
                "metadata": {},
                "charge": "ch_L8qn10mLmr1GS8e5OODmHaL4",
                "charge_order_no": "123456789",
                "transaction_no": "2004450349201512090096425284"
                ,
				  "funding_source": null,
				  "extra": {}
            },
            {
                "id": "re_nL0nD0iDPmfy1u944HyvnrT1",
                "object": "refund",
                "order_no": "nL0nD0iDPmfy1u944HyvnrT1",
                "amount": 10,
                "created": 1409634160,
                "succeed": true,
                "status": "succeeded",
                "time_succeed": 1409634192,
                "description": "Batch refund description.",
                "failure_code": null,
                "failure_msg": null,
                "metadata": {},
                "charge": "ch_fdOmHaLmLmr1GOD4qn1dS8e5",
                "charge_order_no": "123456789",
                "transaction_no": "2004450349201512090096425285",
				  "funding_source": null,
				  "extra": {}
            }
        ]
    },
    "refund_url": "https://mapi.alipay.com/gateway.do?..."
}