# Criar Link de Pagamento

## Criar link de pagamento

> Cria um novo link de pagamento

```json
{"openapi":"3.0.0","info":{"title":"API de Links de Pagamento v2","version":"2.0.0"},"servers":[{"url":"https://api.barte.com","description":"Servidor de produção"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-Token-Api"}},"schemas":{"PaymentLinkRequest":{"type":"object","required":["type","paymentOrder","paymentMethods"],"properties":{"type":{"type":"string","enum":["ORDER","SUBSCRIPTION","FAST_ORDER"]},"scheduledDate":{"type":"string","format":"date","description":"Data de vencimento do pedido (opcional)"},"uuidSellerClient":{"type":"string","format":"uuid","description":"UUID do comprador - se o link for específico para alguém (opcional)"},"paymentOrder":{"$ref":"#/components/schemas/PaymentOrderLinkRequest"},"paymentSubscription":{"$ref":"#/components/schemas/PaymentSubscriptionLinkRequest","description":"Opcional - pode referenciar um plano de assinatura"},"paymentMethods":{"type":"array","items":{"type":"string","enum":["PIX","BANK_SLIP","CREDIT_CARD","CREDIT_CARD_EARLY_BUYER","CREDIT_CARD_EARLY_SELLER","DEBIT_CARD"]}},"metadata":{"type":"array","items":{"$ref":"#/components/schemas/MetadataRequest"}}}},"PaymentOrderLinkRequest":{"type":"object","required":["title","value","installments","customInstallmentsValues"],"properties":{"title":{"type":"string","maxLength":60,"minLength":1},"description":{"type":"string","maxLength":300},"value":{"type":"number","format":"double","minimum":0.01},"installments":{"type":"integer","format":"int32","minimum":1,"maximum":12},"timer":{"type":"boolean"},"expirationDate":{"type":"string","format":"date-time","description":"Data e hora de expiração do link de pagamento (opcional)"},"customInstallmentsValues":{"type":"array","description":"É preciso informar ao menos um método","items":{"$ref":"#/components/schemas/CustomInstallmentValueRequest"}},"threeDSecureEnabled":{"type":"boolean","default":false,"description":"Ativa autenticação 3D Secure para pagamentos com cartão de crédito. Só tem efeito quando o link aceita CREDIT_CARD, CREDIT_CARD_EARLY_SELLER ou CREDIT_CARD_EARLY_BUYER como método de pagamento. Quando ativado, o checkout do comprador inicia o fluxo 3DS automaticamente (coleta de dados do navegador + possível desafio)."},"requiresLiabilityShift":{"type":"boolean","default":false,"description":"Exige liability shift para a transação ser aprovada. Quando true, transações sem liability shift são recusadas automaticamente."}}},"CustomInstallmentValueRequest":{"type":"object","description":"Valores customizados de parcelas com base no método de pagamento","required":["paymentMethod","installments"],"properties":{"paymentMethod":{"type":"string","enum":["PIX","BANK_SLIP","CREDIT_CARD","CREDIT_CARD_EARLY_BUYER","CREDIT_CARD_EARLY_SELLER","DEBIT_CARD"],"description":"Pode ser CREDIT_CARD (Fluxo do tempo), CREDIT_CARD_EARLY_SELLER (Antecipado com taxas pro seller) e CREDIT_CARD_EARLY_BUYER (Antecipado com taxas pro buyer)"},"installments":{"type":"integer","format":"int32","minimum":1,"maximum":12}}},"PaymentSubscriptionLinkRequest":{"type":"object","required":["idPlan","type","valuePerMonth"],"properties":{"idPlan":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["MONTHLY","SEMESTER","YEARLY"]},"valuePerMonth":{"type":"number","format":"double","minimum":0.01}}},"MetadataRequest":{"type":"object","required":["key","value"],"properties":{"key":{"type":"string"},"value":{"oneOf":[{"type":"string"},{"type":"number"}]}}},"PaymentLinkResponse":{"type":"object","required":["id","uuid","type","url"],"properties":{"id":{"type":"integer"},"uuid":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["ORDER","SUBSCRIPTION","FAST_ORDER"]},"url":{"type":"string","format":"uri"},"scheduledDate":{"type":"string","format":"date"},"paymentOrder":{"$ref":"#/components/schemas/PaymentOrderLinkResponse"},"paymentSubscription":{"$ref":"#/components/schemas/PaymentSubscriptionLinkResponse"},"processed":{"type":"integer","format":"int32"},"enableAnchoring":{"type":"boolean"},"allowedPaymentMethods":{"type":"object","properties":{"pixMethod":{"type":"object"},"bankSlipMethod":{"type":"object"},"creditCardMethod":{"type":"object","properties":{"type":{"type":"string"}}}}},"paymentMethods":{"type":"array","items":{"type":"string"}},"enableBankSlip":{"type":"boolean"},"enableCreditCard":{"type":"boolean"},"enablePixPayment":{"type":"boolean"},"subSellerResponse":{"type":"array","items":{"type":"object"}},"idSeller":{"type":"integer"}}},"PaymentOrderLinkResponse":{"type":"object","required":["title","value","installments"],"properties":{"title":{"type":"string"},"description":{"type":"string"},"value":{"type":"number","format":"double"},"installments":{"type":"integer","format":"int32"},"customInstallmentsValues":{"type":"array","items":{"$ref":"#/components/schemas/CustomInstallmentValueResponse"}},"expirationDate":{"type":"string","format":"date-time"},"timer":{"type":"boolean"},"threeDSecureEnabled":{"type":"boolean"},"requiresLiabilityShift":{"type":"boolean"}}},"CustomInstallmentValueResponse":{"type":"object","properties":{"paymentMethod":{"type":"string","enum":["PIX","BANK_SLIP","CREDIT_CARD","CREDIT_CARD_EARLY_BUYER","CREDIT_CARD_EARLY_SELLER","DEBIT_CARD"]},"installments":{"type":"integer","format":"int32"}}},"PaymentSubscriptionLinkResponse":{"type":"object","required":["idPlan","type","value","valuePerMonth"],"properties":{"idPlan":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["MONTHLY","SEMESTER","YEARLY"]},"value":{"type":"number","format":"double"},"valuePerMonth":{"type":"number","format":"double"}}},"Error":{"type":"object","properties":{"message":{"type":"string"},"details":{"type":"array","items":{"$ref":"#/components/schemas/ErrorDetail"}},"metadata":{"$ref":"#/components/schemas/Metadata"}}},"ErrorDetail":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"}}},"Metadata":{"type":"object","properties":{"timestamp":{"type":"string","format":"date-time"},"path":{"type":"string"},"method":{"type":"string"}}}}},"paths":{"/v2/payment-links":{"post":{"summary":"Criar link de pagamento","description":"Cria um novo link de pagamento","tags":["Links de Pagamento"],"parameters":[{"name":"X-Token-Api","in":"header","required":true,"schema":{"type":"string"},"description":"Token de autenticação para acesso à API"},{"name":"Content-Type","in":"header","required":false,"schema":{"type":"string","enum":["application/json"]},"description":"Tipo de conteúdo da requisição"},{"name":"x-ip-origin-request","in":"header","required":false,"schema":{"type":"string"},"description":"IP de origem da requisição"},{"name":"x-idempotency-key","in":"header","required":false,"schema":{"type":"string"},"description":"Chave de idempotência"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentLinkRequest"}}}},"responses":{"200":{"description":"Link de pagamento criado com sucesso","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentLinkResponse"}}}},"400":{"description":"Erro de validação","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Token inativo ou inexistente","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Acesso negado","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Muitas requisições","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Erro interno do servidor","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```
