Charge an order

POST

POST https://platform-api.lia.com.br/external_api/v1/orders/:id/charge

How this route work

This route depends directly on the payment configuration used. We have 7 variations of possible billings:

  • Financed boleto with boleto downpayment
  • Financed boleto with pix downpayment
  • Upfront pix
  • Upfront boleto

This route does not support any credit card payment, if you want to charge with credit card use Lia’s checkout.

Body params

NameDescriptionRequiredType
payment_configuration_idPayment configurations’s IDtrueString
due_dayDue day of recurring bills (only in case of financed)trueInteger
installmentsTotal of financing installmentstrueInteger
paymentObject that represents how the first bill will be chargedtrueString
signatureSignature objecttrueObject

Payment Object

NameDescriptionRequiredType
payment_methodboleto or pixtrueString

Example request

curl --location 'https://platform-api-sandbox.lia.com.br/external_api/v1/orders/98ee8ecf-62cf-4b00-81dc-05fbdcb2e5f1/charge' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer token' \
--data '{
    "payment_configuration_id": "ef7e22c2-4001-44c0-9213-d130e0fea6b2",
    "due_day": 25,
    "installments": 4,
    "payment": {
        "payment_method": "boleto"
    },
    "signature": {
        "remote_ip": "127.0.0.1",
        "user_agent": "Mozilla/5.0"
    }
}'

Example response

