CreateRefund

POST /refund/{merchant}

Create a refund

Path parameters

  • merchant string Required

    Merchant name to payment company, e.g. weixinpay.test

application/json

Body

  • Payment method, must be wechatpay or alipay

    Values are wechatpay or alipay.

  • Transaction ID

  • orderRef string Required

    Merchant system order number

  • refundOrderRef string Required

    Merchant refund order no

  • reason string

    Refund message to customer

  • refundAmount number Required

    Refund amount, unit is fen

  • totalAmount number Required

    The total order amount of the original payment, unit is fen

  • currency string

    Amount currency, available options: CNY

  • Notify url, receive notification of refund result of wechat Pay.

  • Special parameters for refund of advance funds on e-commerce platform, REFUND_SOURCE_PARTNER_ADVANCE: advance payment is made by e-commerce platforms, which requires wechat Pay to apply for opening REFUND_SOURCE_SUB_MERCHANT: sub merchant, default value

    Values are REFUND_SOURCE_PARTNER_ADVANCE or REFUND_SOURCE_SUB_MERCHANT.

  • If the order is profiting, this parameter is used

Responses

  • 200

    Create a refund successfully.

    Hide response attributes Show response attributes object
    • code integer(int32)
    • message string | null

      Response message

    • refundId string | null

      Refund ID of payment company

    • orderRef string | null

      Merchant system order number

    • refundOrderRef string | null

      Merchant refund order no

    • transactionId string | null

      Transaction ID

    • channel string | null

      Transaction ID

    • userReceivedAccount string | null

      Bank card no

    • createTime string | null

      Refund create time

    • successTime string | null

      Refund success time

    • status string | null

      Refund state, SUCCESS: The refund is successful, CLOSE: The refund is closed, PROCESSING: The refund is being processed, ABNORMAL: The refund is abnormal.

    • refundAmount number | null

      Refund amount of current refund order, unit is fen

    • totalAmount number | null

      Total amount of current order, unit is fen

    • payerRefund number | null

      The refund amount of payer, unit is fen

    • payerTotal number | null

      The total amount of payer paid, unit is fen

    • settlementAmount number | null

      The refund amount of settlement, unit is fen

    • settlementTotal number | null

      The total amount of settlement, unit is fen

    • Coupons refund amount, unit is fen

    • currency string | null

      Amount currency, ISO 4217 three - letter code

    • Special parameters for refund of advance funds on e-commerce platform, REFUND_SOURCE_PARTNER_ADVANCE: advance payment is made by e-commerce platforms, which requires wechat Pay to apply for opening REFUND_SOURCE_SUB_MERCHANT: sub merchant, default value

      Values are REFUND_SOURCE_PARTNER_ADVANCE or REFUND_SOURCE_SUB_MERCHANT.

    • fundsAccount string | null

      If the order is profiting, this parameter is used

  • 401

    Not Authenticated.

    Hide response attributes Show response attributes object
  • 422

    Request validation failure

    Hide response attributes Show response attributes object
  • 500

    Something wrong when making the payment.

    Hide response attributes Show response attributes object
POST /refund/{merchant}
curl \
 -X POST https://nomad.samarkand-global.cn/broker/v1/refund/wechat.sh_smk \
 -H "app-api-key: $API_KEY" \
 -H "Content-Type: application/json" \
 -d '{"paymentMethod":"wechatpay","transactionId":"4200001148202111020556019250","orderRef":"test20220125001","refundOrderRef":"r001test20220125001","reason":"商品已售完","refundAmount":10,"totalAmount":10,"currency":"CNY","notifyUrl":"https://www.weixin.qq.com","refundAccount":"REFUND_SOURCE_SUB_MERCHANT","fundsAccount":"string"}'
Request example
{
  "paymentMethod": "wechatpay",
  "transactionId": "4200001148202111020556019250",
  "orderRef": "test20220125001",
  "refundOrderRef": "r001test20220125001",
  "reason": "商品已售完",
  "refundAmount": 10,
  "totalAmount": 10,
  "currency": "CNY",
  "notifyUrl": "https://www.weixin.qq.com",
  "refundAccount": "REFUND_SOURCE_SUB_MERCHANT",
  "fundsAccount": "string"
}
Response examples (200)
{
  "code": 200,
  "message": "success",
  "refundId": "refund_id_payment_company",
  "orderRef": "test20220125001",
  "refundOrderRef": "r001test20220125001",
  "transactionId": "4200001148202111020556019250",
  "channel": "ORIGINAL",
  "userReceivedAccount": "0403**",
  "createTime": "2021-11-02T17:03:38+08:00",
  "successTime": "2021-11-02T17:03:38+08:00",
  "status": "SUCCESS",
  "refundAmount": 10,
  "totalAmount": 10,
  "payerRefund": 10,
  "payerTotal": 10,
  "settlementAmount": 10,
  "settlementTotal": 10,
  "discountRefundAmount": 10,
  "currency": "CNY",
  "refundAccount": "REFUND_SOURCE_SUB_MERCHANT",
  "fundsAccount": "string"
}
Response examples (401)
{
  "code": 200,
  "message": "success"
}
Response examples (422)
{
  "code": 200,
  "message": "success"
}
Response examples (500)
{
  "code": 200,
  "message": "success",
  "errors": "Something wrong when making the service."
}