Skip to content

Share subscription

/me/share_subscription

Target audience: Developers

Share subscription

Introduction

This endpoint is used for sharing a subscription to one or many. It will create the shared subscription, set it to pending and send an invitation mail to the receivers on success.

URI

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

Requirements

Identity Scope
Yes /external/me/w

Parameters

Field Required Type Description
user_product_id Required String The id of the user product.
Size range ..24
Allowed values: "/^[a-f\d]{24}$/i"
contact_emails Required Array Can have one or multiple e-mail addresses.
Size range: ..1024
automatically_accept_sharing Optional Boolean Decides whether the created package sharing(s) should be automatically accepted and started, if the receiver already has a Payway account. Will default to false.

Curl Example

curl --request POST \
  --url https://payway-api.stage.adeprimo.se/external/api/v1/me/share_subscription \
  --header 'accept: application/json' \
  --header 'authorization: Bearer token' \
  --header 'content-type: application/json' \
  --data '{
            "user_product_id": "585a4768edce2c5e6f000001",
            "contact_emails": ["receiver1@account.com", "receiver2@account.com", "receiver3@account.com"]
          }'

Response

Field Description
sharing_id The id of the sharing
receiver_email Email of the receiver

Example Response

HTTP 200
{
    "items": [
        {
            "sharing_id": "5c49688037c2edb450fc4dae",
            "receiver_email": "receiver1@account.com"
        },
        {
            "sharing_id": "5c49688037c2edb450fc4db0",
            "receiver_email": "receiver2@account.com"
        },
        {
            "sharing_id": "5c49688037c2edb450fc4dbc9",
            "receiver_email": "receiver3@account.com"
        }
    ]
}

Errors

Example error response

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
too_many_shares Object The sharing limit has exceeded

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