创建 Pix 密钥
创建 CPF、CNPJ 或随机 Pix 密钥
Request
- MÉTODOPOST
- ENDPOINT/baas/pix/keys
Request Body
{
"account_key": "6d30a0b1-cb90-4ceb-b1ea-5bd600cdf3c8",
"pix_key_type": "random_key"
}
Request Body
{
"account_key": "6d30a0b1-cb90-4ceb-b1ea-5bd600cdf3c8",
"pix_key_type": "cnpj",
"pix_key": "09080702000105"
}
Request Body
{
"account_key": "6d30a0b1-cb90-4ceb-b1ea-5bd600cdf3c8",
"pix_key_type": "cpf",
"pix_key": "03882617038"
}
Pix 密钥类型
"pix_key" 可以是 CPF、CNPJ、电子邮件、手机号或随机密钥(UUID),格式如下:
CPF:11 位整数。
CNPJ:14 位整数。
电子邮件:包含至少一个"@"的文本。
手机号:包含以下内容的文本:"+55" + "手机区号" + "至少 8 位、至多 9 位的手机号码整数"。例如:"+5511987654321"。
随机密钥:UUID。
沙盒环境中的 CPF/CNPJ 规则
为模拟批准和拒绝场景,可使用待创建 Pix 密钥持有人 CPF/CNPJ 的第一位数字:
1, 2, 3, 4, 5 -> 自动拒绝 0, 6, 7, 8, 9 -> 自动批准
Response
- MÉTODOPOST
- ENDPOINT/baas/pix/keys
Response Body
{
"account_key": "6d30a0b1-cb90-4ceb-b1ea-5bd600cdf3c8",
"created_at": "2022-09-02T18:20:52",
"pix_key": {
"account_key": "6d30a0b1-cb90-4ceb-b1ea-5bd600cdf3c8",
"created_at": "2022-09-02T18:20:51",
"pix_key": "09080702000105",
"pix_key_status": "pending_confirmation",
"pix_key_type": "cnpj",
"updated_at": "2022-09-02T18:20:51"
},
"pix_key_request_key": "d60abf67-ad9c-42ee-9089-d26c8fc855b9",
"request_data": {
"account_created_at": "2022-09-02T22:44:36",
"account_digit": "2",
"account_number": "2359934",
"account_type": "checking",
"branch_number": "0001",
"key": "09080702000105",
"owner_document_number": "09080702000105",
"owner_name": "VOVO LUCIA CONVENIENCIA LTDA",
"owner_person_type": "legal",
"trading_name": "VOVO LUCIA"
},
"request_failure_reason": null,
"request_status": "pending",
"request_type": "inclusion",
"requester_key": "ef48fbe4-267b-45c1-9049-75345c075486",
"updated_at": "2022-09-02T18:20:52"
}
STATUS
400Response Body: Pix 密钥已存在。
{
"title": "Bad Request",
"description": "Pix key: \{pix_key\} already exists.",
"translation": "A chave pix: \{pix_key\} já existe.",
"code": "PIX000065"
}
STATUS
404Response Body: 账户未找到
{
"title": "Account not found",
"description": "Conta não encontrada para account_key: \{account_key\}",
"translation": "Conta não encontrada para account_key: \{account_key\}",
"code": "PIX000026"
}
STATUS
400Response Body: 人员未找到
{
"title": "Person not found",
"description": "Pessoa não encontrada para person_key: \{person_key\}",
"translation": "Pessoa não encontrada para person_key: \{person_key\}",
"code": "PIX000027"
}
STATUS
400Response Body: Pix 密钥创建未完成
{
"title": "Pix Key Creation Non Finished",
"description": "A chave pix \{pix_key\} já possui um pedido de criação não finalizado.",
"translation": "A chave pix \{pix_key\} já possui um pedido de criação não finalizado.",
"code": "PIX000074"
}
STATUS
400Response Body: Pix 密钥数量已达上限
{
"title": "Maximum Number of Pix Keys in Use",
"description": "A conta \{account_key\} já atingiu o número máximo de chaves pix.",
"translation": "A conta \{account_key\} já atingiu o número máximo de chaves pix.",
"code": "PIX000014"
}
STATUS
400Response Body: 账户未开立
{
"title": "Account is not Opened",
"description": "A conta \{account_key\} não está aberta.",
"translation": "A conta \{account_key\} não está aberta.",
"code": "PIX000002"
}
STATUS
403Response Body: 权限无效
{
"title": "Invalid Permission",
"description": "A pessoa \{person_key\} não possui credenciais de administrador para a conta \{account_key\}.",
"translation": "A pessoa \{person_key\} não possui credenciais de administrador para a conta \{account_key\}.",
"code": "PIX000054"
}
STATUS
422Response Body: 尝试创建的 CPF Pix 密钥无效
{
"title": "Attempted CPF Pix Key is Not that of Account Owner",
"description": "A chave pix fornecida \{pix_key\} não corresponde ao CPF {document_number} do titular da conta.",
"translation": "A chave pix fornecida \{pix_key\} não corresponde ao CPF {document_number} do titular da conta.",
"code": "PIX000020"
}
注意
对于创建随机密钥的响应,"pix_key"字段将返回空值。要获取生成的随机密钥值,需要查询账户已注册密钥列表,或通过激活 Webhook 获取。
注意
密钥创建是异步的,因此密钥只有在收到 Pix 密钥包含 Webhook 后才可使用。