function telecoms.cart.edit

See also:


Standard Arguments

argrequired?syntaxinfo
cartIDYposintthe cartID of the cart instance; see telecoms.cart.list to get a list of all cartIDs
itemsconditionalarray of item objectsreplaces what is already in the cart with this list of items
items.addconditionalarray of item objectsadd these items to the cart; this adds to the items that were already in there - the old items are not removed
items.delconditionallist:posintarray or csv-string of itemID values referring to the items you wish to remove from the cart

Further argument information

items

An array of item records. See telecoms.cart.create:items for info on syntax.

This list of items replaces what might have already been in the cart. Any items requiring reservation (eg phone numbers) will have fresh reservations. If you add a phone number that is already in your cart, the options you chose (eg service-package) will override what was there for that item before.

Basically, you can use this argument to say "I don't care what was in there before, just make the contents match this."

If you supply this argument, you cannot supply items.add or items.del.

items.add

This behaves like the items argument, except that it leaves the previous cart items in the cart too. If you add new items that are duplicates of what is already in the cart, the behaviour will depend on the item type.

If you add a phone number that was already in the cart, the old clashing cart item will be replaced by the corresponding new one.

If you add another call credit item and you previously already had a call credit item in your cart, the new amount will be added to the old one. You will still only have one call credit item in the cart, but its value will be the sum of the old and the new.

If you supply this argument, you can also supply items.del but you cannot supply items.

items.del

Supply a list of itemIDs referring to the items you wish to delete from the cart. Whenever you call telecoms.cart.create, telecoms.cart.edit or telecoms.cart.get the API returns the list of items in the cart; each item record contains an itemID value within the items_meta section. See telecoms.cart.create and telecoms.cart.get for examples of this.

The value of the argument should be an array of itemIDs, eg [23821, 23823, 23891].

If you supply this argument, you can also supply items.add but you cannot supply items.

Return Values

This function returns the updated cart and also indicates any failures. The returned structure is the same as for telecoms.cart.create.

 

Additional Arguments for suppliers using a master account

argrequired?syntaxinfo
supplier_custIDsee descriptionposintSupply the master account custID if you're using one of our master API accounts, otherwise don't supply this argument. Requires one of billcomp, billcompID.
custIDsee descriptionposintcustID of the customer who is to own the shopping cart (leave blank to use your own account)