I want to create an invoice with multiple payment methods in one order, such as half payment in cash and half payment with a credit card, and then how to handle this in Netsuite via soap API laravel.

    $customerId = customer_id;
    // Replace placeholder values with your actual data
    $customPriceLevelId = $this->getCustomPriceLevelId('Retail Price'); 
    // Replace with your actual method to get custom price level ID
    $stripePaymentMethodId = 7; // Replace with your actual method to 
        get Stripe payment method ID
    $otherPaymentMethodId = 1; // Replace with your actual method to 
     get the other payment method ID

    $so = new SalesOrder();
    $so->entity = new RecordRef();
    $so->entity->internalId = $customerId;

    // Set the shipping address details
    $so->shippingAddress = new Address();
    $so->shippingAddress->attention = " Test";
    $so->shippingAddress->addressee = " Test";
    $so->shippingAddress->addr1 = "Test";
    $so->shippingAddress->addr2 = "";
    $so->shippingAddress->addr3 = "";
    $so->shippingAddress->addrPhone  = "";
    $so->shippingAddress->city = "text";
    $so->shippingAddress->state = "";
    $so->shippingAddress->zip = "test";
    // $so->shippingAddress->country = "United Kingdom"; // not worked
    $so->shippingAddress->country = Country::_unitedKingdom;


    // Add line items to the Sales Order
    $so->itemList = new SalesOrderItemList();
    $soi = new SalesOrderItem();
    $soi->item = new RecordRef();
    $soi->item->internalId = ITEM_ID;
    $soi->quantity = 3;
    $soi->price = new RecordRef();
    $soi->price->internalId = $customPriceLevelId;
    $soi->amount = 55.3;
    $soi->taxRate1 = 0;
    // $soi->tax1Amt = 4.7;
    // $soi->isTaxable = false; // not worked
    // $soi->taxAmount = 1.1; // not worked
    // $soi->taxRate1 = 1.1;
    // $soi->taxRate2 = 1.2; // not worked
    $so->itemList->item = array($soi);



    // Add payment details in Sales Order
    $so->paymentMethod = new RecordRef();

    // Add the Sales Order
    $request = new AddRequest();
    $request->record = $so;

    $addResponse = $this->serviceNetSuite->add($request);

    if (!$addResponse->writeResponse->status->isSuccess) {
        echo "ADD ERROR";
        re($addResponse);
        exit();
    } else {
        echo "ADD SUCCESS, id " . $addResponse->writeResponse->baseRef->internalId;
        re($addResponse);
        exit;
}

I Have Done order creation using laravel. I am passing order creation request like above script Now I want to create payment and invoice.

0

There are 0 best solutions below