跳转至

预授权与结算

创建信用卡预授权

预授权可以让你在顾客的银行账号中,冻结部分资金,直到交易实际发生时再扣除。例如,当使用信用卡进行酒店预定的时候。

要进行这样的交易流程,首先你需要创建一个预授权,然后再进行预授权的结算。

HTTP请求

POST /v1/payments/charges/card

Request Headers
    {
        "Content-Type": "application/json",
        "Authorization": "Bearer {{access_token}}",
        "x-api-key": "{{api_key}}"
    }
Request Body
  {
    "idempotencyKey": "1ec983fa-1a37-679b-809b-067861d87ab0",
    "amount": 300,
    "country": "CL",
    "currency": "CLP",
    "paymentMethod": "CREDIT_CARD",
    ...  # other basic request fields
    "capture": false
    ...  # other basic request fields
}
Response
    {
    "transferStatusCode": 200,
    "idempotencyKey": "1ec983fa-1a37-679b-809b-067861d87ab0",
    "referenceId": "1ec983fa-1a37-679b-809b-067861d87ab0",
    "paymentFlow": "DIRECT",
    "paymentMethod": "CREDIT_CARD",
    "amount": 300,
    "currency": "CLP",
    "finalAmount": 300,
    "finalCurrency": "CLP",
    "country": "CL",
    "createTime": "2023-06-07 02:39:36 GMT-07:00",
    "scheduledTime": "2023-06-07 02:39:37 GMT-07:00",
    "finalStatusTime": "2023-06-07 02:39:37 GMT-07:00",
    "payer": {
        "name": "name",
        "document": {
            "documentId": "530315550",
            "type": "RUT"
        },
        "email": "name@liquido.ccom"
    },
    "transferStatus": "AUTHORIZED",
    "description": "this is a test pay",
    "callbackUrl": "https://liquido.com/v1/test/callback/",
    "transferDetails": {
        "card": {
            "cardInfo": {
                "cardHolderName": "card holder",
                "expirationMonth": 7,
                "expirationYear": 2024,
                "brand": "VISA",
                "bin": "458124",
                "last4": "0000"
            }
        }
    }
}

HTTP Headers 字段说明

Authorization "bearer" + " " + {{access_token}}
x-api-key {{api_key}}

Request Body 字段说明

参数 必填 类型 描述
capture Boolean 必须设置为false以创建一个预授权

结算预授权

HTTP请求

POST /v1/payments/charges/card/capture/{{idempotencyKey}}

Request Headers
{
    "Content-Type": "application/json",
    "Authorization": "Bearer {{access_token}}",
    "x-api-key": "{{api_key}}"
}
Request Body
{
    "amount": 150
}
Response
{
    "transferStatusCode": 200,
    "idempotencyKey": "1ec983fa-1a37-679b-809b-067861d87ab0",
    "referenceId": "1ec983fa-1a37-679b-809b-067861d87ab0",
    "paymentFlow": "DIRECT",
    "paymentMethod": "CREDIT_CARD",
    "amount": 300,
    "currency": "CLP",
    "finalAmount": 150,
    "finalCurrency": "CLP",
    "country": "CL",
    "createTime": "2023-06-07 02:39:36 GMT-07:00",
    "scheduledTime": "2023-06-07 02:39:38 GMT-07:00",
    "finalStatusTime": "2023-06-07 02:51:49 GMT-07:00",
    "payer": {
        "name": "name",
        "document": {
            "documentId": "530315550",
            "type": "RUT"
        },
        "email": "name@liquido.ccom"
    },
    "transferStatus": "SETTLED",
    "description": "this is a test pay",
    "callbackUrl": "https://liquido.com/v1/test/callback/",
    "transferDetails": {
        "card": {
            "cardInfo": {
                "cardHolderName": "card holder",
                "expirationMonth": 7,
                "expirationYear": 2024,
                "brand": "VISA",
                "bin": "458124",
                "last4": "0000"
            }
        }
    }
}

HTTP Headers 字段说明

Authorization "bearer" + " " + {{access_token}}
x-api-key {{api_key}}

Path and Query Parameters 字段说明

参数 类型 描述
idempotencyKey String 需要结算的预授权交易的幂等键

Request Body 字段说明

参数 必填 类型 描述
amount Long 预授权的实际结算金额。默认为预授权冻结金额的全额。它可以等于或小于,但不能大于所冻结的金额。

取消预授权

HTTP请求

POST /v1/payments/charges/cancel/{{idempotencyKey}}

Request Headers
{
    "Content-Type": "application/json",
    "Authorization": "Bearer {{access_token}}",
    "x-api-key": "{{api_key}}"
}
Response
  {
    "transferStatusCode": 200,
    "idempotencyKey": "1ec983fa-1a37-679b-809b-067861d87ab09",
    "referenceId": "1ec983fa-1a37-679b-809b-067861d87ab0",
    "paymentFlow": "DIRECT",
    "paymentMethod": "CREDIT_CARD",
    "amount": 300,
    "currency": "CLP",
    "finalAmount": 300,
    "finalCurrency": "CLP",
    "country": "CL",
    "createTime": "2023-06-07 02:54:55 GMT-07:00",
    "scheduledTime": "2023-06-07 02:55:00 GMT-07:00",
    "finalStatusTime": "2023-06-07 02:57:01 GMT-07:00",
    "payer": {
        "name": "name",
        "document": {
            "documentId": "530315550",
            "type": "RUT"
        },
        "email": "name@liquido.ccom"
    },
    "transferStatus": "CANCELLED",
    "description": "this is a test pay",
    "callbackUrl": "https://liquido.com/v1/test/callback/",
    "transferDetails": {
        "card": {
            "cardInfo": {
                "cardHolderName": "card holder",
                "expirationMonth": 7,
                "expirationYear": 2024,
                "brand": "VISA",
                "bin": "404117",
                "last4": "0000"
            }
        }
    }

Path and Query Parameters 字段说明

参数 类型 描述
idempotencyKey String 需要取消的预授权交易的幂等键
回到页面顶部