Skip to content

Initialize purchase

/adyen/initialize_purchase

Target audience: Developers

Release version: 4.2.0

Initialize purchase

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

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",
    "merchant_reference": "adeprimo-campaign-001",
    "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
origin URI where purchase is performed (E.g. https://buy.example.org) 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
merchant_reference An optional customer reference, can be a code or an url. Optional Size range: ..1024 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
staircase
The staircase Optional String
city
The city Required String
dropbox
Dropbox Optional String
country_code
Country code Required SE, FI or AX String
Response
HTTP 201 Created
{
  "id": "5e4becc109c04c404a46c744"
}

Errors

This API uses the common error conventions of the Payway API

See common error responses