> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wepayout.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Charge

> Create a new credit card charge with payment page or transparent checkout

## Request Body

<ParamField body="callbackUrl" type="string" required>
  The url where we will submit the callbacks.
</ParamField>

<ParamField body="customNumber" type="string" required>
  Your identification number, it must be unique on our database.
</ParamField>

<ParamField body="clientId" type="integer or null">
  The use of clientID to create payments. Is mandatory if there is more than one account under the same clientId.
</ParamField>

<ParamField body="title" type="object" required>
  Payment instructions.

  <Expandable title="title properties">
    <ParamField body="title.expireDate" type="string" required>
      Expiration date in format `YYYY-MM-DDTHH:SS`. Ex.: 2021-12-31T23:59:59
    </ParamField>

    <ParamField body="title.amountInCents" type="integer" required>
      Amount in cents (e.g., 8652 = R\$ 86.52)
    </ParamField>

    <ParamField body="title.instructions" type="string">
      Payment instructions text
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="buyer" type="object" required>
  The person that you are charging object.

  <Expandable title="buyer properties">
    <ParamField body="buyer.name" type="string" required>
      Buyer's full name
    </ParamField>

    <ParamField body="buyer.document" type="object" required>
      <Expandable title="document properties">
        <ParamField body="buyer.document.number" type="string" required>
          CPF or CNPJ number
        </ParamField>

        <ParamField body="buyer.document.type" type="string" required>
          Document type: `CPF` or `CNPJ`
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField body="buyer.address" type="object" required>
      <Expandable title="address properties">
        <ParamField body="buyer.address.street" type="string" required>
          Street name
        </ParamField>

        <ParamField body="buyer.address.number" type="string" required>
          Street number
        </ParamField>

        <ParamField body="buyer.address.complement" type="string">
          Address complement
        </ParamField>

        <ParamField body="buyer.address.zipCode" type="string" required>
          ZIP code
        </ParamField>

        <ParamField body="buyer.address.city" type="string" required>
          City name
        </ParamField>

        <ParamField body="buyer.address.district" type="string" required>
          District/neighborhood
        </ParamField>

        <ParamField body="buyer.address.stateCode" type="string" required>
          State code (2 letters, e.g., "PR")
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="refundMode" type="string">
  Default: `FULL_REFUND_CLIENT`

  Enum: `FULL_REFUND_CLIENT`, `FULL_REFUND_RECIPIENT`, `REFUND_BY_SPLIT`

  Enum of some refund options.
</ParamField>

<ParamField body="sender" type="object" required>
  **REQUIRED FOR CREDIT-CARD CHARGES.**

  Use this object to inform the legal name of the final beneficiary, it could be your company's name or the company you are proving a service for.

  Final Beneficiary is a person or a company that will receive the amount paid trough the boleto.

  <Expandable title="sender properties">
    <ParamField body="sender.name" type="string" required>
      Sender name
    </ParamField>

    <ParamField body="sender.document" type="string" required>
      Sender document (CPF or CNPJ)
    </ParamField>

    <ParamField body="sender.helpdesk" type="string" required>
      Sender helpdesk contact
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="checkout" type="object">
  Payer informations for transparent checkout. Use `token` for new card payment or `card_id` for saved card payment.

  <Expandable title="checkout properties">
    <ParamField body="checkout.token" type="string">
      Card token generated by the tokenization process. Required if `card_id` is not provided. Max length: 190 characters.
    </ParamField>

    <ParamField body="checkout.card_id" type="integer">
      ID of a previously saved credit card. Required if `token` is not provided.
    </ParamField>

    <ParamField body="checkout.installments" type="integer" required>
      Number of installments (1 for single payment). Required unless checkout is null.
    </ParamField>

    <ParamField body="checkout.payment_method_id" type="string">
      Payment method identifier (e.g., "master", "visa", "elo"). Max length: 30 characters. Required if `card_id` is not provided.
    </ParamField>

    <ParamField body="checkout.payer_name" type="string" required>
      Payer's full name. Max length: 100 characters. Required unless checkout is null.
    </ParamField>

    <ParamField body="checkout.payer_phone" type="string">
      Payer's phone number. Must be numeric with 5 to 45 digits.
    </ParamField>

    <ParamField body="checkout.payer_document" type="string">
      Payer's CPF or CNPJ number. Must be a valid tax number.
    </ParamField>

    <ParamField body="checkout.payer_address" type="object">
      <Expandable title="payer_address properties">
        <ParamField body="checkout.payer_address.zip_code" type="string" required>
          ZIP code. Max length: 45 characters. Required if payer\_address is provided.
        </ParamField>

        <ParamField body="checkout.payer_address.street_name" type="string" required>
          Street name. Max length: 100 characters. Required if payer\_address is provided.
        </ParamField>

        <ParamField body="checkout.payer_address.street_number" type="string" required>
          Street number. Max length: 45 characters. Required if payer\_address is provided.
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField body="checkout.payer_email" type="string">
      Payer's email address. Required if `save_card` is set to `1`.
    </ParamField>

    <ParamField body="checkout.save_card" type="integer">
      Flag to save card for future use. `0` = do not save, `1` = save card. Must be 0 or 1.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="statement_descriptor" type="string">
  Short description shown at the credit-card bill.
</ParamField>

<ParamField body="product_info" type="array of objects">
  Array with product metadata.
</ParamField>

<ParamField body="use_3ds" type="integer or null">
  Default: `null`

  Enum: `0`, `1`, `null`

  Flag to inform that the charge must validate through three d secure mode
</ParamField>

## Response

<ResponseField name="id" type="string">
  Charge ID
