Charge an order

POST

POST https://external-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://external-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

{
    "address": {
        "city": {
            "ibge_code": "3549904",
            "id": "2f32f7b6-63b2-4a10-a0b4-ab46ffd445f5",
            "name": "São José dos Campos",
            "state": {
                "acronym": "SP",
                "id": "9ed1d7f7-8729-4787-aab2-1b111884ac18",
                "name": "São Paulo"
            },
            "state_id": "9ed1d7f7-8729-4787-aab2-1b111884ac18"
        },
        "complement": "",
        "id": "2db1a385-8fc9-44c7-aa64-1ea991e389b3",
        "neighborhood": "Jardim Lourdes",
        "number": "351",
        "street": "Rua Vinte e Nove de Janeiro",
        "zipcode": "08452431"
    },
    "analyses": [],
    "billings": [
        {
            "amount_cents": 75183,
            "amount_currency": "BRL",
            "bills": [
                {
                    "amount_cents": 8379,
                    "authentication_code": null,
                    "bill_details": [],
                    "bill_type": "down_payment",
                    "billing": {
                        "amount_cents": 75183,
                        "amount_currency": "BRL",
                        "cancelation_reason": null,
                        "created_at": "2023-07-21T01:24:54.642-03:00",
                        "due_day": 25,
                        "finished_at": null,
                        "id": "276fffd8-ab4d-4a88-9837-f4c404ba383c",
                        "installments": 4,
                        "order_id": "3f4e8220-fd0d-48cb-97cf-314338c8fadd",
                        "origin_billing_id": null,
                        "status": "waiting_payment",
                        "updated_at": "2023-07-21T01:24:54.642-03:00"
                    },
                    "checkout_url": "https://pague-sandbox.lia.com.br/parcela/pagamento?bill_id=e43d6a7d-24d9-445f-aea2-49ede1c2fc56",
                    "created_at": "2023-07-21T01:24:54.649-03:00",
                    "current_amount_cents": 8379,
                    "disable_penalties_until": null,
                    "due_date": "2023-07-23T23:59:59.999-03:00",
                    "effective_due_date": "2023-07-23T23:59:59.999-03:00",
                    "id": "e43d6a7d-24d9-445f-aea2-49ede1c2fc56",
                    "metadata": {},
                    "original_amount_cents": 8379,
                    "paid_at": null,
                    "payments": [
                        {
                            "amount_cents": 8379,
                            "barcode": "23791.22928 50012.784059 08000.046907 1 97830000025890",
                            "barcode_image_url": "https://platform-api-sandbox.lia.com.br/rails/active_storage/blobs/redirect/barcode_image",
                            "bill_id": "e43d6a7d-24d9-445f-aea2-49ede1c2fc56",
                            "created_at": "2023-07-21T01:24:55.207-03:00",
                            "expires_at": "2023-07-23T23:59:59.999-03:00",
                            "id": "904d2cee-fdd0-4d19-a01b-b5411d941b68",
                            "installments": 1,
                            "paid_amount_cents": 0,
                            "paid_at": null,
                            "payment_method": "boleto",
                            "refunded_amount_cents": 0,
                            "refunded_at": null,
                            "refused_reason": null,
                            "refused_reason_description": null,
                            "status": "unpaid",
                            "url": "https://pague-sandbox.lia.com.br/parcela/pagamento?bill_id=e43d6a7d-24d9-445f-aea2-49ede1c2fc56"
                        }
                    ],
                    "status": "pending",
                    "updated_at": "2023-07-21T01:24:54.649-03:00"
                },
                {
                    "amount_cents": 22268,
                    "authentication_code": null,
                    "bill_details": [],
                    "bill_type": "installment",
                    "billing": {
                        "amount_cents": 75183,
                        "amount_currency": "BRL",
                        "cancelation_reason": null,
                        "created_at": "2023-07-21T01:24:54.642-03:00",
                        "due_day": 25,
                        "finished_at": null,
                        "id": "276fffd8-ab4d-4a88-9837-f4c404ba383c",
                        "installments": 4,
                        "order_id": "3f4e8220-fd0d-48cb-97cf-314338c8fadd",
                        "origin_billing_id": null,
                        "status": "waiting_payment",
                        "updated_at": "2023-07-21T01:24:54.642-03:00"
                    },
                    "checkout_url": "https://pague-sandbox.lia.com.br/parcela/pagamento?bill_id=c72c76e5-fe05-42e8-96ad-dc6a0d11b489",
                    "created_at": "2023-07-21T01:24:54.670-03:00",
                    "current_amount_cents": 22268,
                    "disable_penalties_until": null,
                    "due_date": "2023-08-25T23:59:59.999-03:00",
                    "effective_due_date": "2023-08-25T23:59:59.999-03:00",
                    "id": "c72c76e5-fe05-42e8-96ad-dc6a0d11b489",
                    "metadata": {},
                    "original_amount_cents": 22268,
                    "paid_at": null,
                    "payments": [],
                    "status": "pending",
                    "updated_at": "2023-07-21T01:24:54.670-03:00"
                },
                {
                    "amount_cents": 22268,
                    "authentication_code": null,
                    "bill_details": [],
                    "bill_type": "installment",
                    "billing": {
                        "amount_cents": 75183,
                        "amount_currency": "BRL",
                        "cancelation_reason": null,
                        "created_at": "2023-07-21T01:24:54.642-03:00",
                        "due_day": 25,
                        "finished_at": null,
                        "id": "276fffd8-ab4d-4a88-9837-f4c404ba383c",
                        "installments": 4,
                        "order_id": "3f4e8220-fd0d-48cb-97cf-314338c8fadd",
                        "origin_billing_id": null,
                        "status": "waiting_payment",
                        "updated_at": "2023-07-21T01:24:54.642-03:00"
                    },
                    "checkout_url": "https://pague-sandbox.lia.com.br/parcela/pagamento?bill_id=f0934813-2421-443d-aca5-35f6d456d86b",
                    "created_at": "2023-07-21T01:24:54.692-03:00",
                    "current_amount_cents": 22268,
                    "disable_penalties_until": null,
                    "due_date": "2023-09-25T23:59:59.999-03:00",
                    "effective_due_date": "2023-09-25T23:59:59.999-03:00",
                    "id": "f0934813-2421-443d-aca5-35f6d456d86b",
                    "metadata": {},
                    "original_amount_cents": 22268,
                    "paid_at": null,
                    "payments": [],
                    "status": "pending",
                    "updated_at": "2023-07-21T01:24:54.692-03:00"
                },
                {
                    "amount_cents": 22268,
                    "authentication_code": null,
                    "bill_details": [],
                    "bill_type": "installment",
                    "billing": {
                        "amount_cents": 75183,
                        "amount_currency": "BRL",
                        "cancelation_reason": null,
                        "created_at": "2023-07-21T01:24:54.642-03:00",
                        "due_day": 25,
                        "finished_at": null,
                        "id": "276fffd8-ab4d-4a88-9837-f4c404ba383c",
                        "installments": 4,
                        "order_id": "3f4e8220-fd0d-48cb-97cf-314338c8fadd",
                        "origin_billing_id": null,
                        "status": "waiting_payment",
                        "updated_at": "2023-07-21T01:24:54.642-03:00"
                    },
                    "checkout_url": "https://pague-sandbox.lia.com.br/parcela/pagamento?bill_id=80d9c7f8-99d0-4f6c-8dca-b8e390f301ad",
                    "created_at": "2023-07-21T01:24:54.712-03:00",
                    "current_amount_cents": 22268,
                    "disable_penalties_until": null,
                    "due_date": "2023-10-25T23:59:59.999-03:00",
                    "effective_due_date": "2023-10-25T23:59:59.999-03:00",
                    "id": "80d9c7f8-99d0-4f6c-8dca-b8e390f301ad",
                    "metadata": {},
                    "original_amount_cents": 22268,
                    "paid_at": null,
                    "payments": [],
                    "status": "pending",
                    "updated_at": "2023-07-21T01:24:54.712-03:00"
                }
            ],
            "cancelation_reason": null,
            "created_at": "2023-07-21T01:24:54.642-03:00",
            "due_day": 25,
            "finished_at": null,
            "id": "276fffd8-ab4d-4a88-9837-f4c404ba383c",
            "installments": 4,
            "order_id": "3f4e8220-fd0d-48cb-97cf-314338c8fadd",
            "origin_billing_id": null,
            "payment_configuration": {
                "allowed_down_payment_methods": [
                    "boleto",
                    "pix",
                    "credit_card"
                ],
                "availability": "enabled",
                "down_payment_interest_rate": 0.0299,
                "down_payment_type": "percentage",
                "down_payment_value": 0.1,
                "expires_in": 48,
                "fee_embedded_in_down_payment": false,
                "financed_type": null,
                "id": "ef7e22c2-4001-44c0-9213-d130e0fea6b2",
                "interest_rate": 0.0299,
                "max_down_payment_installments": 1,
                "max_installments": 24,
                "min_installment_amount_cents": 8000,
                "payment_methods": [
                    "boleto",
                    "pix",
                    "credit_card"
                ],
                "payment_type": "financed",
                "registration_fee": 0.0197,
                "take_rate_type": "percentage",
                "take_rate_value": 0.0897
            },
            "status": "waiting_payment",
            "updated_at": "2023-07-21T01:24:54.642-03:00"
        }
    ],
    "cancelation_reason": null,
    "checkout_type": "default",
    "created_at": "2023-07-20T18:09:16.409-03:00",
    "customer_birthdate": "1994-12-03",
    "customer_document": "43849589862",
    "customer_name": "John Armless",
    "customer_type": "person",
    "email": {
        "address": "john.armless@lia.com.br",
        "contact_type": "email",
        "created_at": "2023-07-20T18:09:16.420-03:00",
        "id": "a5e8c421-9f8d-42ab-bd5e-8c1f5e3a6d9b",
        "purpose": "communication",
        "updated_at": "2023-07-20T18:09:16.420-03:00",
        "validated": false
    },
    "finished_at": null,
    "id": "3f4e8220-fd0d-48cb-97cf-314338c8fadd",
    "metadata": {},
    "offer": {
        "amount_cents": 70000,
        "amount_currency": "BRL",
        "availability": "enabled",
        "checkout_type": "default",
        "created_at": "2023-06-11T19:21:12.074-03:00",
        "id": "78176d6e-61af-4764-9e73-523aa51b5843",
        "name": "Padrão",
        "payment_configurations": [
            {
                "allowed_down_payment_methods": [
                    "boleto",
                    "pix",
                    "credit_card"
                ],
                "availability": "enabled",
                "down_payment_interest_rate": 0.0299,
                "down_payment_type": "percentage",
                "down_payment_value": 0.1,
                "expires_in": 48,
                "fee_embedded_in_down_payment": false,
                "financed_type": null,
                "id": "ef7e22c2-4001-44c0-9213-d130e0fea6b2",
                "interest_rate": 0.0299,
                "max_down_payment_installments": 1,
                "max_installments": 24,
                "min_installment_amount_cents": 8000,
                "payment_methods": [
                    "boleto",
                    "pix",
                    "credit_card"
                ],
                "payment_type": "financed",
                "registration_fee": 0.0197,
                "take_rate_type": "percentage",
                "take_rate_value": 0.0897
            }
        ],
        "product": {
            "access_period": "lifetime",
            "availability": "enabled",
            "banner_url": null,
            "company_id": "42040450-79ff-4b9f-bddb-04e7f5103b9a",
            "created_at": "2023-06-11T19:21:12.025-03:00",
            "description": "Curso completo de formação online",
            "duration_in_days": null,
            "duration_in_hours": null,
            "end_date": null,
            "formatted_access_period": "Vitalício",
            "full_amount_cents": 70000,
            "full_amount_currency": "BRL",
            "google_pixel_code": null,
            "id": "7d82bd4e-5148-4bb1-aef3-b8b571b1d23c",
            "kind": {
                "id": "e6fd48e2-be7d-4bff-9455-14923b4105b9",
                "name": "Curso"
            },
            "meta_pixel_code": null,
            "metadata": {},
            "name": "Curso Online",
            "shift": {
                "id": "021fa9fd-0e43-4638-80aa-4a8b598fbcd6",
                "name": "Online"
            },
            "start_date": null,
            "updated_at": "2023-07-21T00:52:13.943-03:00"
        },
        "smart_payment_enabled": false,
        "updated_at": "2023-06-11T19:21:12.074-03:00",
        "url": "https://pague-sandbox.lia.com.br/lia/oferta?offer_id=78176d6e-61af-4764-9e73-523aa51b5843"
    },
    "phone": {
        "address": "5512984344525",
        "contact_type": "phone",
        "created_at": "2023-07-20T18:09:16.418-03:00",
        "id": "b7f9d532-8e6a-43bc-ae7f-9d2e4f5b8c1a",
        "purpose": "communication",
        "updated_at": "2023-07-20T18:09:16.418-03:00",
        "validated": false
    },
    "status": "in_progress",
    "translated_cancelation_reason": null,
    "updated_at": "2023-07-21T01:03:48.144-03:00",
    "url": "https://pague-sandbox.lia.com.br/lia/pedido?order_id=3f4e8220-fd0d-48cb-97cf-314338c8fadd"
}