Bill

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



Endpoint


Method Desciption URI
POST Create Bill /api/v2/collections/{CODE}/bills
GET Get Bills /api/v2/collections/{CODE}/bills
GET Get Bill /api/v2/collections/{CODE}/bills/{BILL_NO}
PATCH Update Bill /api/v2/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/v2/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
payment_info payment info Object 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

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
        }
    ],
    "payment_info": {
        "payment_method_code": "mastercard",
        "credit_debit_card": {
            "card_no": "5123450000000008",
            "card_name": "raudhah",
            "card_expiry_month": "11",
            "card_expiry_year": "2022",
            "cvv": "123",
            "billing_address": {
                "street_1": "raudhah city",
                "city": "Cyber",
                "postcode": "41200",
                "state_province": "Selangor",
                "country_code": "MYS"
            }
        }
    }
}

Response


{success} Success code : 200

{
    "success": true,
    "data": {
        "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": "test multi currency",
        "ref2": "test multi currency",
        "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": "QuickBillUrl/billing/bills/bill-payment?code=W7uplQiU",
        "payment_url": "QuickBillUrl/payment/gateway/secure-pay?bill_no=W7uplQiU",
        "forward_payment_url": "QuickBillUrl/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": "test multicurrency",
                    "description": "test multi currency",
                    "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": []
    },
    "errors": null,
    "meta": {
        "timestamp": "2020-06-25 14:21:44 UTC",
        "timezone": "UTC"
    }
}

{info} For Error Reference, Related guide: Errors




Get Bills

Parameters


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

Filter Parameter:


Key Type
type ?filter[type]=type
account.first_name ?filter[account.first_name]=account.first_name
account.last_name ?filter[account.last_name]=account.last_name
account.acc_no ?filter[account.acc_no]=account.acc_no
bill_no ?filter[bill_no]=bill_no
payments.created_at ?filter[payments.created_at]=payments.created_at
account.accountGroups.group.name ?filter[account.accountGroups.group.name]= account.accountGroups.group.name
status ?filter[status]=status

Response


{success} Success code : 200

{
    "success": true,
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": 471,
                "bill_no": "5FxzKvH8",
                "due": "2019-09-30",
                "status": 2,
                "recurring": null,
                "recurring_end_date": null,
                "collection_id": 101,
                "type": 2,
                "account_id": 76,
                "ref1": "test multi currency",
                "ref2": "test multi currency",
                "api_redirect": 0,
                "created_at": "2019-09-23 05:49:15",
                "created_by": 2,
                "updated_at": "2019-10-31 04:37:29",
                "currency": "USD",
                "quantity_label": "",
                "is_metric": 0,
                "master_bill": null,
                "rbill_date": null,
                "bill_url": "QuickBillUrl/billing/bills/bill-payment?code=5FxzKvH8",
                "payment_url": "QuickBillUrl/payment/gateway/secure-pay?bill_no=5FxzKvH8",
                "forward_payment_url": null,
                "total_amount": "10.00",
                "total_paid": "41.66",
                "balance": "-31.66",
                "paid": true,
                "product_collections": [
                    {
                        "id": 610,
                        "bill_id": 471,
                        "product_id": 114,
                        "created_at": "2019-09-23 05:49:15",
                        "updated_at": "2019-09-23 05:58:23",
                        "quantity": 1.0,
                        "product": {
                            "id": 114,
                            "title": "test multicurrency",
                            "description": "test multi currency",
                            "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": [
                    {
                        "id": 106,
                        "quick_pay_id": null,
                        "offline_id": null,
                        "transaction_id": 156,
                        "total_payment": "41.66",
                        "currency": "MYR",
                        "created_at": "2019-09-23 06:16:15",
                        "updated_at": "2019-09-23 06:16:15",
                        "settled": 0
                    }
                ]
            }
        ],
        "first_page_url": "http://raudhahpay-api.test/api/v2/collections/R5yK8yHK/bills?page=1",
        "from": 1,
        "last_page": 1,
        "last_page_url": "http://raudhahpay-api.test/api/v2/collections/R5yK8yHK/bills?page=1",
        "next_page_url": null,
        "path": "http://raudhahpay-api.test/api/v2/collections/R5yK8yHK/bills",
        "per_page": 15,
        "prev_page_url": null,
        "to": 13,
        "total": 13
    },
    "errors": null,
    "meta": {
        "timestamp": "2020-06-25 14:24:25 UTC",
        "timezone": "UTC"
    }
}

{info} For Error Reference, Related guide: Errors




Get Bill

Parameters


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

Response


{success} Success code : 200