{
    "id": "3f4e8220-fd0d-48cb-97cf-314338c8fadd",
    "created_at": "2023-07-20T18:09:16.409-03:00",
    "updated_at": "2023-07-21T01:03:48.144-03:00",
    "status": "in_progress",
    "customer_name": "John Armless",
    "customer_birthdate": "1994-12-03",
    "customer_document": "43849589862",
    "email": "john.armless@lia.com.br",
    "phone": "5512984344525",
    "address": {
        "id": "2db1a385-8fc9-44c7-aa64-1ea991e389b3",
        "zipcode": "08452431",
        "neighborhood": "Jardim Lourdes",
        "street": "Rua Vinte e Nove de Janeiro",
        "number": "351",
        "complement": "",
        "created_at": "2023-07-06T17:34:20.226-03:00",
        "updated_at": "2023-07-06T17:34:20.226-03:00",
        "city": {
            "id": "2f32f7b6-63b2-4a10-a0b4-ab46ffd445f5",
            "name": "São José dos Campos",
            "ibge_code": "3549904",
            "created_at": "2023-05-09T13:09:31.362-03:00",
            "updated_at": "2023-05-09T13:09:31.362-03:00",
            "state": {
                "id": "9ed1d7f7-8729-4787-aab2-1b111884ac18",
                "name": "São Paulo",
                "acronym": "SP",
                "created_at": "2023-05-09T13:09:31.337-03:00",
                "updated_at": "2023-05-09T13:09:31.337-03:00"
            }
        }
    },
    "offer": {
        "id": "78176d6e-61af-4764-9e73-523aa51b5843",
        "amount_cents": 70000,
        "enabled": true,
        "created_at": "2023-06-11T19:21:12.074-03:00",
        "updated_at": "2023-06-11T19:21:12.074-03:00",
        "product": {
            "id": "7d82bd4e-5148-4bb1-aef3-b8b571b1d23c",
            "name": "Curson Online",
            "full_amount_cents": 70000,
            "created_at": "2023-06-11T19:21:12.025-03:00",
            "updated_at": "2023-07-21T00:52:13.943-03:00",
            "description": null,
            "duration_in_hours": null,
            "access_period": "lifetime",
            "duration_in_days": null,
            "start_date": null,
            "end_date": null,
            "formatted_access_period": "Vitalício",
            "company": {
                "id": "42040450-79ff-4b9f-bddb-04e7f5103b9a",
                "document": "44432290000118",
                "name": "Lia",
                "slug": "lia",
                "created_at": "2023-05-11T13:12:06.333-03:00",
                "updated_at": "2023-07-20T21:58:19.385-03:00",
                "theme_customizations": {
                    "dark": false,
                    "palette": "pink"
                },
                "logo": "https://platform-api-homolog.oilia.com.br/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJaWsxTURRMVltRmtOeTFtTWpOaUxUUmtZV0l0T0RGak9TMWlZMlZoWmpKaVpUVmhNakVHT2daRlZBPT0iLCJleHAiOm51bGwsInB1ciI6ImJsb2JfaWQifX0=--94b7f86daaa67ae2d329f78ff5d47fcc771a935d/logo.png",
                "email": null,
                "phone": null,
                "address": {
                    "id": "f15566f8-a570-4f35-8a52-dbaffd0eda62",
                    "zipcode": "12242001",
                    "neighborhood": "Felicidade",
                    "street": "Alegria",
                    "number": "123",
                    "complement": null,
                    "created_at": "2023-05-11T13:12:05.972-03:00",
                    "updated_at": "2023-05-11T13:12:05.972-03:00",
                    "city": {
                        "id": "05d5072d-dd4b-4408-ae34-f48fb5828bbc",
                        "name": "Tarauacá",
                        "ibge_code": "1200609",
                        "created_at": "2023-05-09T13:09:30.714-03:00",
                        "updated_at": "2023-05-09T13:09:30.714-03:00",
                        "state": {
                            "id": "ea6b26bf-60d1-4586-b4d3-8a0f8cdfd349",
                            "name": "Acre",
                            "acronym": "AC",
                            "created_at": "2023-05-09T13:09:30.688-03:00",
                            "updated_at": "2023-05-09T13:09:30.688-03:00"
                        }
                    }
                }
            },
            "kind": {
                "id": "e6fd48e2-be7d-4bff-9455-14923b4105b9",
                "name": "Curso Online",
                "created_at": "2023-05-09T13:09:31.453-03:00",
                "updated_at": "2023-05-09T13:09:31.453-03:00"
            }
        },
        "payment_configurations": [
            {
                "id": "ef7e22c2-4001-44c0-9213-d130e0fea6b2",
                "payment_method": "boleto",
                "payment_type": "financed",
                "created_at": "2023-06-11T19:21:12.066-03:00",
                "updated_at": "2023-07-21T01:24:44.934-03:00",
                "min_installment_amount_cents": 8000,
                "max_installments": 24,
                "allowed_down_payment_methods": [
                    "boleto",
                    "pix",
                    "credit_card"
                ],
                "max_down_payment_installments": 1,
                "down_payment_type": "percentage",
                "interest_rate": 0.0299,
                "registration_fee": 0.0197,
                "expires_in": 48,
                "down_payment_value": 0.1
            }
        ]
    },
    "billings": [
        {
            "id": "276fffd8-ab4d-4a88-9837-f4c404ba383c",
            "amount_cents": 75183,
            "amount_currency": "BRL",
            "created_at": "2023-07-21T01:24:54.642-03:00",
            "updated_at": "2023-07-21T01:24:54.642-03:00",
            "due_day": 25,
            "installments": 4,
            "status": "waiting_payment",
            "cancelation_reason": null,
            "finished_at": null,
            "payment_configuration": {
                "id": "ef7e22c2-4001-44c0-9213-d130e0fea6b2",
                "payment_method": "boleto",
                "payment_type": "financed",
                "created_at": "2023-06-11T19:21:12.066-03:00",
                "updated_at": "2023-07-21T01:24:44.934-03:00",
                "min_installment_amount_cents": 8000,
                "max_installments": 24,
                "allowed_down_payment_methods": [
                    "boleto",
                    "pix",
                    "credit_card"
                ],
                "max_down_payment_installments": 1,
                "down_payment_type": "percentage",
                "interest_rate": 0.0299,
                "registration_fee": 0.0197,
                "expires_in": 48,
                "down_payment_value": 0.1
            },
            "bills": [
                {
                    "id": "e43d6a7d-24d9-445f-aea2-49ede1c2fc56",
                    "amount_cents": 8379,
                    "created_at": "2023-07-21T01:24:54.649-03:00",
                    "updated_at": "2023-07-21T01:24:54.649-03:00",
                    "status": "pending",
                    "due_date": "2023-07-23T23:59:59.999-03:00",
                    "bill_type": "down_payment",
                    "payments": [
                        {
                            "id": "904d2cee-fdd0-4d19-a01b-b5411d941b68",
                            "created_at": "2023-07-21T01:24:55.207-03:00",
                            "amount_cents": 8379,
                            "paid_amount_cents": 0,
                            "refunded_amount_cents": 0,
                            "paid_at": null,
                            "refunded_at": null,
                            "status": "unpaid",
                            "payment_method": "boleto",
                            "url": "https://pagar.me",
                            "barcode": "1234 5678",
                            "expires_at": "2023-07-23T23:59:59.999-03:00",
                            "installments": 1
                        }
                    ]
                },
                {
                    "id": "c72c76e5-fe05-42e8-96ad-dc6a0d11b489",
                    "amount_cents": 22268,
                    "created_at": "2023-07-21T01:24:54.670-03:00",
                    "updated_at": "2023-07-21T01:24:54.670-03:00",
                    "status": "pending",
                    "due_date": "2023-08-25T23:59:59.999-03:00",
                    "bill_type": "installment",
                    "payments": []
                },
                {
                    "id": "f0934813-2421-443d-aca5-35f6d456d86b",
                    "amount_cents": 22268,
                    "created_at": "2023-07-21T01:24:54.692-03:00",
                    "updated_at": "2023-07-21T01:24:54.692-03:00",
                    "status": "pending",
                    "due_date": "2023-09-25T23:59:59.999-03:00",
                    "bill_type": "installment",
                    "payments": []
                },
                {
                    "id": "80d9c7f8-99d0-4f6c-8dca-b8e390f301ad",
                    "amount_cents": 22268,
                    "created_at": "2023-07-21T01:24:54.712-03:00",
                    "updated_at": "2023-07-21T01:24:54.712-03:00",
                    "status": "pending",
                    "due_date": "2023-10-25T23:59:59.999-03:00",
                    "bill_type": "installment",
                    "payments": []
                }
            ]
        }
    ]
}