# Confirm charge

## 确认扣款接口

> 确认扣款接口

```json
{"openapi":"3.1.1","info":{"title":"springboot利用swagger构建api文档---AsiaBill站内支付","version":"1.0"},"tags":[{"name":"V2022-03-站内支付确认扣款请求接口","description":"Unify Payment Intent Controller"}],"servers":[{"url":"http://{paymentApiUrl}"}],"paths":{"/V2022-03/confirmCharge":{"post":{"tags":["V2022-03-站内支付确认扣款请求接口"],"summary":"确认扣款接口","description":"确认扣款接口","operationId":"confirmChargeUsingPOST","parameters":[{"schema":{"type":"string(16)"},"name":"gateway-no","in":"header","description":"网关号","required":true},{"schema":{"type":"string(64)"},"name":"request-id","in":"header","description":"请求id，30分钟之内唯一","required":true},{"schema":{"type":"string(16)"},"name":"request-time","in":"header","description":"时间戳，以毫秒（ms）为单位，请求误差不能超过10分钟","required":true},{"schema":{"type":"string(255)"},"name":"sign-info","in":"header","description":"验签字段，具体加签方式请参阅数据签名过程章节","required":true}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ApiRes«PaymentIntentResp»","originalRef":"ApiRes«PaymentIntentResp»"}}}}},"deprecated":false,"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentIntentReq","originalRef":"PaymentIntentReq"}}},"description":"paymentIntentReq","required":true}}}},"components":{"schemas":{"ApiRes«PaymentIntentResp»":{"type":"object","properties":{"code":{"type":"string","description":"返回码"},"message":{"type":"string","description":"返回信息"},"data":{"description":"返回数据","$ref":"#/components/schemas/PaymentIntentResp","originalRef":"PaymentIntentResp"}},"title":"ApiRes«PaymentIntentResp»"},"PaymentIntentResp":{"type":"object","properties":{"maskCardNo":{"type":"string(18)","description":"号前六后四；最大长度为18，如：422222********1111"},"orderAmount":{"type":"string(10)","description":"商户订单金额，最小单位为元；最大长度为5，如：100.00"},"orderCurrency":{"type":"string(3)","description":"商户订单币种；最大长度为3，如：USD"},"orderInfo":{"type":"string(255)","description":"交易状态描述信息；最大长度为255，如：is order info"},"orderNo":{"type":"string(50)","description":"商户订单号；最大长度为50，如：12167001000000000001"},"orderStatus":{"type":"string(32)","description":"【交易状态】待处理：pending 成功：success 失败：fail；最大长度为32，如：success"},"redirectUrl":{"type":"string(1000)","description":"跳转URL（3D验证URL、本地支付跳转URL），如果此值不为空，则商户需要跳转客户到此地址；最大长度为1000，如：https://3desurl.com"},"remark":{"type":"string(1000)","description":"备注；最大长度为1000，如：remark"},"riskInfos":{"type":"string(1000)","description":"风控信息；最大长度为1000，如：is risk info"},"tradeNo":{"type":"string(32)","description":"流水订单号；最大长度为32，如：2022022416544064513805"}},"title":"PaymentIntentResp"},"PaymentIntentReq":{"type":"object","required":["customerIp","orderAmount","orderCurrency","orderNo","returnUrl","webSite"],"properties":{"callbackUrl":{"type":"string(1000)","description":"服务端异步通知地址；最小长度为1，最大长度为1000，如：https://www.my.shopify.com/callbackUrl"},"customerId":{"type":"string(100)","description":"客户ID；\n商户可以通过接口/customers发起post创建；\n注：tokenType=InitRecurring/Recurring时，为必填项；\n最大长度为100；\n如：cus_1420997690607206400"},"customerPaymentMethodId":{"type":"string(100)","description":"卡支付ID；\n商户可以通过接口/payment_methods发起post创建；\n注：tokenType=Recurring时或者非PCI商户，为必填项；customerPaymentMethodId和customerPaymentMethod对象二选一；\n如：pm_1420997693836820480"},"customerIp":{"type":"string(50)","description":"客户ip地址；最小长度为1，最大长度为50，如：192.168.0.1"},"customerPaymentMethod":{"description":"支付卡号相关信息","$ref":"#/components/schemas/PaymentMethodReq","originalRef":"PaymentMethodReq"},"goodsDetails":{"type":"array","description":"商品信息；\njsonObjectList，最多十个商品信息，大部分银行要求商品明细，请商户尽量收集并传过来","items":{"$ref":"#/components/schemas/商品信息","originalRef":"商品信息"}},"isMobile":{"type":"string(1)","description":"客户端类型；\n0:web,1:h5,2:app_SDK,3：mini_app(小程序)，默认：0；固定长度为1，如：0"},"orderAmount":{"type":"string(16)","description":"商户订单金额；\n最多两位小数，注：如果币种最小单位为元，则只能为整数；最小长度为1，最大长度为16，如：100.99"},"orderCurrency":{"type":"string(3)","description":"3位字母的ISO币种代码；固定长度为3，如：USD"},"orderNo":{"type":"string(50)","description":"商户订单号；最小长度为1，最大长度为50，如：12167001000000000001"},"platform":{"type":"string(10)","description":"平台标识名称；\n如果商户是SaaS平台，为必填项；最小长度为1，最大长度为10，如：Shopify"},"remark":{"type":"string(500)","description":"订单备注；最大长度为500，如：remark"},"returnUrl":{"type":"string(1000)","description":"交易完成页面跳转地址；最小长度为1，最大长度为1000，如：https://www.my.shopify.com/redirectUrl"},"shipping":{"description":"收件人信息","$ref":"#/components/schemas/Shipping","originalRef":"Shipping"},"tokenType":{"type":"string(100)","description":"循环扣款类型；\nInitRecurring/Recurring，首笔交易：InitRecurring，非首笔交易：Recurring；最大长度为100"},"webSite":{"type":"string(200)","description":"商户店铺网址；最小长度为1，最大长度为200，如：https//www.my.shopify.com"},"priorityThreeDSecure":{"type":"string(20)","description":"优先3D通道，any：任何场景，automatic：自动3D验证"}},"title":"PaymentIntentReq"},"PaymentMethodReq":{"type":"object","required":["billingDetail","card"],"properties":{"billingDetail":{"description":"账单地址信息","$ref":"#/components/schemas/BillingDetail","originalRef":"BillingDetail"},"card":{"description":"卡号信息","$ref":"#/components/schemas/Card","originalRef":"Card"}},"title":"PaymentMethodReq"},"BillingDetail":{"type":"object","required":["address","email","firstName","lastName","phone"],"properties":{"Address":{"type":"object","required":["city","country","line1"],"properties":{"city":{"type":"string(100)","description":"城市；最小长度为2，最大长度为100；如：Maryland"},"country":{"type":"string(2)","description":"国家代码；\n请传入两位字母的ISO国家代码；如：US"},"line1":{"type":"string(500)","description":"地址1；最小长度为2，最大长度为500，如：west street"},"postalCode":{"type":"string(30)","description":"邮编；最大长度为30，如：21133"},"state":{"type":"string(2)","description":"州；\n请传入两位字母的ISO州代码，美国、加拿大、印度所在地的客户则为必填项；如：MD"}},"title":"Address"},"email":{"type":"string(200)","description":"邮箱；最小长度为2，最大长度为200；如：abc@mail.com"},"firstName":{"type":"string(100)","description":"名；最小长度为1，最大长度为100，如：asia"},"lastName":{"type":"string(100)","description":"姓；最小长度为1，最大长度为50，如：bill"},"phone":{"type":"string(50)","description":"电话号码；最小长度为2，最大长度为50；如：13212344321"}},"title":"BillingDetail"},"Card":{"type":"object","required":["cardExpireMonth","cardExpireYear","cardNo","cardSecurityCode"],"properties":{"brand":{"type":"string(100)","description":"卡组织名称；最大长度为100，如：Visa"},"cardExpireMonth":{"type":"string(2)","description":"月份；固定长度为2"},"cardExpireYear":{"type":"string(4)","description":"年份；固定长度为4"},"cardNo":{"type":"string(19)","description":"卡号；最小长度为13，最大长度为19"},"cardSecurityCode":{"type":"string(4)","description":"卡安全码；最小长度为3，最大长度为4"},"last4":{"type":"string(4)","description":"卡后四位；最大长度为4"}},"title":"Card"},"商品信息":{"type":"object","properties":{"goodsCount":{"type":"string(30)","description":"商品数量；最大长度为30，如：2"},"goodsPrice":{"type":"string(30)","description":"商品价格；最大长度为30，如：100"},"goodsTitle":{"type":"string(100)","description":"商品名称；最大长度为100，如：iphone"}},"title":"商品信息","description":"商品信息"},"Shipping":{"type":"object","properties":{"address":{"description":"收件人地址","$ref":"#/components/schemas/Address","originalRef":"Address"},"firstName":{"type":"string(100)","description":"收件人名；最大长度为100，如：asia"},"lastName":{"type":"string(100)","description":"收件人姓；最大长度为100，如：bill"},"phone":{"type":"string(50)","description":"收件人电话号码；最大长度为50，如：13212344321"}},"title":"Shipping"},"Address":{"type":"object","required":["city","country","line1"],"properties":{"city":{"type":"string(100)","description":"城市；最小长度为2，最大长度为100；如：Maryland"},"country":{"type":"string(2)","description":"国家代码；\n请传入两位字母的ISO国家代码；如：US"},"line1":{"type":"string(500)","description":"地址1；最小长度为2，最大长度为500，如：west street"},"postalCode":{"type":"string(30)","description":"邮编；最大长度为30，如：21133"},"state":{"type":"string(2)","description":"州；\n请传入两位字母的ISO州代码，美国、加拿大、印度所在地的客户则为必填项；如：MD"}},"title":"Address"}}}}
```

