/initialize_purchase

/adyen/initialize_purchase

Target audience: Developers

1
Release version: 4.2.0

Introduction

This endpoint initializes an Adyen purchase session. This is required when integrating with the redirect flow.

Attention

This API gives access to Adyen related endpoints. Since this section is quite specific it has it's own section of documentation. See here for more information.

URI

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

Requirements

Identity Scope
Yes /external/adyen/w

Curl example

 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
curl --request POST \
  --url https://payway-api.stage.adeprimo.se/external/api/v1/adyen/initialize_purchase \
  --header 'authorization: Bearer <token-with-identity>' \
  --header 'content-type: application/json' \
  --data '{
    "period_id": "5e4bfdf209c04c50ab62669d",
    "product_code": "adeprimo_digital",
    "description": "Buy Adeprimo Digital",
    "complete_url": "https://example.com/success",
    "error_url": "https://example.com/error",
    "cancel_url": "https://example.com/cancel",
    "traffic_source": "facebook",
    "subscription_start_date": "2015-05-15",
    "discount_code": "code",
    "origin": "https://purchase.example.com",
    "delivery_address": {
      "first_name": "Donald",
      "last_name": "Duck",
      "street": "Webfoot Walk",
      "street_number": "1313",
      "zip_code": "83145",
      "city": "Ankeborg",
      "country_code": "SE"
    }
  }'

Parameters

Parameter Description Required Format Type
period_id Id of the selected payment period Yes Size range ..24
Allowed values: "/^[a-f\d]{24}$/i"
String
product_code The product code for a package/campaign. Yes Size range: 1..50 Allowed values: "/^[a-zA-Z-_0-9]+$/" String
description The description presented during the purchase Yes Size range: 1..1024 Allowed values: "/^[a-zA-Z-_0-9]+$/" String
complete_url Callback url for successful purchase Yes Size range: ..1024 Allowed values: uri regex that is too long to show here. Must be absolute String
error_url Callback url for failed purchase Yes Size range: ..1024 Allowed values: uri regex that is too long to show here. Must be absolute String
cancel_url Callback url for cancelled purchase Yes Size range: ..1024 Allowed values: uri regex that is too long to show here. Must be absolute String
traffic_source The source of the purchase. E.g. facebook, web. Traffic sources need to be setup in PAP Optional Size range: ..100 String
origin URI where purchase is performed (E.g. https://purchase.example.org) Yes Size range: ..1024 Allowed values: uri regex that is too long to show here. Must be absolute String
subscription_start_date Date when the subscription will be activated. Feature needs to be enabled Optional Allowed values: 2020-05-15 DateTime
discount_code Discounted price. Code needs to be defined in PAP Optional Size range: 1..100 String
delivery_address Address object. Fields marked as required is always required in order to update any field of the address. Optional Object
first_name
First name Required String
last_name
Last name Required String
street
Streetname Required String
street_number
The street number, some subscription-systems only allow numerical values Optional String
zip_code
The zipcode Required String
floor
The floor Optional String
apartment_number
The apartment number Optional String
entrance
The entrance Optional String
city
The city Required String
dropbox
Dropbox Optional String
country_code
Country code Required SE, FI or AX String
Response
1
2
3
4
HTTP 201 Created
{
  "id": "5e4becc109c04c404a46c744"
}

Errors

The error response is sent as application/JSON and will have an HTTP status code ranging between 400-500.

An error message will contain these properties in every response.

Error example

1
2
3
4
5
{
  "code": "error_code",
  "field": "field",
  "message": "error message"
}