> ## Documentation Index
> Fetch the complete documentation index at: https://docs.y.uno/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Test in the sandbox first: base URL https://api-sandbox.y.uno (Test Mode in the Dashboard). Production is https://api.y.uno (Live Mode).
> Every API request needs the public-api-key and private-secret-key headers. Get them in the Dashboard at https://dashboard.y.uno/developers (Developers > Credentials); sandbox and production keys are different.
> Send an X-Idempotency-Key (a UUID) when creating payments, refunds and cancels, so retries do not create duplicates.
> Start with the Quickstart (https://docs.y.uno/docs/quickstart.md) and the agent guide (https://docs.y.uno/agents.md). To search these docs from a coding agent, connect the docs MCP server at https://docs.y.uno/mcp.

# 卡验证

> 在注册或支付时验证客户的卡是否有效，且不向客户扣款。

Yuno 让您可以验证客户的信用卡是否真实且可正常使用。我们的信用卡验证 API 旨在为您的应用提供一种可靠的信用卡交易验证机制，确保为您的用户带来顺畅且安全的支付体验。此操作不会向您的客户产生任何费用。

## 优势

借助 Yuno 卡验证服务，您可以实时保护您的业务：

* **实时验证**：即时验证信用卡详情，确保其准确性和真实性。
* **欺诈防范**：通过验证信用卡信息的合法性，降低欺诈交易的风险。
* **无缝集成**：轻松将我们的 API 集成到您现有的支付处理系统中，最大限度减少开发时间和工作量。

## 集成

首先，您需要定义一个路由才能使用卡验证功能。配置路由时，请务必选择：

* 将 **Card** 作为支付方式。
* 将 **Transaction type** 定义为 **Equal** **VERIFY**。

完成上述配置后，所有卡验证都将按照所创建路由的配置进行处理。

![](https://mintcdn.com/yuno-3979e326/xfsBNkbN7r6yxkZH/images/reference/card-verification/image1.png?fit=max\&auto=format\&n=xfsBNkbN7r6yxkZH\&q=85\&s=d2c5e625f70d65257afd16c0814d2e59)

> [!NOTE]
>
> **选择正确的服务提供商**
>
> * 并非所有服务提供商都提供信用卡验证流程。请始终联系您的技术客户经理，确认哪些服务提供商支持卡验证。
> * Yuno 使用零金额授权进行卡验证。如果服务提供商不支持此流程，我们将在内部：
>   * 对于信用卡，授权最低可能金额，然后取消该授权。
>   * 对于借记卡，以最低可能金额进行一笔购买，然后将其退款。

除了创建路由之外，您还需要选择何时使用验证。您可以在[注册流程](https://docs.y.uno/reference/payment-methods-checkout/enroll-payment-method-checkout.md)中或进行信用[卡支付](https://docs.y.uno/zh-hans/reference/payments/create-payment.md)时验证卡。根据您选择的流程，您应使用不同的 endpoint 或 SDK 函数。

### 在注册时验证卡

无论您使用的是 Direct 集成还是 SDK 集成，都可以在注册时验证卡。

#### SDK 集成

如果您使用基于 SDK 的集成，则需要在执行注册时定义 `verify` 对象，并提供 `currency` 和 `vault_on_success = true`。以下代码块展示了使用 SDK 进行卡验证的请求和响应示例。

```json Request theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
  "payment_method_type": "CARD",
	"country":"DE",
	"account_id":"493e9374-510a-4201-9e09-de669d75f256",
    "verify": {
        "vault_on_success": true,
        "currency": "EUR"
    }
}

```

```json Response theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
    "id": "fbc68364-0456-41b6-9743-1acb07d55f14",
    "idempotency_key": null,
    "account_id": "493e9374-510a-4201-9e09-de669d75f256",
    "name": "Card",
    "description": "Card",
    "type": "CARD",
    "category": "CARD",
    "country": "BR",
    "status": "READY_TO_ENROLL",
    "created_at": "2024-01-31T14:44:33.552281Z",
    "updated_at": "2024-01-31T14:44:33.552283Z",
    "enrollment": {
        "session": "232b123d-c4d9-4ddc-b776-e0b0eaa6bb8b",
        "sdk_required_action": true
    },
    "provider": {
        "id": "YUNO",
        "type": "YUNO",
        "provider_status": null
    },
    "customer_payer": {
        "first_name": "Fernando",
        "last_name": "Iglesias",
        "email": "Anastasia.Kirlin16@yahoo.com",
        "gender": null,
        "date_of_birth": null,
        "document": null,
        "phone": null,
        "billing_address": null
    },
    "verify": {
        "vault_on_success": true,
        "currency": "BRL",
        "payment": null
    },
    "preferred": null
}
```

请访问 [SDK 集成](https://docs.y.uno/reference/payment-methods-checkout/enroll-payment-method-checkout.md)页面，了解与注册流程相关的更多信息。

#### Direct 集成

要通过 Direct 集成在注册时验证卡，您将使用 [Enroll Payment Method](https://docs.y.uno/reference/payment-methods-direct-workflow/enroll-payment-method-api.md) endpoint。除了 `card_data` 对象之外，您还需要提供 `verify` 对象。在 `verify` 对象中，您需要定义 `currency` 并提供 `vault_on_success = true`。以下代码块展示了使用 [Enroll Payment Method](https://docs.y.uno/reference/payment-methods-direct-workflow/enroll-payment-method-api.md) 进行卡验证的请求和响应示例。

```json Request theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
    "account_id": "493e9374-510a-4201-9e09-de669d75f256",
    "country": "DE",
    "type": "CARD",
    "workflow": "DIRECT",
    "card_data": {
        "holder_name": "John Smith",
        "expiration_month": 10,
        "expiration_year": 24,
        "number": "4988080000000000",
        "security_code": "123"
    },
    "verify": {
        "vault_on_success": true,
        "currency": "EUR"
    }
}
```

```json Response theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
    "name": "VISA ****0000",
    "description": "VISA ****0000",
    "type": "CARD",
    "category": "CARD",
    "country": "BR",
    "status": "ENROLLED",
    "sub_status": null,
    "vaulted_token": "5d4d8b95-c6f8-4336-b051-9eb06a436139",
    "callback_url": null,
    "action": "FORM",
    "redirect_url": null,
    "created_at": "2024-01-31T14:47:39.643700Z",
    "updated_at": "2024-01-31T14:47:39.643701Z",
    "card_data": {
        "iin": "49880800",
        "lfd": "0000",
        "expiration_month": 10,
        "expiration_year": 24,
        "number_length": 16,
        "security_code_length": 3,
        "brand": "VISA",
        "issuer": null,
        "issuer_code": null,
        "category": "BUSINESS ENHANCED",
        "type": "DEBIT"
    },
    "last_successfully_used": null,
    "last_successfully_used_at": null,
    "preferred": null,
    "verify": {
        "vault_on_success": true,
        "currency": "BRL",
        "payment": {
            "id": "0aacd66c-6933-4827-813f-8d76637f874d",
            "account_id": "493e9374-510a-4201-9e09-de669d75f256",
            "description": "VERIFY CARD",
            "country": "BR",
            "status": "SUCCEEDED",
            "sub_status": "VERIFIED",
            "merchant_order_id": "VERIFY_CARD_5d4d8b95-c6f8-4336-b051-9eb06a436139",
            "created_at": "2024-01-31T14:47:39.717571Z",
            "updated_at": "2024-01-31T14:47:41.617945Z",
            "amount": {
                "currency": "BRL",
                "value": 0,
                "refunded": 0,
                "captured": 0
            },
            "transactions": [
                {
                    "id": "ead4ed19-5998-4b40-9910-d2dfe25b9fe0",
                    "type": "VERIFY",
                    "status": "SUCCEEDED",
                    "response_code": "SUCCEEDED",
                    "response_message": "Transaction successful",
                    "category": "CARD",
                    "merchant_reference": "VERIFY_CARD_5d4d8b95-c6f8-4336-b051-9eb06a436139",
                    "provider_data": {
                        "id": "CIELO",
                        "transaction_id": "",
                        "account_id": "",
                        "status": "true",
                        "sub_status": "",
                        "status_detail": "",
                        "response_message": "Transacao autorizada",
                        "response_code": null,
                        "raw_response": {
                            "ReturnCode": "00",
                            "ReturnMessage": "Transacao autorizada",
                            "Valid": true
                        },
                        "third_party_transaction_id": null,
                        "third_party_account_id": null
                    },
                    "created_at": "2024-01-31T14:47:39.827470Z",
                    "updated_at": "2024-01-31T14:47:41.567732Z"
                }
            ]
        }
    }
}
```

> [!NOTE]
>
> **验证功能可用性**
>
> 注册时的验证功能仅适用于使用 Direct 集成且符合 PCI 标准的商户。

### 在支付时验证卡

如果您想通过支付操作验证卡，需要满足两项要求：

* 提供 `amount.value=0`。
* 在 `payment_method.detail.card.` 对象中添加 `verify = true`。

按照上述说明，最终的操作不会向您的客户产生任何费用。

#### SDK 集成

以下代码块展示了 SDK 集成中使用支付操作进行卡验证的示例。

```json Request theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
    "description": "Test Cards",
    "account_id": "493e9374-510a-4201-9e09-de669d75f256",
    "merchant_order_id": "0000022",
    "merchant_reference": "Test Payment",
    "country": "DE",
    "amount": {
        "currency": "EUR",
        "value": 0
    },
    "checkout": {
        "session": "5752d02a-64d2-4953-b8f7-defff1e1b7e6"
    },
    "customer_payer": {
        "id": "9d58f32a-1ec9-4092-94b2-6725363ab447"
    },
    "payment_method": {
        "token": "2c37e3b7-8b06-4e8b-a212-334d7c77e349",
        "detail": {
            "card": {
                "verify":true
            }
        }
    }
}
```

```json Response theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
    "id": "47646d8b-1f99-4097-9df2-3097bf318bb9",
    "account_id": "493e9374-510a-4201-9e09-de669d75f256",
    "description": "Test Cards",
    "country": "BR",
    "status": "SUCCEEDED",
    "sub_status": "VERIFIED",
    "merchant_order_id": "0000022",
    "created_at": "2024-01-31T15:19:03.599525Z",
    "updated_at": "2024-01-31T15:19:06.992590Z",
    "amount": {
        "captured": 0,
        "currency": "BRL",
        "refunded": 0,
        "value": 0
    },
    "checkout": {
        "session": "5752d02a-64d2-4953-b8f7-defff1e1b7e6",
        "sdk_action_required": false
    },
    "payment_method": {
        "vaulted_token": "1f275d9f-a60a-4643-a5b0-ae6e40019fd1",
        "type": "CARD",
        "vault_on_success": true,
        "token": "2c37e3b7-8b06-4e8b-a212-334d7c77e349",
        "payment_method_detail": {
            "card": {
                "verify": true,
                "capture": true,
                "installments": 1,
                "installments_plan_id": null,
                "installments_total_amount": null,
                "first_installment_deferral": 0,
                "installments_type": "MERCHANT",
                "installment_amount": null,
                "soft_descriptor": "",
                "authorization_code": "",
                "retrieval_reference_number": "",
                "acquirer_reference_number": "",
                "voucher": null,
                "card_data": {
                    "holder_name": "Pepito Perez2",
                    "iin": "49880800",
                    "lfd": "0000",
                    "number_length": 16,
                    "security_code_length": 3,
                    "brand": "VISA",
                    "issuer_name": "DEUTSCHE BANK AG INDIA",
                    "issuer_code": null,
                    "category": "BUSINESS ENHANCED",
                    "type": "DEBIT",
                    "three_d_secure": {
                        "version": null,
                        "electronic_commerce_indicator": null,
                        "cryptogram": null,
                        "transaction_id": null,
                        "directory_server_transaction_id": null,
                        "pares_status": null,
                        "acs_id": null
                    }
                }
            }
        }
    },
    "customer_payer": {
        "id": "9d58f32a-1ec9-4092-94b2-6725363ab447",
        "merchant_customer_id": "1706712254",
        "first_name": "Fernando",
        "last_name": "Iglesias",
        "gender": "",
        "date_of_birth": null,
        "email": "Anastasia.Kirlin16@yahoo.com",
        "nationality": null,
        "ip_address": "181.117.11.229",
        "device_fingerprint": null,
        "browser_info": {
            "user_agent": "",
            "accept_header": "",
            "accept_content": null,
            "accept_browser": null,
            "color_depth": "",
            "screen_height": "",
            "screen_width": "",
            "javascript_enabled": null,
            "java_enabled": null,
            "browser_time_difference": null,
            "language": ""
        },
        "document": {
            "document_type": "DNI",
            "document_number": "38799992"
        },
        "phone": null,
        "billing_address": null,
        "shipping_address": null
    },
    "additional_data": null,
    "taxes": null,
    "transactions": {
        "id": "9be01510-afab-450a-86cc-916d0d4cd8a5",
        "type": "VERIFY",
        "status": "SUCCEEDED",
        "category": "CARD",
        "amount": 0,
        "provider_id": "CIELO",
        "payment_method": {
            "vaulted_token": "1f275d9f-a60a-4643-a5b0-ae6e40019fd1",
            "type": "CARD",
            "vault_on_success": true,
            "token": "2c37e3b7-8b06-4e8b-a212-334d7c77e349",
            "detail": {
                "card": {
                    "verify": true,
                    "capture": true,
                    "installments": 1,
                    "installments_plan_id": null,
                    "installments_total_amount": null,
                    "first_installment_deferral": 0,
                    "installments_type": "MERCHANT",
                    "installment_amount": null,
                    "soft_descriptor": "",
                    "authorization_code": "",
                    "retrieval_reference_number": "",
                    "acquirer_reference_number": "",
                    "voucher": null,
                    "card_data": {
                        "holder_name": "Pepito Perez2",
                        "iin": "49880800",
                        "lfd": "0000",
                        "number_length": 16,
                        "security_code_length": 3,
                        "brand": "VISA",
                        "issuer_name": "DEUTSCHE BANK AG INDIA",
                        "issuer_code": null,
                        "category": "BUSINESS ENHANCED",
                        "type": "DEBIT",
                        "three_d_secure": {
                            "version": null,
                            "electronic_commerce_indicator": null,
                            "cryptogram": null,
                            "transaction_id": null,
                            "directory_server_transaction_id": null,
                            "pares_status": null,
                            "acs_id": null
                        }
                    }
                }
            }
        },
        "response_code": "SUCCEEDED",
        "response_message": "Transaction successful",
        "reason": null,
        "description": "Test Cards",
        "merchant_reference": "Pago de test 001",
        "provider_data": {
            "id": "CIELO",
            "transaction_id": "",
            "account_id": "",
            "status": "true",
            "sub_status": "",
            "status_detail": "",
            "response_message": "Transacao autorizada",
            "response_code": "SUCCEEDED",
            "raw_response": {
                "ReturnCode": "00",
                "ReturnMessage": "Transacao autorizada",
                "Valid": true
            },
            "third_party_transaction_id": "",
            "third_party_account_id": ""
        },
        "created_at": "2024-01-31T15:19:03.704095Z",
        "updated_at": "2024-01-31T15:19:06.639476Z"
    },
    "split": [],
    "callback_url": "https://google.com/?checkoutSession=5752d02a-64d2-4953-b8f7-defff1e1b7e6",
    "workflow": "SDK_CHECKOUT",
    "metadata": [],
    "fraud_screening": null,
    "payment_link_id": "",
    "subscription_code": null
}
```

#### Direct 集成

以下代码块展示了 Direct 集成中使用支付操作进行卡验证的示例。

```json Request theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
    "description": "SUCCESSFUL",
    "account_id": "{{account-code}}",
    "merchant_order_id": "0000023",
    "country": "DE",
    "merchant_reference" : "reference-{{$randomUUID}}",
    "amount": {
        "currency": "EUR",
        "value": 0
    },
    "customer_payer": {
        "first_name": "John",
        "last_name": "Smith",
        "merchant_customer_id": "example00234"
    },
    "workflow": "DIRECT",
    "payment_method": {
        "type": "CARD",
        "detail": {
            "card": {
                "capture": true,
                "verify":true,
                "card_data": {
                    "number": "4988080000000000",
                    "holder_name": "JOHN SMITH",
                    "expiration_month": 10,
                    "expiration_year": 24,
                    "security_code": "456"
                }
            }
        }
    }
}
```

```json Response theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
    "id": "bcb42b81-c729-48cb-b782-1a0b6b706b31",
    "account_id": "493e9374-510a-4201-9e09-de669d75f256",
    "description": "SUCCESSFUL",
    "country": "CO",
    "status": "SUCCEEDED",
    "sub_status": "VERIFIED",
    "merchant_order_id": "0000023",
    "created_at": "2024-01-31T15:07:04.513703Z",
    "updated_at": "2024-01-31T15:07:06.573556Z",
    "amount": {
        "captured": 0,
        "currency": "COP",
        "refunded": 0,
        "value": 0
    },
    "checkout": {
        "session": "",
        "sdk_action_required": false
    },
    "payment_method": {
        "vaulted_token": "",
        "type": "CARD",
        "vault_on_success": false,
        "token": "",
        "payment_method_detail": {
            "card": {
                "verify": true,
                "capture": true,
                "installments": 1,
                "installments_plan_id": null,
                "installments_total_amount": null,
                "first_installment_deferral": 0,
                "installments_type": "MERCHANT",
                "installment_amount": null,
                "soft_descriptor": "",
                "authorization_code": "",
                "retrieval_reference_number": "",
                "acquirer_reference_number": "",
                "voucher": null,
                "card_data": {
                    "holder_name": "JOHN DOE",
                    "iin": "49880800",
                    "lfd": "0000",
                    "number_length": 16,
                    "security_code_length": 3,
                    "brand": "VISA",
                    "issuer_name": "DEUTSCHE BANK AG INDIA",
                    "issuer_code": null,
                    "category": "BUSINESS ENHANCED",
                    "type": "DEBIT",
                    "three_d_secure": {
                        "version": null,
                        "electronic_commerce_indicator": null,
                        "cryptogram": null,
                        "transaction_id": null,
                        "directory_server_transaction_id": null,
                        "pares_status": null,
                        "acs_id": null
                    }
                }
            }
        }
    },
    "customer_payer": {
        "id": null,
        "merchant_customer_id": "example00234",
        "first_name": "Pepito",
        "last_name": "Perez",
        "gender": null,
        "date_of_birth": null,
        "email": null,
        "nationality": null,
        "ip_address": null,
        "device_fingerprint": null,
        "browser_info": {
            "user_agent": "",
            "accept_header": "",
            "accept_content": null,
            "accept_browser": null,
            "color_depth": "",
            "screen_height": "",
            "screen_width": "",
            "javascript_enabled": null,
            "java_enabled": null,
            "browser_time_difference": null,
            "language": ""
        },
        "document": {
            "document_type": "CC",
            "document_number": "38799999"
        },
        "phone": null,
        "billing_address": null,
        "shipping_address": null
    },
    "additional_data": null,
    "taxes": null,
    "transactions": {
        "id": "f0da4c61-0c39-493b-a274-16d204fefad9",
        "type": "VERIFY",
        "status": "SUCCEEDED",
        "category": "CARD",
        "amount": 0,
        "provider_id": "CIELO",
        "payment_method": {
            "vaulted_token": "",
            "type": "CARD",
            "vault_on_success": false,
            "token": "",
            "detail": {
                "card": {
                    "verify": true,
                    "capture": true,
                    "installments": 1,
                    "installments_plan_id": null,
                    "installments_total_amount": null,
                    "first_installment_deferral": 0,
                    "installments_type": "MERCHANT",
                    "installment_amount": null,
                    "soft_descriptor": "",
                    "authorization_code": "",
                    "retrieval_reference_number": "",
                    "acquirer_reference_number": "",
                    "voucher": null,
                    "card_data": {
                        "holder_name": "JOHN DOE",
                        "iin": "49880800",
                        "lfd": "0000",
                        "number_length": 16,
                        "security_code_length": 3,
                        "brand": "VISA",
                        "issuer_name": "DEUTSCHE BANK AG INDIA",
                        "issuer_code": null,
                        "category": "BUSINESS ENHANCED",
                        "type": "DEBIT",
                        "three_d_secure": {
                            "version": null,
                            "electronic_commerce_indicator": null,
                            "cryptogram": null,
                            "transaction_id": null,
                            "directory_server_transaction_id": null,
                            "pares_status": null,
                            "acs_id": null
                        }
                    }
                }
            }
        },
        "response_code": "SUCCEEDED",
        "response_message": "Transaction successful",
        "reason": null,
        "description": "SUCCESSFUL",
        "merchant_reference": "reference-d3286de8-0c0b-4681-b29c-0a82a67de8ba",
        "provider_data": {
            "id": "CIELO",
            "transaction_id": "",
            "account_id": "",
            "status": "true",
            "sub_status": "",
            "status_detail": "",
            "response_message": "Transacao autorizada",
            "response_code": "SUCCEEDED",
            "raw_response": {
                "ReturnCode": "00",
                "ReturnMessage": "Transacao autorizada",
                "Valid": true
            },
            "third_party_transaction_id": "",
            "third_party_account_id": ""
        },
        "created_at": "2024-01-31T15:07:04.628781Z",
        "updated_at": "2024-01-31T15:07:06.512878Z"
    },
    "split": [],
    "workflow": "DIRECT",
    "metadata": [],
    "fraud_screening": null,
    "payment_link_id": "",
    "subscription_code": null
}
```

> [!WARNING]
>
> **重要**
>
> 支付时的验证功能仅适用于使用 Direct 集成且符合 PCI 标准的商户。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.