Update

/prices

Target audience: Developers

Introduction

This endpoint lets you update price on periods for packages and campaigns.

URI

Environment URI
Stage https://payway-api.stage.adeprimo.se/external/api/v1/prices
Production https://backend.worldoftulo.com/external/api/v1/prices

Requirements

Identity Scope
No /external/price/w

Parameters

Field Required Type Description
package_integration_code Required String The package to be updated is resolved based on it's integration code. Size range ..50
price_periods Required Object[] Decides how the price periods will be updated. There can only be one period per payment option. If the period does not exist it will be created.
subscription_type
Required String Allowed values: recurring, limited
payment_option
Required String Allowed values: adyen, creditcard, sms, directdebit, free, invoice
payment_option_details
Optional Object Defines the payment method type and name for an Adyen payment. This is required if payment_option is adyen.
type
Required String Adyen payment method type. E.g.: scheme
name
Required String Adyen payment method name. E.g.: Card
type
Required String Allowed values: day, week, month, year
length
Required Integer Together with type it decides the total length of one iteration. E.g. 2 months
monthly_payments
Required / Optional Boolean Required if campaign. Defines whether or not a campaign has monthly payments. Allowed values: true, false.
price
Required Float The price of one iteration
details
Optional Object Defines the "complex pricemodel" for this period, should only be used if organisation utilizes the "complex pricemodel" in Payway
name
Required String Name of detail
price
Required Float The price of this detail
vat_code
Required Integer The vatcode of this detail

Curl Example

Update price period for package with adyen as payment_option

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
curl --request POST \
  --url https://payway-api.stage.adeprimo.se/external/api/v1/campaigns \
  --header 'accept: application/json' \
  --header 'authorization: Bearer token' \
  --header 'content-type: application/json' \
  --data '{
            "package_integration_code": "adeprimo_digital",
            "price_periods": [
              {
                "subscription_type": "recurring",
                "payment_option": "adyen",
                "payment_option_details": 
                    {
                        "type": "scheme",
                        "name": "Card"
                    },
                "type": "month",
                "length": 1,
                "price": 44.9
              }
            ]
          }'

Update price period for campaign with adyen as payment_option

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
curl --request POST \
  --url https://payway-api.stage.adeprimo.se/external/api/v1/campaigns \
  --header 'accept: application/json' \
  --header 'authorization: Bearer token' \
  --header 'content-type: application/json' \
  --data '{
            "package_integration_code": "adeprimo_digital_campaign",
            "price_periods": [
              {
                "subscription_type": "recurring",
                "payment_option": "adyen",
                "payment_option_details": 
                    {
                        "type": "scheme",
                        "name": "Card"
                    },
                "monthly_payments": true,
                "type": "month",
                "length": 1,
                "price": 44.9
              }
            ]
          }'

Update package with complex price model

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
curl --request POST \
  --url https://payway-api.stage.adeprimo.se/external/api/v1/campaigns \
  --header 'accept: application/json' \
  --header 'authorization: Bearer token' \
  --header 'content-type: application/json' \
  --data '{
            "package_integration_code": "adeprimo_digital_package",
            "price_periods": [
              {
                "subscription_type": "recurring",
                "payment_option": "creditcard",
                "type": "month",
                "length": 1,
                "details": [
                  {
                    "name": "Digital",
                    "price": "10",
                    "vat_code": 24
                  },
                  {
                    "name": "Paper",
                    "price": "34.9",
                    "vat_code": 10
                  }
                ]
              }
            ]
          }'

Response

Field Description
id id of the updated package

Example Response: Successfully updated price periods

1
2
3
4
HTTP 200
{
    "id": "50f3ac249f6aef294d000007"
}

Errors

Example error response

1
2
3
4
5
6
HTTP 400 Bad Request
{
    "code": "invalid_parameter",
    "field": "account_id",
    "message": "Parameter must match format (/^[a-f\d]{24}$/)"
}

HTTP 400 Bad Request

Name Type Description
invalid_parameter Object Validation error on any of the fields in the posted json
json_parser_error Object The request body could not be parsed as valid json
invalid_content_type_error Object The requests Content-Type header isn't set to application/json
unknown_parameter Object One or more of the fields in the posted json was not recognized

HTTP 404 Not Found

Name Type Description
not_found Object The package could not be found

HTTP 500 Internal Server Error

Name Type Description
internal_server_error Object Something unexpected happened server side