Docs
post https://gateway.iugu.com/api/v1/transactions/authorize

Autorizar um pagamento com cartão de crédito

Autoriza uma transação de pagamento com cartão de crédito

Permissão necessária: gateway:transactions.authorize

Esta permissão deve constar como uma das ações permitidas para o app que faz a chamada. Isto pode ser feito através do GIA, ou então na edição do aplicativo. Em caso de dúvidas, clique aqui.

Request

Headers

WORKSPACE_ID

Type: string

ID do workspace

Ex: 1D81KhKbYuVq9505Bz4Nk9

Body Required

Content Type: application/json

account_id

Required

String

Identificador da conta

order_id

Required

String

Identificador do pedido

client_ref
String

Número de referência do cliente

credit_card_id
String

ID do cartão de crédito armazenado no Smart-Vault

mcc

Required

String

Merchant Category Code

cnpj

Required

String = 14 characters

CNPJ do estabelecimento

amount_cents

Required

Integer

Valor da transação em centavos

installments

Required

Integer

Número de parcelas

soft_descriptor

Required

String

Texto que aparecerá na fatura do cartão

currency
String

Moeda da transação

extra_amount_cents
Integer

Valor adicional em centavos

fines_cents
Integer

Valor de multa em centavos

discount_cents
Integer

Valor de desconto em centavos

recurrent
Boolean

Indica se é uma transação recorrente

ip_address
String

Endereço IP do cliente

skip_anti_fraud
Boolean

Se deve pular a verificação anti-fraude

sub_merchant
Object

id
String

ID do sub-merchant

document_type
String
Enum: `cpf`, `cnpj`

Tipo do documento

document_number
String [11..14] characters

Número do documento

address
String

Endereço

city
String

Cidade

state
String

Estado

country_code
String

Código do país

postal_code
String

CEP

mcc
String

Merchant Category Code

company_name
String

Nome da empresa

phone_number
String

Número de telefone

website
String

Url do site

items
Array of objects

name

Required

String

Nome do item

type

Required

String

Tipo do item

price_cents

Required

Integer

Preço em centavos

description
String

Descrição do item

quantity
Integer

Quantidade

payer
Object

email

Required

String

Email do pagador

id
String

ID do pagador

name
String

Nome do pagador

document_number
String

Número do documento

phone_prefix
String

Prefixo do telefone

phone_number
String

Número do telefone

gender
String
Enum: `M`, `F`

Gênero

borned_at
String

Data de nascimento

created_at
String

Data de criação

address
Object

street
String

Rua

number
String

Número

district
String

Bairro

city
String

Cidade

state
String

Estado

country
String

País

postal_code
String

CEP

receiver
Object

name
String

Nome do recebedor

document_number
String

Número do documento

postal_code
String

CEP

subscription
Object

id
String

ID da assinatura

price_cents
Integer

Preço em centavos

recurrence
Integer

Recorrência em dias

started_at
String

Data de início

expires_at
String

Data de expiração

Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{
  "account_id": "<ACCOUNT_ID>",
  "order_id": "<ORDER_ID>",
  "client_ref": "<CLIENT_REF>",
  "credit_card_id": "<CREDIT_CARD_ID>",
  "mcc": "<MCC>",
  "cnpj": "<CNPJ>",
  "amount_cents": "<AMOUNT_CENTS>",
  "installments": "<INSTALLMENTS>",
  "soft_descriptor": "<SOFT_DESCRIPTOR>",
  "currency": "<CURRENCY>",
  "extra_amount_cents": "<EXTRA_AMOUNT_CENTS>",
  "fines_cents": "<FINES_CENTS>",
  "discount_cents": "<DISCOUNT_CENTS>",
  "recurrent": "<RECURRENT>",
  "ip_address": "<IP_ADDRESS>",
  "skip_anti_fraud": "<SKIP_ANTI_FRAUD>",
  "sub_merchant": {
    "id": "<ID>",
    "document_type": "<DOCUMENT_TYPE>",
    "document_number": "<DOCUMENT_NUMBER>",
    "address": "<ADDRESS>",
    "city": "<CITY>",
    "state": "<STATE>",
    "country_code": "<COUNTRY_CODE>",
    "postal_code": "<POSTAL_CODE>",
    "mcc": "<MCC>",
    "company_name": "<COMPANY_NAME>",
    "phone_number": "<PHONE_NUMBER>",
    "website": "<WEBSITE>"
  },
  "items": [
    {
      "name": "<NAME>",
      "type": "<TYPE>",
      "price_cents": "<PRICE_CENTS>",
      "description": "<DESCRIPTION>",
      "quantity": "<QUANTITY>"
    }
  ],
  "payer": {
    "email": "<EMAIL>",
    "id": "<ID>",
    "name": "<NAME>",
    "document_number": "<DOCUMENT_NUMBER>",
    "phone_prefix": "<PHONE_PREFIX>",
    "phone_number": "<PHONE_NUMBER>",
    "gender": "<GENDER>",
    "borned_at": "<BORNED_AT>",
    "created_at": "<CREATED_AT>",
    "address": {
      "street": "<STREET>",
      "number": "<NUMBER>",
      "district": "<DISTRICT>",
      "city": "<CITY>",
      "state": "<STATE>",
      "country": "<COUNTRY>",
      "postal_code": "<POSTAL_CODE>"
    }
  },
  "receiver": {
    "name": "<NAME>",
    "document_number": "<DOCUMENT_NUMBER>",
    "postal_code": "<POSTAL_CODE>"
  },
  "subscription": {
    "id": "<ID>",
    "price_cents": "<PRICE_CENTS>",
    "recurrence": "<RECURRENCE>",
    "started_at": "<STARTED_AT>",
    "expires_at": "<EXPIRES_AT>"
  }
}

Response

200

Pagamento autorizado com sucesso

payment
Object

id
String

account_id
String

order_id
String

amount_cents
Integer

status
String

created_at
String

transactions
Array of objects

success
Boolean

function
String
Enum: `authorization`, `charge`, `capture`, `cancel`

acquirer
Object

status_code
String

status_description
String

Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{
  "payment": {
    "id": "<ID>",
    "account_id": "<ACCOUNT_ID>",
    "order_id": "<ORDER_ID>",
    "amount_cents": "<AMOUNT_CENTS>",
    "status": "<STATUS>",
    "created_at": "<CREATED_AT>",
    "transactions": [
      {
        "success": "<SUCCESS>",
        "function": "<FUNCTION>",
        "acquirer": {
          "status_code": "<STATUS_CODE>",
          "status_description": "<STATUS_DESCRIPTION>"
        }
      }
    ]
  }
}

401

Não autorizado - Token de autenticação inválido ou ausente

403

Proibido - Verificação anti-fraude falhou

404

Cartão de crédito não encontrado

422

Erros de validação ou autorização falhou

500

Erro interno do servidor