> For the complete documentation index, see [llms.txt](https://docs.barte.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.barte.com/api-reference/3ds/criar-pedido-com-autenticacao-externa-mpi.md).

# Criar Pedido com Autenticação Externa (MPI)

{% hint style="info" %}
`threeDSecure.mpi.challenged` é booleano (`true` ou `false`). Na resposta da criação do pedido, o objeto de 3DS se chama `three3DSSecure`; na consulta do pedido (`GET /v2/orders/{uuid}`), o mesmo objeto vem como `threeDSSecure`. Os erros seguem os códigos `BAR-xxxx` de [Códigos de Erro](https://docs.barte.com/guias/inicio/codigos-de-erro); a API não devolve códigos no formato `MPI-000x`.
{% endhint %}

## Criar Pagamento com MPI Externo

> Cria uma cobrança usando autenticação externa (MPI). Utilize quando já possui os dados de autenticação 3DS de um provedor externo.

```json
{"openapi":"3.0.3","info":{"title":"API de MPI (Merchant Plug-in)","version":"2.0.0"},"servers":[{"url":"https://api.barte.com","description":"Servidor de Produção"},{"url":"https://sandbox-api.barte.com","description":"Servidor de Sandbox"}],"security":[{"X-Token-Api":[]}],"components":{"securitySchemes":{"X-Token-Api":{"type":"apiKey","name":"X-Token-Api","in":"header"}},"schemas":{"CreateOrderWithMPIRequest":{"type":"object","required":["value","installments","title","payment","threeDSecure"],"properties":{"startDate":{"type":"string","format":"date","description":"Data de início da cobrança. Se não enviado, o startDate será a data atual"},"value":{"type":"number","format":"decimal","minimum":0.01,"description":"Valor da cobrança"},"installments":{"type":"integer","minimum":1,"maximum":12,"description":"Número de parcelas"},"title":{"type":"string","maxLength":255,"description":"Título da cobrança"},"payment":{"$ref":"#/components/schemas/PaymentMPIRequest"},"threeDSecure":{"$ref":"#/components/schemas/ThreeDSecureMPIRequest"}}},"PaymentMPIRequest":{"type":"object","required":["method","card","fraudData"],"properties":{"method":{"type":"string","enum":["CREDIT_CARD_EARLY_SELLER"],"description":"Método de pagamento"},"card":{"type":"object","required":["cardToken","cvv"],"properties":{"cardToken":{"type":"string","format":"uuid","description":"Token do cartão"},"cvv":{"type":"string","pattern":"^\\d{3,4}$","description":"Código de segurança do cartão"}}},"fraudData":{"$ref":"#/components/schemas/FraudDataRequest"}}},"FraudDataRequest":{"type":"object","properties":{"internationalDocument":{"$ref":"#/components/schemas/DocumentRequest"},"name":{"type":"string","maxLength":255,"description":"Nome do portador do cartão"},"email":{"type":"string","format":"email","maxLength":150,"description":"Email do portador do cartão"},"phone":{"type":"string","pattern":"^\\d{10,15}$","description":"Telefone do portador do cartão"},"billingAddress":{"$ref":"#/components/schemas/BillingAddressRequest"}}},"DocumentRequest":{"type":"object","required":["documentNumber","documentType","documentNation"],"properties":{"documentNumber":{"type":"string","description":"Número do documento"},"documentType":{"type":"string","enum":["cpf","cnpj"],"description":"Tipo do documento"},"documentNation":{"type":"string","description":"País do documento"}}},"BillingAddressRequest":{"type":"object","required":["country","state","city","district","street","zipCode","number"],"properties":{"country":{"type":"string","description":"País"},"state":{"type":"string","description":"Estado"},"city":{"type":"string","description":"Cidade"},"district":{"type":"string","description":"Bairro"},"street":{"type":"string","description":"Rua"},"zipCode":{"type":"string","description":"CEP"},"number":{"type":"string","description":"Número"},"complement":{"type":"string","description":"Complemento"}}},"ThreeDSecureMPIRequest":{"type":"object","required":["mpi"],"properties":{"mpi":{"$ref":"#/components/schemas/MPIDataRequest"}}},"MPIDataRequest":{"type":"object","required":["acsTransactionId","cavv","challenged","directoryServerTransactionId","eci","threeDSServerTransactionId","transStatus","version","xid"],"properties":{"acsTransactionId":{"type":"string","description":"ID da transação ACS"},"cavv":{"type":"string","description":"Cardholder Authentication Verification Value"},"challenged":{"type":"string","description":"Indica se houve desafio"},"directoryServerTransactionId":{"type":"string","description":"ID da transação do Directory Server"},"eci":{"type":"string","description":"Electronic Commerce Indicator"},"threeDSServerTransactionId":{"type":"string","description":"ID da transação do 3DS Server"},"transStatus":{"type":"string","description":"Status da transação"},"version":{"type":"string","description":"Versão do 3DS"},"xid":{"type":"string","description":"Transaction identifier"}}},"OrderResponse":{"type":"object","properties":{"uuid":{"type":"string","format":"uuid","description":"UUID da ordem"},"status":{"type":"string","enum":["SENT","APPROVED","DECLINED","PENDING"],"description":"Status da ordem"},"title":{"type":"string","description":"Título da ordem"},"value":{"type":"number","format":"decimal","description":"Valor da ordem"},"installments":{"type":"integer","description":"Número de parcelas"},"startDate":{"type":"string","format":"date","description":"Data de início"},"payment":{"type":"string","description":"Método de pagamento"}}},"ErrorResponse":{"type":"object","properties":{"errors":{"type":"array","items":{"$ref":"#/components/schemas/ErrorDetail"}},"metadata":{"$ref":"#/components/schemas/Metadata"}}},"ErrorDetail":{"type":"object","properties":{"status":{"type":"string"},"code":{"type":"string","enum":["PAYMENT-0000","PAYMENT-0500","PAYMENT-9999","BAR-7001","BAD_REQUEST","FORBIDDEN","METHOD_NOT_ALLOWED","NOT_ACCEPTABLE","UNSUPPORTED_MEDIA_TYPE","MPI-0001","MPI-0002","MPI-0003"]},"title":{"type":"string","enum":["BUSINESS_SELLER","BUSINESS_CHECKOUT","BUSINESS_COMMON","BUSINESS_SECURITY","BUSINESS_SUBSCRIPTION","INVALID_REQUEST_PARAM","BUSINESS_METRIC","BUSINESS_ACCOUNTANCY","BUSINESS_NOTIFICATION","BUSINESS_BARTE","BUSINESS_COMPANY","BUSINESS_INVOICE","BUSINESS_TRANSFER","BUSINESS_CARD","BUSINESS_ORDER","BUSINESS_MPI","card_not_supported"]},"description":{"type":"string"},"action":{"type":"string"},"additionalInfo":{"type":"object","additionalProperties":{"type":"object"}}}},"Metadata":{"type":"object","properties":{"totalRecords":{"type":"integer"},"totalPages":{"type":"integer"},"requestDatetime":{"type":"string","format":"date-time"}}}}},"paths":{"/v2/orders":{"post":{"tags":["MPI - Autenticação Externa"],"summary":"Criar Pagamento com MPI Externo","description":"Cria uma cobrança usando autenticação externa (MPI). Utilize quando já possui os dados de autenticação 3DS de um provedor externo.","operationId":"createOrderWithMPI","requestBody":{"description":"Dados da ordem com informações MPI","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrderWithMPIRequest"}}}},"responses":{"201":{"description":"Ordem criada com sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderResponse"}}}},"400":{"description":"Requisição inválida","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Não autorizado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Acesso proibido","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Erro interno do servidor","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.barte.com/api-reference/3ds/criar-pedido-com-autenticacao-externa-mpi.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
