Skip to content

Me - Initialize purchase

/v2/adyen/me/initialize_purchase

Target audience: Developers

Initialize purchase

Release version: 4.7.5

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/v2/adyen/me/initialize_purchase
Production https://backend.worldoftulo.com/external/api/v2/adyen/me/initialize_purchase

Requirements

Identity Scope
Yes /external/adyen/w

Curl example

curl --request POST \
  --url https://payway-api.stage.adeprimo.se/external/api/v2/adyen/me/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"
  }'

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: ..128 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 Optional Object
Response
HTTP 201 Created
{
  "id": "5e4becc109c04c404a46c744"
}

Errors

This API uses the common error conventions of the Payway API

See common error responses