Skip to content
On this page

Upgrading from v1.x to v2.x

INFO

We attempt to document every possible breaking change. Since some of these breaking changes are in obscure parts of the package only a portion of these changes may actually affect your application.

High Impact Changes

Setting Gross Amount and Order ID

DANGER

Level of impact: High

Kasir object no longer have a transaction_details property. Instead, it is now assigns gross_amount and order_id individually.

If you are implementing transactionDetails() method to assign the gross_amount and order_id individually, you need to update that to grossAmount() and orderId() method respectively.

Or, if you are implementing getTransactionDetails() method to get the gross_amount and order_id individually, you need to update that to getGrossAmount() and getOrderId() method respectively.

php
class YourController extends Controller
{
    public function transaction(Request $request) {    
        $kasir = Kasir::make() 
            ->transactionDetails([ 
                'gross_amount' => $request->get('gross_amount'), 
                'order_id' => 'order-'.Str::randomUuid(), 
            ]); 
            ->grossAmount($request->get('gross_amount')) 
            ->orderId('order-'.Str::randomUuid()); 
            
        
        $gross_amount = $kasir->getTransactionDetails()['gross_amount']; 
        $gross_amount = $kasir->getGrossAmount(); 

        $order_id = $kasir->getTransactionDetails()['order_id']; 
        $order_id = $kasir->getOrderId(); 

        // ...
    }
}

"Midtrans" and Midtrans Logo are trademark of Midtrans (PT Midtrans). Kasir is not affiliated by Midtrans.