Criando e pagando um pedido

curl --location --request POST 'https://sandbox.api.pagseguro.com/orders' \
--header 'Authorization: Bearer TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
    "reference_id": "ex-00001",
    "customer": {
        "name": "Jose da Silva",
        "email": "[email protected]",
        "tax_id": "12345678909",
        "phones": [
            {
                "country": "55",
                "area": "11",
                "number": "999999999",
                "type": "MOBILE"
            }
        ]
    },
    "items": [
        {
            "reference_id": "referencia do item",
            "name": "nome do item",
            "quantity": 1,
            "unit_amount": 500
        }
    ],
    "qr_code": {
        "amount": {
            "value": 500
        }
    },
    "shipping": {
        "address": {
            "street": "Avenida Brigadeiro Faria Lima",
            "number": "1384",
            "complement": "apto 12",
            "locality": "Pinheiros",
            "city": "São Paulo",
            "region_code": "SP",
            "country": "BRA",
            "postal_code": "01452002"
        }
    },
    "notification_urls": [
        "https://meusite.com/notificacoes"
    ],
    "charges": [
        {
            "reference_id": "referencia do pagamento",
            "description": "descricao do pagamento",
            "amount": {
                "value": 500,
                "currency": "BRL"
            },
            "payment_method": {
                "type": "CREDIT_CARD",
                "installments": 1,
                "capture": true,
                "card": {
                    "number": "4111111111111111",
                    "exp_month": "12",
                    "exp_year": "2026",
                    "security_code": "123",
                    "holder": {
                        "name": "Jose da Silva"
                    },
                    "store": false
                }
            },
            "notification_urls": [
                "https://meusite.com/notificacoes"
            ]
        }
    ]
}'
{
    "id": "ORDE_F432482E-DFD1-476E-B5FB-3077B5E3A856",
    "reference_id": "ex-00001",
    "created_at": "2020-11-21T23:12:23.28-03:00",
    "shipping": {
        "address": {
            "street": "Avenida Brigadeiro Faria Lima",
            "number": "1384",
            "complement": "apto 12",
            "locality": "Pinheiros",
            "city": "São Paulo",
            "region_code": "SP",
            "country": "BRA",
            "postal_code": "01452002"
        }
    },
    "items": [
        {
            "reference_id": "referencia do item",
            "name": "nome do item",
            "quantity": 1,
            "unit_amount": 500
        }
    ],
    "customer": {
        "name": "Jose da Silva",
        "email": "[email protected]",
        "tax_id": "12345678909",
        "phones": [
            {
                "country": "55",
                "area": "11",
                "number": "999999999",
                "type": "MOBILE"
            }
        ]
    },
    "charges": [
        {
            "id": "CHAR_3D4C63B5-B71E-418B-891E-660C79348C65",
            "reference_id": "referencia da cobranca",
            "status": "PAID",
            "created_at": "2020-11-21T23:12:25.114-03:00",
            "paid_at": "2020-11-21T23:12:25.737-03:00",
            "description": "descricao da cobranca",
            "amount": {
                "value": 500,
                "currency": "BRL",
                "summary": {
                    "total": 500,
                    "paid": 500,
                    "refunded": 0
                }
            },
            "payment_response": {
                "code": "20000",
                "message": "SUCESSO",
                "reference": "1606011145716"
            },
            "payment_method": {
                "type": "CREDIT_CARD",
                "installments": 1,
                "capture": true,
                "card": {
                    "brand": "visa",
                    "first_digits": "411111",
                    "last_digits": "1111",
                    "exp_month": "12",
                    "exp_year": "2026",
                    "holder": {
                        "name": "Jose da Silva"
                    }
                }
            },
            "links": [
                {
                    "rel": "SELF",
                    "href": "https://sandbox.api.pagseguro.com/charges/CHAR_3D4C63B5-B71E-418B-891E-660C79348C65",
                    "media": "application/json",
                    "type": "GET"
                },
                {
                    "rel": "CHARGE.CANCEL",
                    "href": "https://sandbox.api.pagseguro.com/charges/CHAR_3D4C63B5-B71E-418B-891E-660C79348C65/cancel",
                    "media": "application/json",
                    "type": "POST"
                }
            ]
        }
    ],
    "qr_codes": [
        {
            "id": "QRCO_AAA10C0A-4316-4C9C-A3CF-288E304BBC8A",
            "amount": {
                "value": 500
            },
            "text": "00020101021226600016BR.COM.PAGSEGURO0136AAA10C0A-4316-4C9C-A3CF-288E304BBC8A52048999530398654045.005802BR5922Rafael Gouveia Firmino6009SAO PAULO63049BA1",
            "links": [
                {
                    "rel": "QRCODE.PNG",
                    "href": "https://sandbox.api.pagseguro.com/qrcode/QRCO_AAA10C0A-4316-4C9C-A3CF-288E304BBC8A/png",
                    "media": "image/png",
                    "type": "GET"
                },
                {
                    "rel": "QRCODE.BASE64",
                    "href": "https://sandbox.api.pagseguro.com/qrcode/QRCO_AAA10C0A-4316-4C9C-A3CF-288E304BBC8A/base64",
                    "media": "text/plain",
                    "type": "GET"
                }
            ]
        }
    ],
    "links": [
        {
            "rel": "SELF",
            "href": "https://sandbox.api.pagseguro.com/orders/ORDE_F432482E-DFD1-476E-B5FB-3077B5E3A856",
            "media": "application/json",
            "type": "GET"
        },
        {
            "rel": "PAY",
            "href": "https://sandbox.api.pagseguro.com/orders/ORDE_F432482E-DFD1-476E-B5FB-3077B5E3A856/pay",
            "media": "application/json",
            "type": "POST"
        }
    ]
}