### Install Dintero Checkout Web SDK with npm Source: https://docs.dintero.com/docs/checkout/sdk/checkout-web-sdk This command installs the Dintero Checkout Web SDK using npm. Ensure you have Node.js and npm installed on your system. ```bash npm install @dintero/checkout-web-sdk ``` -------------------------------- ### Install Dintero Python SDK Source: https://docs.dintero.com/docs/checkout/sdk/python-sdk This command installs or upgrades the Dintero Python SDK using pip. Ensure you have pip installed and configured correctly to manage Python packages. ```bash pip install --upgrade dintero ``` -------------------------------- ### Install Dintero Discount SDK using npm Source: https://docs.dintero.com/docs/checkout/sdk/discount-sdk This command installs the Dintero Discount SDK for web applications. It is a prerequisite for using the SDK's functionalities in your frontend project. ```bash npm install @dintero/discounts-web-sdk ``` -------------------------------- ### Install Dintero Node SDK Source: https://docs.dintero.com/docs/checkout/sdk/node-sdk Installs the Dintero Node.js SDK using npm or yarn. This is the first step to integrating Dintero's API into your server-side Javascript application. ```bash npm install @dintero/node-sdk ``` ```bash yarn add @dintero/node-sdk ``` -------------------------------- ### Get Access Token and Create Session with cURL Source: https://docs.dintero.com/docs/checkout-orders This example demonstrates how to obtain an access token using cURL by sending a POST request to the authentication endpoint with client credentials. It then shows how to create a checkout session using another cURL command, including the obtained token in the Authorization header. ```curl # Get access token curl 'https://api.dintero.com/v1/accounts/P11223351/auth/token' \ -H'Content-Type: application/json' \ --user client_id:client_secret -d'{ "audience": "https://api.dintero.com/v1/accounts/P11223351", "grant_type": "client_credentials" }' // Create session curl 'https://checkout.dintero.com/v1/sessions-profile' \ -H'Content-Type: application/json' \ -H'Authorization: Bearer token' -d 'json-body-from-above' ``` -------------------------------- ### Dintero Session Creation Configuration Details Source: https://docs.dintero.com/docs/checkout/checkout-client Key details for configuring sessions in Dintero, emphasizing the use of checkout profiles and the structure of order items. Each item requires a unique `line_id` and `vat` percentage, with amounts calculated as `amount_without_vat + vat_amount`. ```json { "order": { "items": [ { "line_id": "unique_line_identifier", "vat": "percentage_of_vat", "amount_without_vat": "amount_before_vat", "vat_amount": "vat_amount_value" } ] } } ``` -------------------------------- ### Dintero API Authentication (Python) Source: https://docs.dintero.com/docs/checkout/authentication This Python example uses the 'requests' library to authenticate with the Dintero API. It demonstrates how to set up basic authentication and send the POST request with the required payload to get an access token. ```python import requests import json def fetch_access_token(account_id, client_id, client_secret): url = f"https://api.dintero.com/v1/accounts/{account_id}/auth/token" payload = { "grant_type": "client_credentials", "audience": f"https://api.dintero.com/v1/accounts/{account_id}", } response = requests.post( url, auth=requests.auth.HTTPBasicAuth( client_id, client_secret ), headers={ "Content-Type": "application/json", }, data=json.dumps(payload), ) assert response.status_code == 200 auth_token_response = response.json() access_token = auth_token_response["access_token"] return access_token access_token = fetchAccessToken("T12345678", "your_client_id", "your_client_secret") ``` -------------------------------- ### Session Management API Source: https://docs.dintero.com/docs/checkout/checkout-client Handles the creation of payment sessions and manages callbacks/redirects. ```APIDOC ## POST /v1/sessions-profile ### Description Creates a new payment session. This endpoint also handles callbacks and redirects for payment processing. ### Method POST ### Endpoint `/v1/sessions-profile` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **order** (object) - Required - Details of the order. - **items** (array) - Required - List of items in the order. Each item must have a unique `line_id` and `vat` percentage. - **line_id** (string) - Required - Unique identifier for the item line. - **vat** (number) - Required - The VAT percentage for the item. - **amount_without_vat** (number) - Required - The price of the item excluding VAT. - **vat_amount** (number) - Required - The amount of VAT for the item. - **amount** (number) - Required - The total price of the item including VAT (`amount_without_vat + vat_amount`). - **amount** (number) - Required - The total amount of the order. - **currency** (string) - Required - The currency of the order (e.g., "SEK"). - **payment_method** (string) - Optional - Preferred payment method. - **customer** (object) - Optional - Customer details. - **merchant_urls** (object) - Optional - URLs for callbacks and redirects. - **callback_url** (string) - The URL to receive payment callbacks. - **return_url** (string) - The URL to redirect the customer to after payment. ### Request Example ```json { "order": { "items": [ { "line_id": "item1", "vat": 25, "amount_without_vat": 80, "vat_amount": 20, "amount": 100 } ], "amount": 100, "currency": "SEK" }, "merchant_urls": { "callback_url": "https://your.domain.com/callback", "return_url": "https://your.domain.com/return" } } ``` ### Response #### Success Response (200) - **session_id** (string) - The unique identifier for the created session. - **url** (object) - URLs related to the session. - **callback_url** (string) - The callback URL for the session. - **return_url** (string) - The return URL for the session. #### Response Example ```json { "session_id": "sess_abcdef123456", "url": { "callback_url": "https://api.dintero.com/v1/sessions/sess_abcdef123456/callback", "return_url": "https://checkout.dintero.com/sess_abcdef123456" } } ``` ``` -------------------------------- ### Example: Discount Metadata Per Item in Dintero Session Source: https://docs.dintero.com/docs/checkout/discount-metadata This JSON example demonstrates how to include discount metadata for individual items within a Dintero session. It shows the structure for `discount_lines` at the item level, including amount, line ID, description, and discount type. This helps signal discounts applied to specific products. ```json { "amount": 20000, "items": [ { "id": "item-1", "vat": 25, "amount": 10000, "line_id": "1", "quantity": 1, "description": "Item 1", "discount_lines": [ { "amount": 2000, "line_id": 1, "description": "Manually added 20 kroner off. // Original price 12000", "discount_id": "manual-20-kroner-off", "discount_type": "manual" } ] }, { "id": "item-2", "vat": 25, "amount": 10000, "line_id": "2", "quantity": 2, "description": "Item 2", "discount_lines": [ { "amount": 2500, "line_id": 1, "percentage": 20, "description": "New customer 20% on item 2. // Original price 12500", "discount_id": "new-customer-20-item-2", "discount_type": "customer" } ] } ] } ``` -------------------------------- ### Authentication API Source: https://docs.dintero.com/docs/checkout/checkout-client Authenticates a user and retrieves an access token. ```APIDOC ## POST /v1/accounts/{oid}/auth/token ### Description Authenticates a user by providing their credentials and returns an access token for subsequent API requests. ### Method POST ### Endpoint `/v1/accounts/{oid}/auth/token` ### Parameters #### Path Parameters - **oid** (string) - Required - The unique identifier of the account. #### Query Parameters None #### Request Body - **username** (string) - Required - The username for authentication. - **password** (string) - Required - The password for authentication. ### Request Example ```json { "username": "your_username", "password": "your_password" } ``` ### Response #### Success Response (200) - **access_token** (string) - The authentication token. - **token_type** (string) - The type of token (e.g., Bearer). - **expires_in** (integer) - The token's expiration time in seconds. #### Response Example ```json { "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "token_type": "Bearer", "expires_in": 3600 } ``` ``` -------------------------------- ### Google Pay Tokenization Specification Source: https://docs.dintero.com/docs/checkout/google-pay/google-pay-native-app Code example for setting up the Google Pay tokenization specification, including gateway information. ```APIDOC ## Google Pay Tokenization Specification ### Description This code snippet demonstrates how to configure the `gatewayTokenizationSpecification` for Google Pay, ensuring Dintero is used as the payment gateway. ### Method N/A (Client-side configuration) ### Endpoint N/A ### Parameters N/A ### Request Example ```java private fun gatewayTokenizationSpecification(): JSONObject { return JSONObject().apply { put("type", "PAYMENT_GATEWAY") put("parameters", JSONObject(mapOf( "gateway" to "dintero", "gatewayMerchantId" to "YOUR_DINTERO_ACCOUNT_ID"))) } } ``` ### Response #### Success Response (N/A) N/A #### Response Example N/A **Note**: Replace `YOUR_DINTERO_ACCOUNT_ID` with your actual Dintero account ID. This ID can be found in Backoffice and should be prefixed with 'P' for production or 'T' for testing. ``` -------------------------------- ### Shipping Address Callback Example (JSON) Source: https://docs.dintero.com/docs/checkout/shipping-address-callback An example of a 'correction' item that might be added to an order, potentially causing issues with the shipping address callback if not handled correctly. This structure illustrates how such items are represented in JSON format. ```json { "id": "correction-mc7nt6LjqgCejGGLNHpFMq", "amount": -10000, "line_id": "correction-mc7nt6LjqgCejGGLNHpFMq", "quantity": 1, "description": "Correction" } ``` -------------------------------- ### Dintero App-Switched Return URL Example Source: https://docs.dintero.com/docs/checkout/payment-in-app This example illustrates a URL that a merchant's application might receive after a user completes or cancels a payment via Dintero's in-app functionality. It includes essential parameters like `transaction_id`, `merchant_reference`, and `session_id`, which are appended to the configured `return_url`. ```url merchantApp://result?myAppData&transaction_id=T12345678.abc&merchant_reference=mref123&session_id=T12345678.abd ``` -------------------------------- ### POST /v1/sessions-profile Source: https://docs.dintero.com/docs/checkout/pay-in-store Creates a payment session with the option to enable pay-in-store functionality. This endpoint allows for detailed order and configuration settings. ```APIDOC ## POST /v1/sessions-profile ### Description Creates a payment session with pay-in-store enabled. This endpoint allows for detailed configuration of the payment session, including order details, callback URLs, and shipping options. ### Method POST ### Endpoint https://checkout.dintero.com/v1/sessions-profile ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **url** (object) - Required - URL configuration for the payment session. - **return_url** (string) - Required - The URL where the customer is redirected after a successful payment. - **callback_url** (string) - Required - The URL where Dintero sends payment status updates. - **merchant_terms_url** (string) - Required - URL to the merchant's terms and conditions. - **order** (object) - Required - Details about the order. - **amount** (integer) - Required - The total amount of the order in the smallest currency unit (e.g., cents). - **currency** (string) - Required - The currency code for the order (e.g., "NOK"). - **items** (array) - Required - A list of items in the order. - **id** (string) - Required - Unique identifier for the item. - **name** (string) - Required - Name of the item. - **quantity** (integer) - Required - Quantity of the item. - **unit_price** (integer) - Required - Price of a single unit of the item. - **merchant_reference** (string) - Required - Merchant's unique reference for the order. - **profile_id** (string) - Required - The Dintero profile ID to use for the session. - **configuration** (object) - Optional - Configuration for payment types. - **active_payment_types** (object) - Optional - Settings for active payment types. - **enabled** (boolean) - Optional - Enables or disables active payment types. - **dintero** (object) - Optional - Specific Dintero configurations. - **type** (string) - Optional - The type of Dintero configuration. - **zero** (object) - Optional - Zero configuration. - **type** (string) - Optional - The type of zero payment product. - **enabled** (boolean) - Optional - Enables or disables zero payment product. - **payability** (string) - Optional - Payability setting for zero payment product (e.g., "payable"). - **express** (object) - Optional - Express checkout and shipping options. - **shipping_options** (array) - Optional - List of available shipping options. - **id** (string) - Required - Unique identifier for the shipping option. - **vat** (integer) - Required - VAT amount for the shipping option. - **title** (string) - Required - Title of the shipping option. - **amount** (integer) - Required - Amount for the shipping option. - **line_id** (string) - Required - Line ID for the shipping option. - **operator** (string) - Required - Operator for the shipping option. - **vat_amount** (integer) - Required - VAT amount for the shipping option. - **delivery_method** (string) - Required - Method of delivery (e.g., "pick_up"). - **pick_up_address** (object) - Required if delivery_method is "pick_up" - Address details for pick-up. - **country** (string) - Required - Country code. - **first_name** (string) - Required - First name. - **postal_code** (string) - Required - Postal code. - **address_line** (string) - Required - Street address. - **postal_place** (string) - Required - City or postal place. - **phone_number** (string) - Required - Phone number. - **pay_in_store** (object) - Optional - Settings for pay-in-store. - **type** (string) - Optional - Type of pay-in-store (e.g., "full"). - **merchant** (object) - Optional - Merchant details. - **name** (string) - Optional - Name of the merchant. - **logo_url** (string) - Optional - URL to the merchant's logo. ### Request Example ```json { "url": { "return_url": "https://example.com/accept", "callback_url": "https://example.com/callback?method=GET", "merchant_terms_url": "https://example.com/terms.html" }, "order": { "amount": 10000, "currency": "NOK", "items": [ { "id": "123", "name": "Product 1", "quantity": 1, "unit_price": 10000 } ], "merchant_reference": "string" }, "profile_id": "", "configuration": { "active_payment_types": { "enabled": true }, "dintero": { "type": "payment_type", "zero": { "type": "payment_product_type", "enabled": true, "payability": "payable" } } }, "express": { "shipping_options": [ { "id": "StoreName.1234", "vat": 0, "title": "Pay now and pick up in store", "amount": 0, "line_id": "StoreName.1234_1_pickup", "operator": "StoreName", "vat_amount": 0, "delivery_method": "pick_up", "pick_up_address": { "country": "NO", "first_name": "StoreName", "postal_code": "0000", "address_line": "Address 1", "postal_place": "OSLO", "phone_number": "12345678" } }, { "id": "StoreName.1234", "vat": 0, "title": "Order and pay in store", "amount": 0, "line_id": "StoreName.1234_1", "operator": "StoreName", "vat_amount": 0, "delivery_method": "pick_up", "pick_up_address": { "country": "NO", "first_name": "StoreName", "postal_code": "0000", "address_line": "Address 1", "postal_place": "OSLO", "phone_number": "12345678" }, "pay_in_store": { "type": "full" } } ] }, "profile_id": "default", "merchant": { "name": "string", "logo_url": "http://example.com" } } ``` ### Response #### Success Response (200) - **session_id** (string) - Unique identifier for the created payment session. - **payment_url** (string) - The URL where the customer can complete the payment. #### Response Example ```json { "session_id": "sess_abc123def456", "payment_url": "https://checkout.dintero.com/pay/sess_abc123def456" } ``` #### Error Response (4xx/5xx) - **error** (object) - Contains error details. - **code** (string) - Error code. - **message** (string) - Error message. #### Error Response Example ```json { "error": { "code": "invalid_request", "message": "Required field missing: return_url" } } ``` ``` -------------------------------- ### Dintero API: Create Payment Session with Pay in Store Source: https://docs.dintero.com/docs/checkout/pay-in-store This snippet shows an example HTTP POST request to the Dintero checkout API to create a payment session. It includes essential headers like Authorization and Content-Type, and a detailed JSON body specifying order details, profile, configuration for 'pay in store', and shipping options. ```http POST https://checkout.dintero.com/v1/sessions-profile Authorization: Bearer Content-Type: application/json { "url": { "return_url": "https://example.com/accept", "callback_url": "https://example.com/callback?method=GET", "merchant_terms_url": "https://example.com/terms.html" }, "order": { "amount": 10000, "currency": "NOK", "items": [ { "id": "123", "name": "Product 1", "quantity": 1, "unit_price": 10000 } ], "merchant_reference": "string" }, "profile_id": "", "configuration": { "active_payment_types": { "enabled": true }, "dintero": { "type": "payment_type", "zero": { "type": "payment_product_type", "enabled": true, "payability": "payable" } }, }, "express": { "shipping_options": [ { "id": "StoreName.1234", "vat": 0, "title": "Pay now and pick up in store", "amount": 0, "line_id": "StoreName.1234_1_pickup", "operator": "StoreName", "vat_amount": 0, "delivery_method": "pick_up", "pick_up_address": { "country": "NO", "first_name": "StoreName", "postal_code": "0000", "address_line": "Address 1", "postal_place": "OSLO", "phone_number": "12345678" } }, { "id": "StoreName.1234", "vat": 0, "title": "Order and pay in store", "amount": 0, "line_id": "StoreName.1234_1", "operator": "StoreName", "vat_amount": 0, "delivery_method": "pick_up", "pick_up_address": { "country": "NO", "first_name": "StoreName", "postal_code": "0000", "address_line": "Address 1", "postal_place": "OSLO", "phone_number": "12345678" }, "pay_in_store": { "type": "full" } } ] }, "profile_id": "default", "merchant": { "name": "string", "logo_url": "http://example.com" } } ``` -------------------------------- ### Create Checkout Session Source: https://docs.dintero.com/docs/checkout-orders Generates a checkout session for an order, providing payment and callback URLs. ```APIDOC ## POST /v1/sessions-profile ### Description Creates a checkout session that can be used to process payments for an order. Use the completed `order_id` as `merchant_reference`. ### Method POST ### Endpoint /v1/sessions-profile ### Parameters #### Request Body - **url** (object) - Required - URLs for redirecting the user. - **return_url** (string) - Required - The URL the user is returned to after payment. - **callback_url** (string) - Required - The URL Dintero will send payment status updates to. - **order** (object) - Required - Details of the order. - **amount** (integer) - Required - The total amount of the order in the smallest currency unit. - **currency** (string) - Required - The currency code (e.g., "NOK"). - **merchant_reference** (string) - Required - Your reference to the order (typically the `order_id`). - **items** (array) - Required - A list of items in the order. - **id** (string) - Required - The item's unique identifier. - **line_id** (string) - Required - The line item identifier. - **description** (string) - Required - A description of the item. - **quantity** (integer) - Required - The number of units for the item. - **amount** (integer) - Required - The amount for the item (pre-tax). - **vat_amount** (integer) - Required - The amount of VAT for the item. - **vat** (integer) - Required - The VAT percentage. - **profile_id** (string) - Required - The profile ID to use for the checkout session. This can be found in the Backoffice. ### Request Example ```json { "url": { "return_url": "https://example.com/accept", "callback_url": "https://example.com/callback" }, "order": { "amount": 39800, "currency": "NOK", "merchant_reference": "order_id", "items": [ { "id": "175938", "line_id": "1", "description": "Stablestol for utendørsbruk", "quantity": 2, "amount": 39800, "vat_amount": 7960, "vat": 25 } ] }, "profile_id": "default_profile" } ``` ### Response #### Success Response (200) - **session_id** (string) - The unique ID for the checkout session. - **redirect_url** (string) - The URL to redirect the user to for payment. #### Response Example ```json { "session_id": "sess_abcdef123456", "redirect_url": "https://checkout.dintero.com/pay/sess_abcdef123456" } ``` ``` -------------------------------- ### Dintero API Optional Tracking Headers Source: https://docs.dintero.com/docs/checkout/checkout-client Information on integrating optional headers with the Dintero API to improve tracking capabilities. These headers can provide additional context for transaction monitoring and analysis. ```http Optional: Integrate headers for better tracking. ``` -------------------------------- ### Dintero Token Creation Response Source: https://docs.dintero.com/docs/checkout/tokenization-create-token This is an example of the response received after successfully creating a token session with Dintero. It contains the token ID and a URL to redirect the customer for card confirmation. ```json { "id": "T11223445.5cyWnV68vzJ1kYjZPrKWWm", "url": "https://checkout.test.dintero.com/v1/view/T11223445.5cyWnV68vzJ1kYjZPrKWWm" } ``` -------------------------------- ### Create Draft Order Source: https://docs.dintero.com/docs/checkout-orders Initiates a new order that can be completed later. Requires account ID. ```APIDOC ## POST /v1/accounts/{aid}/shopping/draft_orders ### Description Creates a draft order which can then be completed. ### Method POST ### Endpoint /v1/accounts/{aid}/shopping/draft_orders ### Parameters #### Path Parameters - **aid** (string) - Required - The account ID. #### Request Body - **options** (object) - Optional - Options for order creation. - **generate_order_id** (string) - Optional - Specifies the format for generating an order ID (e.g., "ALPHANUMERIC_9"). - **order** (object) - Required - Details of the order. - **currency** (string) - Required - The currency code for the order (e.g., "NOK"). - **items** (array) - Required - A list of items in the order. - **id** (string) - Required - The item's unique identifier. - **line_id** (integer) - Required - The line item identifier. - **quantity** (integer) - Required - The number of units for the item. - **gross_amount** (integer) - Required - The gross amount for the item in the smallest currency unit (e.g., cents). - **tax_lines** (array) - Required - Details of taxes applied to the item. - **amount** (integer) - Required - The tax amount. - **percentage** (integer) - Required - The tax percentage. - **description** (string) - Required - A description of the item. - **description_alias** (string) - Optional - An alias for the item description. ### Request Example ```json { "options": { "generate_order_id": "ALPHANUMERIC_9" }, "order": { "currency": "NOK", "items": [ { "id": "175938", "line_id": 1, "quantity": 2, "gross_amount": 39800, "tax_lines": [ { "amount": 7960, "percentage": 25 } ], "description": "Stablestol for utendørsbruk", "description_alias": "Stablestol" } ] } } ``` ### Response #### Success Response (200) - **order_id** (string) - The ID of the created draft order. - **order_revision** (integer) - The revision number of the order. #### Response Example ```json { "order_id": "ORD-123456789", "order_revision": 1 } ``` ``` -------------------------------- ### Shipping Options Configuration Source: https://docs.dintero.com/docs/checkout/checkout-express-shipping-options This section details the structure for defining shipping options, including mandatory and optional fields for a comprehensive shipping setup. ```APIDOC ## Shipping Options API ### Description This API allows merchants to list multiple shipping options for customers to choose from during checkout. Each shipping option can be configured with various details to provide a flexible and informative selection process. ### Method POST (Implicit, as this describes data structure for submission) ### Endpoint /websites/dintero/shipping-options ### Parameters #### Request Body - **id** (string) - Required - ID of the shipping option product. - **line_id** (string) - Required - Unique ID of the specific configuration of the shipping option product. - **amount** (integer) - Required - Monetary amount of the shipping option, including VAT and discounts in the smallest unit of the session currency. - **operator** (string) - Required - Name of the company that provides shipping service. - **title** (string) - Required - The title of the shipping option (e.g., "Standard home delivery"). - **countries** (array[string]) - Optional - An array of country codes (ISO 3166-1 alpha-2) to restrict the availability of this shipping option. - **vat_amount** (integer) - Optional - The amount of VAT for the shipping option. - **vat** (number) - Optional - The VAT percentage for the shipping option. - **description** (string) - Optional - A detailed description of the shipping option. - **delivery_method** (string) - Optional - The type of delivery method (e.g., "delivery", "pick_up", "unspecified", "none"). - **operator_product_id** (string) - Optional - The unique identifier for the shipping product from the operator. - **eta** (object) - Optional - Estimated Time of Arrival details. - **working_days** (array[integer]) - Optional - Array representing the working days (1=Monday, 7=Sunday). - **time_slot** (object) - Optional - Specifies the available time window for delivery. - **starts_at** (string) - Optional - ISO 8601 format start time. - **ends_at** (string) - Optional - ISO 8601 format end time. - **pick_up_address** (object) - Optional - Details of the pick-up location if `delivery_method` is "pick_up". - **first_name** (string) - Optional - **last_name** (string) - Optional - **address_line** (string) - Optional - **address_line_2** (string) - Optional - **co_address** (string) - Optional - **business_name** (string) - Optional - **postal_code** (string) - Optional - **postal_place** (string) - Optional - **country** (string) - Optional - **phone_number** (string) - Optional - **email** (string) - Optional - **latitude** (number) - Optional - **longitude** (number) - Optional - **comment** (string) - Optional - **organization_number** (string) - Optional - **organization_type** (string) - Optional - **customer_reference** (string) - Optional - **cost_center** (string) - Optional - **website_url** (string) - Optional - **opening_hours** (object) - Optional - **open_now** (boolean) - Optional - **periods** (array[object]) - Optional - **opens_at** (string) - Optional - **closes_at** (string) - Optional - **day_of_week** (integer) - Optional - **timezone** (string) - Optional - **distance** (number) - Optional - **metadata** (object) - Optional - Additional metadata about the shipping option. - **operator_dest** (string) - Optional - **number_x** (integer) - Optional - **environmental_data** (object) - Optional - Environmental impact information. - **description** (string) - Optional - **details** (array[object]) - Optional - **label** (string) - Optional - **value** (string) - Optional - **thumbnail_url** (string) - Optional - URL for a thumbnail image of the shipping option. - **pay_in_store** (object) - Optional - Configuration for in-store payments. - **type** (string) - Optional - Type of in-store payment (e.g., "full"). - **fee_split** (object) - Optional - Configuration for splitting shipping fees. - **type** (string) - Optional - Type of fee split (e.g., "proportional"). - **destinations** (array[string]) - Optional - List of destination IDs for fee splitting. - **splits** (array[object]) - Optional - Details on how the shipping cost is split among different parties. - **payout_destination_id** (string) - Optional - ID of the payout destination. - **amount** (integer) - Optional - The amount to be split. ### Request Example ```json { "id": "group-id", "line_id": "unique-shipping-id", "amount": 10000, "operator": "shipping-provider-name", "title": "Home delivery", "countries": ["NO", "SE"], "vat_amount": 2500, "vat": 25, "description": "Fastest delivery service to your doorstep", "delivery_method": "delivery", "operator_product_id": "shipping-product-id", "eta": { "working_days": [1,5] }, "time_slot": { "starts_at": "2025-02-06T12:00:00", "ends_at": "2025-02-10T17:00:00" }, "pick_up_address": { "first_name": "John", "last_name": "Doe", "address_line": "Address", "postal_code": "0349", "postal_place": "Oslo", "country": "NO", "opening_hours": { "periods": [ { "opens_at": "08:00", "closes_at": "16:00", "day_of_week": 1 } ], "timezone": "Europe/Oslo" } }, "metadata": { "operator_dest": "XAB1239", "number_x": 1921 }, "environmental_data": { "description": "Fossil free", "details": [ { "label": "Carbon offset", "value": "1KG CO2" } ] }, "thumbnail_url": "http://example.com", "pay_in_store": { "type": "full" }, "fee_split": { "type": "proportional", "destinations": ["string"] }, "splits": [ { "payout_destination_id": "seller-id", "amount": 29700 } ] } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating successful processing of shipping options. #### Response Example ```json { "message": "Shipping options processed successfully." } ``` ``` -------------------------------- ### Dintero API Authentication Request (Curl) Source: https://docs.dintero.com/docs/checkout/authentication This example demonstrates how to authenticate with the Dintero API using cURL. It shows the necessary command-line arguments for the endpoint, authentication, headers, and request body. ```curl curl https://api.dintero.com/v1/accounts/T12345678/auth/token \ -u "CLIENT_ID:CLIENT_SECRET" \ -H'Content-Type: application/json' \ -d'{ "grant_type": "client_credentials", "audience": "https://api.dintero.com/v1/accounts/T12345678" }' ``` -------------------------------- ### Dintero Order Callback Request Example Source: https://docs.dintero.com/docs/checkout/shipping-address-callback This JSON object represents a typical callback request payload from Dintero, detailing order items, amounts, VAT, currency, and shipping options. It serves as the input for processing order-related events. ```json { "order": { "items": [ { "id": "item-1", "line_id": "item-1", "amount": 10000, "vat": 25, "vat_amount": 2000, "quantity": 1 } ], "amount": 20000, "vat_amount": 4000, "currency": "NOK", "shipping_option": { "id": "shipping", "line_id": "shipping", "amount": 10000, "vat": 25, "vat_amount": 2000 } } } ``` -------------------------------- ### Include Card Payment Token in Transaction Details Source: https://docs.dintero.com/docs/checkout/tokenization-fetching-storing This example demonstrates how to use the `includes` query parameter to fetch the card's payment token when retrieving transaction details. This is crucial for obtaining the token after a customer completes their payment information. ```HTTP GET /transactions/{id}?includes=card.payment_token ``` -------------------------------- ### Example Payment Configuration JSON Source: https://docs.dintero.com/docs/checkout/payment-in-app This JSON object represents a typical configuration for initiating a payment through Dintero. It includes details for return and callback URLs, order information such as amount, currency, and merchant reference, and channel-specific configuration like enabling Bambora Vipps. ```json { "url": { "return_url": "merchantApp://result?myAppData&initial_recipient=merchant", "callback_url": "https://example.com/callback?method=GET" }, "order": { "amount": "500", "currency": "NOK", "merchant_reference": "ORDER123" }, "configuration": { "channel": "in_app", "bambora": { "vipps": { "enabled": true } } } } ``` -------------------------------- ### Create Dintero Payment Session with Python SDK Source: https://docs.dintero.com/docs/checkout/sdk/python-sdk This Python code snippet demonstrates how to initialize the Dintero SDK with account credentials and create a payment session. It requires account ID, client ID, client secret, and profile ID. The function takes order details including amount, currency, and items, and returns session information. ```python from dintero import Dintero account_id = 'T12345678' client_id = '72e023b1-aeda-498e-b141-4669528c44b9' client_secret = '125f9f0a-e240-4bfd-be57-0086343bf0e4' profile_id = 'T12345678.46dP6T4F1mUXYPeYKYc5Gj' dintero = Dintero( account_id, client_id, client_secret) checkout = dintero.checkout() session_info = checkout.create_session({ "url": { "return_url": "https://example.com/accept", "callback_url": "https://example.com/callback" }, "order": { "amount": 29990, "currency": "NOK", "merchant_reference": "string", "items": [ { "id": "chair-1", "line_id": "1", "description": "Stablestol", "quantity": 1, "amount": 29990, "vat_amount": 6000, "vat": 25 } ] }, "profile_id": profile_id }) print(session_info) ``` -------------------------------- ### Get Merchant Access Token Source: https://docs.dintero.com/docs/partners/partners-merchant-api-access Exchange an access token for a merchant access token by calling the Get Token endpoint. This is a necessary step to interact with the Dintero API on behalf of a merchant. ```APIDOC ## POST /v1/accounts/{merchant_account_id}/auth/token ### Description Exchanges an exchange token for a merchant access token. ### Method POST ### Endpoint `https://api.dintero.com/v1/accounts/{merchant_account_id}/auth/token` ### Parameters #### Path Parameters - **merchant_account_id** (string) - Required - The unique identifier for the merchant account. #### Request Body - **grant_type** (string) - Required - Must be `client_credentials`. - **audience** (string) - Required - The audience for the token, typically `https://api.dintero.com/v1/accounts/{partner_account_id}`. ### Request Example ```json { "grant_type": "client_credentials", "audience": "https://api.dintero.com/v1/accounts/{partner_account_id}" } ``` ### Headers - **Authorization** (string) - Required - Bearer token obtained in step 2. - **Content-Type** (string) - Required - Must be `application/json`. ### Response #### Success Response (200) - **access_token** (string) - The merchant access token. - **token_type** (string) - The type of token, usually `Bearer`. - **expires_in** (integer) - The token's expiration time in seconds. - **refresh_token** (string) - The refresh token. #### Response Example ```json { "access_token": "eyJhbGci...d5F1", "token_type": "Bearer", "expires_in": 86400, "refresh_token": "string" } ``` ``` -------------------------------- ### Handling Dintero Session Redirects and Callbacks Source: https://docs.dintero.com/docs/checkout/checkout-client This snippet illustrates how to handle the redirect and callback URLs provided by Dintero's session creation endpoint. It's crucial to manage both scenarios as their order and timing are not guaranteed, ensuring a robust user experience and accurate transaction processing. ```text Callback URL: url.callback_url (POST /v1/sessions-profile) Redirect URL: url.return_url (POST /v1/sessions-profile) Handle both redirect and callback as their order is not guaranteed. ``` -------------------------------- ### Checkout Transaction Event Example Source: https://docs.dintero.com/docs/checkout/checkout-webhook An example of the JSON payload received for a checkout transaction event. This event provides details about a completed transaction, including identifiers, timestamps, and status. It is commonly used in subscription-based services. ```json { "account_id": "P12345678", "event": "checkout_transaction", "event_delivery": "9ebb6d41-dca5-484e-8330-9c9fa96b60ba", "transaction": { "id": "P12345678.465UfBENeLpkBvwmqfTC4k", "session_id": "P12345678.465U8CUzaPVpneu1wt8Wei", "merchant_reference": "ORDER-123", "created_at": "2019-08-24T14:15:22Z", "updated_at": "2019-08-24T14:15:22Z", "merchant_reference_2": "OTHER-ID-123", "status": "AUTHORIZED" } } ``` -------------------------------- ### Dintero Order Callback Response Example (No Changes) Source: https://docs.dintero.com/docs/checkout/shipping-address-callback This JSON object is an example of a Dintero callback response when the order details, such as item pricing or shipping costs, have not changed from the original request. It reflects the structure of the incoming request. ```json { "order": { "items": [ { "id": "item-1", "line_id": "item-1", "amount": 10000, "quantity": 1, "vat": 25, "vat_amount": 2000 } ], "amount": 20000, "vat_amount": 4000, "currency": "NOK" } } ``` -------------------------------- ### Dintero Prefilled Onboarding URL Source: https://docs.dintero.com/docs/partners/partners-inviting-merchants Provides the URL structure for partners to initiate a pre-filled onboarding form for merchants. This allows merchants to review and edit their details before accepting terms. The partner ID and an optional signup reference are required. ```url https://onboarding.dintero.com/prefill?partner={partner_id}&signup_reference={signup_reference} ```