Bill

Bill is just like an invoice. This is where you want to charge your customer.



Endpoint


Method Desciption URI
POST Create Bill /api/collections/{CODE}/bills
GET Get Bills /api/collections/{CODE}/bills
GET Get Bill /api/collections/{CODE}/bills/{BILL_NO}
PATCH Update Bill /api/collections/{CODE}/bills/{BILL_NO}



Required Headers


Key Value
Accept application/json
Content-Type application/json
Authorization Bearer {ACCESS-TOKEN}


Create Bill

Parameters


Method URI
POST /api/collections/{CODE}/bills

Body:


Key Type Required
due string Yes
ref1 string Yes
ref2 string Yes
currency string Yes
customer Customer Object Yes
product products Object Yes

Include Parameter:


Key Type
account ?include=account
collection.organization ?include=collection.organization
product-collections.product ?include=product-collections.product
payments.transaction ?include=payments.transaction

Example :

{
    "due": "2020-06-25",
    "ref1": "test multi currency",
    "ref2": "test multi currency",
    "currency": "MYR",
    "customer": {
        "acc_no": "911111111111",
        "first_name": "RAUDHAH",
        "last_name": "PAY",
        "address": "raudhahPay",
        "email": "team@raudhahpay.com",
        "mobile": "60123456789",
        "organization_id": 1
    },
    "product": [
        {
            "id": 1,
            "title": "product 1",
            "price": "10.00",
            "quantity": 10,
            "organization_id": 1
        },{
            "id": 2,
            "title": "product 2",
            "price": "5.00",
            "quantity": 1,
            "organization_id": 1
        }
    ]
}

Response


{success} Success code : 200

{
    "id": 2788,
    "bill_no": "W7uplQiU",
    "due": "2020-06-06",
    "status": 2,
    "recurring": null,
    "recurring_end_date": null,
    "collection_id": 101,
    "type": 2,
    "account_id": 100,
    "ref1": "example ref1",
    "ref2": "example ref2",
    "api_redirect": 1,
    "created_at": "2020-06-25 14:21:44",
    "created_by": null,
    "updated_at": "2020-06-25 14:21:44",
    "currency": "MYR",
    "quantity_label": null,
    "is_metric": 0,
    "master_bill": null,
    "rbill_date": null,
    "bill_url": "{SERVER_URL}/billing/bills/bill-payment?code=W7uplQiU",
    "payment_url": "{SERVER_URL}/payment/gateway/secure-pay?bill_no=W7uplQiU",
    "forward_payment_url": "{SERVER_URL}/payment/gateway/forward-to-payment-gateway?transactionRefId=CD__W7uplQiU__20200625142144",
    "total_amount": "134.00",
    "total_paid": "0.00",
    "balance": "134.00",
    "paid": false,
    "product_collections": [
        {
            "id": 3266,
            "bill_id": 2788,
            "product_id": 114,
            "created_at": "2020-06-25 14:21:44",
            "updated_at": "2020-06-25 14:21:44",
            "quantity": 10.0,
            "product": {
                "id": 114,
                "title": "example title",
                "description": "example descriptiobn",
                "code": "tst",
                "price": "10.00",
                "product_id": 113,
                "currency": null,
                "organization_id": 1,
                "created_at": "2019-09-23 05:58:23",
                "updated_at": "2019-09-23 05:58:23"
            }
        }
    ],
    "payments": []
}

{info} For Error Reference, Related guide: Errors



Get Bills

Parameters


Method URI
GET /api/collections/{CODE}/bills

Response


{success} Success code : 200

{
    "id": 2788,
    "bill_no": "W7uplQiU",
    "due": "2020-06-06",
    "status": 2,
    "recurring": null,
    "recurring_end_date": null,
    "collection_id": 101,
    "type": 2,
    "account_id": 100,
    "ref1": "example ref1",
    "ref2": "example ref2",
    "api_redirect": 1,
    "created_at": "2020-06-25 14:21:44",
    "created_by": null,
    "updated_at": "2020-06-25 14:21:44",
    "currency": "MYR",
    "quantity_label": null,
    "is_metric": 0,
    "master_bill": null,
    "rbill_date": null,
    "bill_url": "{SERVER_URL}/billing/bills/bill-payment?code=W7uplQiU",
    "payment_url": "{SERVER_URL}/payment/gateway/secure-pay?bill_no=W7uplQiU",
    "forward_payment_url": "{SERVER_URL}/payment/gateway/forward-to-payment-gateway?transactionRefId=CD__W7uplQiU__20200625142144",
    "total_amount": "134.00",
    "total_paid": "0.00",
    "balance": "134.00",
    "paid": false,
    "product_collections": [
        {
            "id": 3266,
            "bill_id": 2788,
            "product_id": 114,
            "created_at": "2020-06-25 14:21:44",
            "updated_at": "2020-06-25 14:21:44",
            "quantity": 10.0,
            "product": {
                "id": 114,
                "title": "example title",
                "description": "example descriptiobn",
                "code": "tst",
                "price": "10.00",
                "product_id": 113,
                "currency": null,
                "organization_id": 1,
                "created_at": "2019-09-23 05:58:23",
                "updated_at": "2019-09-23 05:58:23"
            }
        }
    ],
    "payments": []
}