</ResponseField>

<ResponseField name="key" type="string">
  Unique key for payment page access
</ResponseField>

<ResponseField name="clientId" type="integer">
  Client ID
</ResponseField>

<ResponseField name="clientName" type="string">
  Client name
</ResponseField>

<ResponseField name="senderName" type="string or null">
  Sender name
</ResponseField>

<ResponseField name="senderHelpdesk" type="string or null">
  Sender helpdesk
</ResponseField>

<ResponseField name="buyerName" type="string">
  Buyer name
</ResponseField>

<ResponseField name="buyerDocument" type="string">
  Buyer document
</ResponseField>

<ResponseField name="buyerEmail" type="string">
  Buyer email
</ResponseField>

<ResponseField name="customNumber" type="string">
  Your custom number
</ResponseField>

<ResponseField name="ourNumber" type="string or null">
  Our internal number
</ResponseField>

<ResponseField name="digitableLine" type="string or null">
  Digitable line (for boleto)
</ResponseField>

<ResponseField name="barCodeNumber" type="string or null">
  Bar code number (for boleto)
</ResponseField>

<ResponseField name="status" type="object">
  Current status

  <Expandable title="status properties">
    <ResponseField name="status.id" type="integer">
      Status ID
    </ResponseField>

    <ResponseField name="status.name" type="string">
      Status name
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="sender" type="object">
  Sender information
</ResponseField>

<ResponseField name="typePayin" type="string">
  Type of payment (e.g., "credit-card")
</ResponseField>

<ResponseField name="instructions" type="string">
  Payment instructions
</ResponseField>

<ResponseField name="amountCents" type="integer">
  Amount in cents
</ResponseField>

<ResponseField name="paidAmountCents" type="integer or null">
  Paid amount in cents
</ResponseField>

<ResponseField name="paidAt" type="string or null">
  Payment date
</ResponseField>

<ResponseField name="expiresAt" type="string">
  Expiration date
</ResponseField>

<ResponseField name="createdAt" type="string">
  Creation date
</ResponseField>

<ResponseField name="fine" type="object or null">
  Fine information
</ResponseField>

<ResponseField name="discount" type="object or null">
  Discount information
</ResponseField>

<ResponseField name="statusHistory" type="array">
  Status change history
</ResponseField>

<ResponseField name="refundMode" type="string">
  Refund mode
</ResponseField>

<ResponseField name="refundAmountCents" type="integer">
  Refunded amount in cents
</ResponseField>

<ResponseField name="payinRefunds" type="array">
  Refund records
</ResponseField>

<ResponseField name="payin_substatus" type="string or null">
  Sub-status
</ResponseField>

<ResponseField name="kyc" type="object or null">
  KYC information
</ResponseField>

<ResponseField name="installments" type="array">
  Installment information
</ResponseField>

<ResponseField name="hasAdvancement" type="boolean">
  Has advancement flag
</ResponseField>

<ResponseField name="use3ds" type="boolean">
  3D Secure flag
</ResponseField>

<ResponseExample>
  ```json 201 theme={null}
  {
    "id": "28018",
    "key": "e1ebf9d914174902a76a5af436f091d09cca0b1e9ad8984b5dcdfeead67ce6b8",
    "clientId": 1,
    "clientName": "Your company",
    "senderName": null,
    "senderHelpdesk": null,
    "buyerName": "Maria da Silva",
    "buyerDocument": "34960826312",
    "buyerEmail": "buyer-email@wepayments.com.br",
    "customNumber": "YOUR-CODE1234",
    "ourNumber": null,
    "digitableLine": null,
    "barCodeNumber": null,
    "status": {
      "id": 1,
      "name": "awaiting approval"
    },
    "sender": {
      "name": null,
      "document": null,
      "helpdesk": null
    },
    "typePayin": "credit-card",
    "instructions": "Esse Pagamento é referente ao pedido 123 na loja abcd",
    "amountCents": 8652,
    "paidAmountCents": null,
    "paidAt": null,
    "expiresAt": "2024-12-31 23:59:59",
    "createdAt": "2024-02-21T19:15:00.000000Z",
    "fine": null,
    "discount": null,
    "statusHistory": [
      {
        "status": {
          "id": 1,
          "name": "Created"
        }
      },
      {
        "status": {
          "id": 6,
          "name": "awaiting approval"
        },
        "id": 48859,
        "updatedAt": "2024-02-21T19:15:04.000000Z"
      }
    ],
    "refundMode": "FULL_REFUND_CLIENT",
    "refundAmountCents": 0,
    "payinRefunds": [],
    "payin_substatus": null,
    "kyc": null,
    "installments": [],
    "hasAdvancement": true,
    "use3ds": false
  }
  ```

  ```json 400 theme={null}
  {
    "message": "Bad Resquest message"
  }
  ```

  ```json 401 theme={null}
  {
    "error": "Unauthorized"
  }
  ```

  ```json 403 theme={null}
  {
    "error": "Forbidden resource"
  }
  ```

  ```json 404 theme={null}
  {
    "status": false,
    "message": "Payin not found",
    "data": "No result were found for the given parameters. Please try again using other suported keys: id, key, ourNumber or end_to_end"
  }
  ```

  ```json 422 theme={null}
  {
    "status": false,
    "message": "Validation error",
    "data": {
      "title.expireDate": [
        "The title.expire date must be a date after now."
      ],
      "product_info": [
        "The product info field is required."
      ]
    }
  }
  ```

  ```json 500 Internal Server Error theme={null}
  {
    "status": false,
    "message": "Server error"
  }
  ```
</ResponseExample>
