def add_item(self, item_id, description, amount, quantity, shipping_cost=None, weight=None): item = Item( item_id=item_id, description=description, amount=amount, quantity=quantity, shipping_cost=shipping_cost, weight=weight, ) item.validate() if not self.payment_request.checkout.items: self.payment_request.checkout.items = [] self.payment_request.checkout.items.append(item)