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

# Create bill

> Create bill

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET https://api.swervpay.co/api/v1/bills \
    -H "Authorization: Bearer <TOKEN>" \
    -H "Content-Type: application/json"
    -d '{
    "customer_id": "<CUSTOMER_ID>",
    "amount": "<AMOUNT>",
    "reference": "<REFERENCE>",
    "biller_id": "<BILLER_ID>",
    "item_id": "<ITEM_ID>",
    "category": "<CATEGORY>",
    }'
  ```

  ```javascript Node.js theme={null}
  import { SwervpayClient } from '@swervpaydev/sdk';

  const config = {
      secretKey: "<SECRET_KEY>",
      businessId: "<BUSINESS_ID>"
  }

  const swervpay = new SwervpayClient(config);

  await swervpay.bill.create({
  	"amount": "<AMOUNT>",
  	"customer_id": "<CUSTOMER_ID>",
  	"reference": "<REFERENCE>",
  	"biller_id": "<BILLER_ID>",
  	"item_id": "<ITEM_ID>",
  	"category": "<CATEGORY>",
  });
  ```

  ```php PHP theme={null}
  use Swervpaydev\SDK\Swervpay;

  $config = [
  	'business_id' => '<BUSINESS_ID>',
  	'secret_key' => '<SECRET_KEY>'
  ];

  $client = new Swervpay($config);

  $payload = array(
      "customer_id" => "<CUSTOMER_ID>",
  	"amount" => "<AMOUNT>",
  	"reference" => "<REFERENCE>",
  	"biller_id" => "<BILLER_ID>",
  	"item_id" => "<ITEM_ID>",
  	"category" => "<CATEGORY>",
  )

  $client->bill()->create($payload)->toArray();
  ```

  ```go Go theme={null}
  package main

  import (
  	"context"
  	"fmt"
  	"github.com/swerv-ltd/swervpay-go"
  	"log"
  )

  func main() {
  	ctx := context.Background()

  	client := swervpay.NewSwervpayClient(&swervpay.SwervpayClientOption{
          BusinessID: "<BUSINESS_ID>",
          SecretKey: "<SECRET_KEY>",
      })

      payload := swervpay.BillCreateRequest{
  		CustomerID: "<CUSTOMER_ID>",
  		Amount: "<AMOUNT>",
  		Reference: "<REFERENCE>",
  		BillerID: "<BILLER_ID>",
  		ItemID: "<ITEM_ID>",
  		Category: "<CATEGORY>",
  	}

  	resp, err := client.Bill.Create(ctx, payload)

  	if err != nil {
  		log.Fatal("error", err.Error())
  		return
  	}
  }
  ```
</RequestExample>


## OpenAPI

````yaml POST /bills
openapi: 3.0.0
info:
  title: Swervpay Developer API Specification
  version: 0.0.0
servers:
  - url: https://api.swervpay.co/api/v1
    description: Production API
  - url: https://sandbox.swervpay.co/api/v1
    description: Sandbox API
security:
  - bearerAuth: []
paths:
  /bills:
    post:
      tags:
        - bills
      description: Create bill
      operationId: createBill
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BusinessBillCreateBillInput'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TypesBillTransaction'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsererrorError'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsererrorError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsererrorError'
components:
  schemas:
    BusinessBillCreateBillInput:
      type: object
      properties:
        amount:
          type: number
        biller_id:
          type: string
        category:
          type: string
        customer_id:
          type: string
        item_id:
          type: string
        reference:
          type: string
    TypesBillTransaction:
      type: object
      properties:
        account_name:
          type: string
        account_number:
          type: string
        amount:
          type: number
        bank_code:
          type: string
        bank_name:
          type: string
        bill:
          $ref: '#/components/schemas/TypesBillDetail'
        category:
          type: string
        charges:
          type: number
        created_at:
          type: string
          format: date-time
        detail:
          type: string
        fiat_rate:
          type: number
        id:
          type: string
        imad:
          type: string
        payment_method:
          type: string
        reference:
          type: string
        report:
          type: boolean
        report_message:
          type: string
        session_id:
          type: string
        status:
          type: string
        trace_number:
          type: string
        type:
          type: string
        updated_at:
          type: string
          format: date-time
    UsererrorError:
      type: object
      properties:
        message:
          type: string
        values:
          type: object
          additionalProperties: {}
    TypesBillDetail:
      type: object
      properties:
        bill_code:
          type: string
        bill_name:
          type: string
        item_code:
          type: string
        name:
          type: string
        token:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````