{info} For Error Reference, Related guide: Errors



Get Bill

Parameters


Method URI
GET /api/collections/{CODE}/bills/{BILL_NO}

Response


{success} Success code : 200

{
    "id": 2788,
    "bill_no": "W7uplQiU",
    "due": "2020-06-06",
    "status": 2,
    "recurring": null,
    "recurring_end_date": null,
    "collection_id": 101,
    "type": 2,
    "account_id": 100,
    "ref1": "example ref1",
    "ref2": "example ref2",
    "api_redirect": 1,
    "created_at": "2020-06-25 14:21:44",
    "created_by": null,
    "updated_at": "2020-06-25 14:21:44",
    "currency": "MYR",
    "quantity_label": null,
    "is_metric": 0,
    "master_bill": null,
    "rbill_date": null,
    "bill_url": "{SERVER_URL}/billing/bills/bill-payment?code=W7uplQiU",
    "payment_url": "{SERVER_URL}/payment/gateway/secure-pay?bill_no=W7uplQiU",
    "forward_payment_url": "{SERVER_URL}/payment/gateway/forward-to-payment-gateway?transactionRefId=CD__W7uplQiU__20200625142144",
    "total_amount": "134.00",
    "total_paid": "0.00",
    "balance": "134.00",
    "paid": false,
    "product_collections": [
        {
            "id": 3266,
            "bill_id": 2788,
            "product_id": 114,
            "created_at": "2020-06-25 14:21:44",
            "updated_at": "2020-06-25 14:21:44",
            "quantity": 10.0,
            "product": {
                "id": 114,
                "title": "example title",
                "description": "example descriptiobn",
                "code": "tst",
                "price": "10.00",
                "product_id": 113,
                "currency": null,
                "organization_id": 1,
                "created_at": "2019-09-23 05:58:23",
                "updated_at": "2019-09-23 05:58:23"
            }
        }
    ],
    "payments": []
}

{info} For Error Reference, Related guide: Errors



Update Bill

Parameters


Method URI
PATCH /api/collections/{CODE}/bills/{BILL_NO}

Key Type Required
due string Optional
ref1 string Optional
ref2 string Optional
currency string Optional
cancel boolean Optional

Include Parameter:


Key Type
account ?include=account
collection.organization ?include=collection.organization
product-collections.product ?include=product-collections.product
payments.transaction ?include=payments.transaction

Response


{success} Success code : 200

{
    "id": 2788,
    "bill_no": "W7uplQiU",
    "due": "2020-06-06",
    "status": 2,
    "recurring": null,
    "recurring_end_date": null,
    "collection_id": 101,
    "type": 2,
    "account_id": 100,
    "ref1": "example ref1",
    "ref2": "example ref2",
    "api_redirect": 1,
    "created_at": "2020-06-25 14:21:44",
    "created_by": null,
    "updated_at": "2020-06-25 14:21:44",
    "currency": "MYR",
    "quantity_label": null,
    "is_metric": 0,
    "master_bill": null,
    "rbill_date": null,
    "bill_url": "{SERVER_URL}/billing/bills/bill-payment?code=W7uplQiU",
    "payment_url": "{SERVER_URL}/payment/gateway/secure-pay?bill_no=W7uplQiU",
    "forward_payment_url": "{SERVER_URL}/payment/gateway/forward-to-payment-gateway?transactionRefId=CD__W7uplQiU__20200625142144",
    "total_amount": "134.00",
    "total_paid": "0.00",
    "balance": "134.00",
    "paid": false,
    "product_collections": [
        {
            "id": 3266,
            "bill_id": 2788,
            "product_id": 114,
            "created_at": "2020-06-25 14:21:44",
            "updated_at": "2020-06-25 14:21:44",
            "quantity": 10.0,
            "product": {
                "id": 114,
                "title": "example title",
                "description": "example descriptiobn",
                "code": "tst",
                "price": "10.00",
                "product_id": 113,
                "currency": null,
                "organization_id": 1,
                "created_at": "2019-09-23 05:58:23",
                "updated_at": "2019-09-23 05:58:23"
            }
        }
    ],
    "payments": []
}

{info} For Error Reference, Related guide: Errors