Syntax

 createAddonChangePurchase(
     purchase_id,
     addons,
     tracking=array(),
     placeholders=array()      
 )

Creates a package change order. Use this add to an order products or remove them.

The main products quantity cannot be changed.

Added products must be subscriptions.

Access rights

Full access required.

In addition, the “Billing on demand” right must be enabled for the vendor account.

Arguments

purchase_id – The reference order. This order must have been made with a payment method that supports rebilling.

addons – A list of add-on products as a two-dimensional array. First dimension is an index (integer starting with 0), second dimension is the fields e.g.

addons[0][product_id]=12345
addons[0][first_amount]=27.99

Any number of add-ons can be added. Use these fields:

  • product_id - int - required. Digistore24 product id.
  • amount – float - optional. The rebilling amount of the subscription
  • quantity – int - default is 1.
  • is_quantity_editable_after_purchase – Y/N – Can the buyer change the quantity after the purchase (e.g. to book additional packages)? Default: N

tracking – An array with the data for tracking. All fields are optional. Any field not given is taken from the initial purchase.

  • custom – The custom value that you as a vendor can transfer to the order form via the GET parameter “custom”, which will then be looped through. Use this value as an order reference for your own system. In the IPN notification for the purchase order, the value of this field is then transferred as custom. This is the same in the API functions listPurchases() and getPurchase().
  • affiliate – The affiliate's Digistore24 ID. If it is not valid, the function will return an error.
  • campaignkey – The campaign key (of the affiliate)
  • trackingkey – The vendor's tracking key (which can also be transferred as the GET parameter “ds24tr” to the order form)

placeholders – An array with placeholders for the product title and product description. See parameter placeholders of createBillingOnDemand.


Return data

created_purchase_id: The ID of the new order

payment_status: The payment status of the payment

payment_status_msg: Payment status in readable form

billing_status: Status of the new order e.g. completed or paying

billing_status_msg: Order status in readable form

pay_url: if the payment failed, direct the buyer to his url to restart the payments.

See also