@@ -702,14 +702,14 @@ protected function createParcelData(
702702 }
703703
704704 if ($ weight ) {
705- $ parcelData ['weight ' ] = number_format ($ weight / 1000 , 3 );
705+ $ parcelData ['weight ' ] = number_format ($ weight / 1000 , 3 , ' . ' , '' );
706706 }
707707
708708 if ($ dimensions ) {
709709 // Note that the maximum of 2 decimal places is enforced by the API.
710- $ parcelData ['length ' ] = number_format ($ dimensions ->length , 2 );
711- $ parcelData ['width ' ] = number_format ($ dimensions ->width , 2 );
712- $ parcelData ['height ' ] = number_format ($ dimensions ->height , 2 );
710+ $ parcelData ['length ' ] = number_format ($ dimensions ->length , 2 , ' . ' , '' );
711+ $ parcelData ['width ' ] = number_format ($ dimensions ->width , 2 , ' . ' , '' );
712+ $ parcelData ['height ' ] = number_format ($ dimensions ->height , 2 , ' . ' , '' );
713713 }
714714
715715 if ($ customsInvoiceNumber ) {
@@ -738,8 +738,10 @@ protected function createParcelData(
738738 $ itemData = [
739739 'description ' => $ item ->description ,
740740 'quantity ' => $ item ->quantity ,
741- 'weight ' => number_format ($ item ->weight / 1000 , 3 ),
742- 'value ' => number_format ($ item ->value , 2 ),
741+ 'weight ' => number_format ($ item ->weight / 1000 , 3 , '. ' , '' ),
742+ // Sendcloud will error when value contains more than 2 decimal places, yet still wants this to be a
743+ // float instead of a string.
744+ 'value ' => round ($ item ->value , 2 ),
743745 ];
744746 if ($ item ->harmonizedSystemCode ) {
745747 $ itemData ['hs_code ' ] = $ item ->harmonizedSystemCode ;
0 commit comments