Skip to content

Create gift order

/accounts/create_gift_order

Target audience: Developers

Release version: 4.7.5

Create order

Introduction

This endpoint is used to create a gift order.

Attention

As for now this endpoint only supports creating gift orders with the payment methods invoice and free.

Attention

As for now this endpoint can only be used for creating gift orders on campaigns that are configured to be sold as gifts using the campaign gift rules.

URI

Environment URI
Stage https://payway-api.stage.adeprimo.se/external/api/v3/accounts/create_gift_order
Production https://backend.worldoftulo.com/external/api/v3/accounts/create_gift_order

Requirements

Identity Scope
No /external/account/w

Parameters

Field Required Type Description
giver_account_id Optional String The id of the account to place the order on, it is the account paying for the gifted subscription.
Size range: ..24
Allowed values: "/^[a-f\d]{24}$/i"
giver_email Optional String The email of the account to place the order on, it is the account paying for the gifted subscription.
Size range: ..1024
Allowed values:
"/\A[\w+-.]+@[a-z\d-]+(.[a-z]+)*.[a-z]+\z/i"
product_code Required String The product code for a package/campaign.
period_id Required String The unique id of the period that should be used for this order. Note that the supplied period id determines the payment method.
Size range: ..24
Allowed values: "/^[a-f\d]{24}$/i"
start_date Optional DateTime The start date of the subscription in UTC, will default to DateTime.now
gift_delivery_address Required Object Address object
traffic_source Optional String The traffic source for the order
merchant_reference Optional String The merchant reference for the order
secure_identification Optional Object The object containing information about the secure identification of a user
trusted_identity_id
Required String The ID of the trusted identity.
Size range: ..24
Allowed values: "/^[a-f\d]{24}$/i"
client_info Optional Object Information about the client, such as browser or device information.
user_agent
Required String User agent. E.g. Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
language
Required String Client langague. E.g. sv-SE
ip_address
Required String Client ip address. E.g. 111.111.1.11

Curl Example with giver_account_id

curl --request POST \
  --url https://payway-api.stage.adeprimo.se/external/api/v3/accounts/create_gift_order \
  --header 'accept: application/json' \
  --header 'authorization: Bearer <token-without-identity>' \
  --header 'content-type: application/json' \
  --data '{
              "giver_account_id": "5c6291d537c2ed78a11518b7",
              "product_code": "adeprimo_digital",
              "period_id": "5cb804811d41c82b5c518ea8",
              "start_date": "2019-05-01T00:00:00+00:00",
              "gift_delivery_address": {
                "first_name": "John",
                "last_name": "Doe",
                "street": "Sunset Boulevard",
                "street_number": "2",
                "city": "California",
                "zip_code": "65100",
                "country_code": "SE",
                "mobile_number": "0501231234"
              }
          }'

Response

Field Description
id id of the order
order_id order_id of the order
payment_id id of the payment
HTTP 201 Created
{
    "id": "ADEPRIMO-1234",
    "order_id": "ADEPRIMO-1234",
    "payment_id": "AAABBBCCDD11223344"
}

Errors

This API uses the common error conventions of the Payway API

See common error responses