Purchase a subscription

PurchaseSubscription activates a subscription by initializing a payment process equal to the one for normal Baskets. When a Subscription is activated orders will be created according to the Schedules specified for the Subscription.

Request
query Parameters
subscriptionId
required
integer <int32>

The internal id of the Subscription to activate. Only inactive Subscriptions can be purchased and the Subscription must have valid Schedules.

ipAddress
required
string

The user's ipAddress.

userAgent
required
string

The user agent of the user's browser.

pricelistSeed
string

A comma separated list of internal pricelist ids to use, if any. PriceLists supplied must be valid, either from the application's public priceList or any customer or company priceLists or any valid client priceLists. For clients configured to use priceListSeed exclusively in the API only the supplied priceLists will be used. If this is not configured, the supplied priceLists will be appended to the valid priceLists. If none is supplied, the default value for the application will be used in combination with any customer or company priceLists. This applies to both configurations.

cultureCode
string

Specifies in which language to display culture specific information. If none is supplied, value is resolved from Application.

Request Body schema:

General: 'test'=true to enable tests. When 'test' is used no payments will be processed for real. Payments may interpret supplied values such as cardNumber or ssn to simulate failures. Not implemented. Klarna: 'sessionId'=id. Used to provide a sessionId to Klarna payments. Not implemented. Payex and Dibs. Supported values are 'returnUrl' and 'cancelUrl'. Values should point to where the payment service should go in case of success/failure.

Array
Name
string

The Name of the Entity. MaxLength: 50.

Value
string

The Value of the Entity. MaxLength: max.

Responses
200

Success

400

Bad Request

Key: BasketItemNotBuyable. Gets raised when the basket item is not buyable or when it is inactive.

Key: BuyerMissing. Gets raised when the buyer is missing.

Key: CannotCreatOrderOnBasket. Gets raised if the basket is not buyable and not already paid for.

Key: DeliveryAddressMissing. Gets raised when the delivery address does not exist.

Key: DiscountCodeAlreadyUsed. Gets raised when the discount code is already used.

Key: InvalidCompanyOnBasket. Gets raised when the basket has an invalid company. The customer does not exist in this company.

Key: InvoiceAddressMissing. Gets raised when the invoice address does not exist.

Key: NoDeliveryMethodSelected. Gets raised when there are no delivery method selected.

Key: NoPaymentMethodSelected. Gets raised when there are no payment method selected.

Key: PaymentFailed. Gets raised when the payment fails.

Key: PromotionInvalid. Gets raised when the promotion is invalid.

Key: QuotationMissing. Gets raised when the basket is missing.

Key: SubscriptionMissing. Gets raised when the recurring order is invalid.

Key: BasketContainsSomeUnbuyableItems. Gets raised when the basket has some unbuyable items.

Key: BasketContainsNoBuyableItems. Gets raised when the basket does not have any buyable items.

500

Internal Server Error

post/ShoppingService.svc/rest/PurchaseSubscription
Request samples
[
  • {
    }
]
Response samples
{
  • "Status": "string",
  • "StatusDescription": "string",
  • "BasketId": 0,
  • "OrderNo": "string",
  • "PaymentCode": "string",
  • "PaymentReference": "string",
  • "HostedPaymentPage": "string",
  • "RedirectUrl": "string",
  • "RedirectParameters": [
    ],
  • "IsSyncronous": true,
  • "PaymentServiceId": 0
}