### 请求报文示例

{% code title="confirmCharge.sh" %}

```
curl --request POST \
  --url https://{paymentApiUrl}/V2022-03/confirmCharge \
  --header 'Content-Type: application/json' \
  --header 'request-id: 58675' \
  --header 'request-time: 1651888520935' \
  --header 'gateway-no: 12345001' \
  --header 'sign-info: 787966BF2479A1BE8E1886CD18E6919447FAF4F357E7056188D4F035661B822B' \
  --data '{
    "callbackUrl": "https://sandbox-pay.asiabill.com/services/v3/CallResult",
    "customerId": "cus_1526760517237616640",
    "customerIp": "192.168.3.27",
    "customerPaymentMethodId": "pm_1526760521989763072",
    "goodsDetails": [
        {
            "goodsCount": "1000",
            "goodsPrice": "154.23",
            "goodsTitle": "apple"
        }
    ],
    "isMobile": "0",
    "orderAmount": "194.13",
    "orderCurrency": "USD",
    "orderNo": "NEW_API1916436298025",
    "platform": "",
    "remark": "TEST",
    "returnUrl": "https://sandbox-pay.asiabill.com/services/v3/RedirectResultTest?bankCode=TestBankCode",
    "shipping": {
        "address": {
            "city": "NEWARK VALLEY",
            "country": "US",
            "line1": "4348  Calico Drive",
            "postalCode": "13811",
            "state": "NY"
        },
        "firstName": "Di Mo",
        "lastName": "Shi",
        "phone": "509-675-8948"
    },
    "webSite": "www.AsiaBill.com"
}'
```

{% endcode %}

#### 结果对象属性描述

| property name | type   | description                                                      |
| ------------- | ------ | ---------------------------------------------------------------- |
| code          | String | 返回码                                                              |
| message       | String | 返回信息                                                             |
| data          |        |                                                                  |
| redirectUrl   | String | 跳转URL（3D验证URL、本地支付跳转URL），如果此值不为空，则商户需要跳转客户到此地址                   |
| orderStatus   | String | <p>【交易状态】</p><p>待处理：pending </p><p>成功：success </p><p>失败：fail</p> |
| orderInfo     | String | 交易状态描述信息                                                         |
| remark        | String | 备注                                                               |
| tradeNo       | String | 流水订单号                                                            |
| orderNo       | String | 商户订单号                                                            |
| orderAmount   | String | 商户订单金额                                                           |
| orderCurrency | String | 商户订单币种                                                           |
| riskInfos     | String | 风控信息                                                             |
| maskCardNo    | String | 卡号前六后四                                                           |