{
    "success": true,
    "data": {
        "id": 2789,
        "bill_no": "jgfp6IzU",
        "due": "2020-06-06",
        "status": 2,
        "recurring": null,
        "recurring_end_date": null,
        "collection_id": 101,
        "type": 2,
        "account_id": 100,
        "ref1": "test multi currency",
        "ref2": "test multi currency",
        "api_redirect": 1,
        "created_at": "2020-06-25 14:23:53",
        "created_by": null,
        "updated_at": "2020-06-25 14:23:53",
        "currency": "MYR",
        "quantity_label": null,
        "is_metric": 0,
        "master_bill": null,
        "rbill_date": null,
        "bill_url": "QuickBillUrl/billing/bills/bill-payment?code=jgfp6IzU",
        "payment_url": "QuickBillUrl/payment/gateway/secure-pay?bill_no=jgfp6IzU",
        "forward_payment_url": "QuickBillUrl/payment/gateway/forward-to-payment-gateway?transactionRefId=CD__jgfp6IzU__20200625142353",
        "total_amount": "134.00",
        "total_paid": "0.00",
        "balance": "134.00",
        "paid": false,
        "product_collections": [
            {
                "id": 3268,
                "bill_id": 2789,
                "product_id": 114,
                "created_at": "2020-06-25 14:23:53",
                "updated_at": "2020-06-25 14:23:53",
                "quantity": 10.0,
                "product": {
                    "id": 114,
                    "title": "test multicurrency",
                    "description": "test multi currency",
                    "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"
                }
            },
            {
                "id": 3269,
                "bill_id": 2789,
                "product_id": 120,
                "created_at": "2020-06-25 14:23:53",
                "updated_at": "2020-06-25 14:23:53",
                "quantity": 1.0,
                "product": {
                    "id": 120,
                    "title": "Gas",
                    "description": "Gas Shell",
                    "code": "GASSHELL",
                    "price": "34.00",
                    "product_id": null,
                    "currency": null,
                    "organization_id": 1,
                    "created_at": "2019-09-27 02:08:11",
                    "updated_at": "2019-09-27 02:08:11"
                }
            }
        ],
        "payments": []
    },
    "errors": null,
    "meta": {
        "timestamp": "2020-06-25 14:31:23 UTC",
        "timezone": "UTC"
    }
}

{info} For Error Reference, Related guide: Errors




Update Bill

Parameters


Method URI
PATCH /api/v2/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

{
    "success": true,
    "data": {
        "id": 2789,
        "bill_no": "jgfp6IzU",
        "due": "2020-06-06",
        "status": 2,
        "recurring": null,
        "recurring_end_date": null,
        "collection_id": 101,
        "type": 2,
        "account_id": 100,
        "ref1": "test multi currency",
        "ref2": "test multi currency",
        "api_redirect": 1,
        "created_at": "2020-06-25 14:23:53",
        "created_by": null,
        "updated_at": "2020-06-25 14:23:53",
        "currency": "MYR",
        "quantity_label": null,
        "is_metric": 0,
        "master_bill": null,
        "rbill_date": null,
        "bill_url": "QuickBillUrl/billing/bills/bill-payment?code=jgfp6IzU",
        "payment_url": "QuickBillUrl/payment/gateway/secure-pay?bill_no=jgfp6IzU",
        "forward_payment_url": "QuickBillUrl/payment/gateway/forward-to-payment-gateway?transactionRefId=CD__jgfp6IzU__20200625142353",
        "total_amount": "134.00",
        "total_paid": "0.00",
        "balance": "134.00",
        "paid": false,
        "product_collections": [
            {
                "id": 3268,
                "bill_id": 2789,
                "product_id": 114,
                "created_at": "2020-06-25 14:23:53",
                "updated_at": "2020-06-25 14:23:53",
                "quantity": 10.0,
                "product": {
                    "id": 114,
                    "title": "test multicurrency",
                    "description": "test multi currency",
                    "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"
                }
            },
            {
                "id": 3269,
                "bill_id": 2789,
                "product_id": 120,
                "created_at": "2020-06-25 14:23:53",
                "updated_at": "2020-06-25 14:23:53",
                "quantity": 1.0,
                "product": {
                    "id": 120,
                    "title": "Gas",
                    "description": "Gas Shell",
                    "code": "GASSHELL",
                    "price": "34.00",
                    "product_id": null,
                    "currency": null,
                    "organization_id": 1,
                    "created_at": "2019-09-27 02:08:11",
                    "updated_at": "2019-09-27 02:08:11"
                }
            }
        ],
        "payments": []
    },
    "errors": null,
    "meta": {
        "timestamp": "2020-06-25 14:33:10 UTC",
        "timezone": "UTC"
    }
}

{info} For Error Reference, Related guide: Errors