Connect
  1. Overview
Connect
  • Connect/ConnectID API Reference
  • Overview
    • API lifecycle
    • OAuth 2.0
    • About the URLs
    • Google analytics
    • Unite payment SDK
    • Events
      • Authentication
      • Connect realtime events
      • ConnectID events
  • Customer Data
    • Address
      • Change addresses
      • List addresses
      • List addresses - client mode
      • List addresses for product - client mode
      • List addresses for product
    • Category
      • List category types
      • List category codes
      • List category codes for category type
    • Customer
      • List customer info
      • Change customer Info
      • Search customer - client mode
      • Check customer number - client mode
      • List customer info - client mode
    • External Reference
      • Remove external reference - client mode
      • Change external reference - client mode
      • List external references - client mode
      • Register external reference - client mode
  • Order Management
    • Article
      • Check article price
    • Coupon
      • Check coupon price - client mode
      • List coupon - client mode
      • List coupon for coupon number - client mode
    • Fulfillment
      • Complete order - client mode
    • Order
      • Order Guide
        • Introduction
        • How to register an order
        • Complete order by fulfillment URL
        • Complete order by fulfillment API
        • Q&A for order
      • List orders
      • Search order details
      • List order product history
      • List order status - client mode
      • Register customer - client mode
      • Register customer
      • Register order - client mode
      • Register order
    • Reward
      • Check reward - client mode
    • User
      • Assign user - client mode
    • Voucher Coupons
      • List voucher code coupons - client mode
  • Payment Services
    • Invoice
      • List invoice details
      • List invoices - client mode
      • List invoices for product - client mode
      • List invoices and reminders
      • List invoices and reminders for product
      • List basic invoice info
      • List basic invoice info for product
    • InvoiceAddress
      • List invoice address
    • Klarna
      • List klarna recurring tokens
      • Add Klarna token
      • Remove Klarna token
    • Nexi
      • List Nexi subscriptions
      • Add Nexi subscription
      • Remove Nexi subscription
    • PayEx
      • List PayEx tokens
      • Add PayEx token
      • Remove PayEx token
    • Payment
      • List payment methods
      • Pay invoice
      • Change payment method
    • Vipps
      • List vipps agreements
      • Add vipps agreement
      • Remove vipps agreement
  • Privacy
    • Consent
      • Access private data
      • Remove private data
      • List consent event history - client mode
      • List consent text - client mode
      • List consent text history - client mode
      • List consent groups - client mode
      • List consent given issuer - client mode
      • List consent event history
      • List consent given issuer
      • List consent groups
      • Register consent event - client mode
      • Register consent event
    • Permission/Shield
      • List global permissions
      • List enterprise permissions
      • Change enterprise permissions
      • List ordertype permissions
      • Change ordertype permissions
      • Check shield ordertype - client mode
      • Check shield enterprise - client mode
    • Privacy
      • List privacy enterprise
      • Change privacy enterprise
      • List privacy ordertype
      • Change privacy ordertype
  • Product & Services
    • Complaint
      • Register complaint
      • List complaints
    • Delivery
      • List next distributions
      • List next distributions - client mode
    • DeliveryStop
      • Remove delivery stops
      • Register delivery stops
      • List delivery stops
      • List delivery stop - client mode
    • Issue
      • List distributed issues
      • List product issues - client mode
    • Product
      • List products - client mode
      • Check product - client mode
      • List specific products - client mode
    • ProductDeliveryPlan
      • List productdeliveryplan - client mode
    • ProductDependency
      • Check product dependency discount - client mode
    • Sharing
      • Send subscription share invitation
      • Accept subscription share invitation
      • Decline share - client mode
      • List shareable subscription rules
      • List distribution levels
      • Change subscription share invitation details
      • List all shared subscribers
      • Cancel sharing
      • List shareable subscription nets
      • Change shareable subscription nets
      • Change distribution level
    • Subscription
      • List shared subscriptions
      • List subscriptions
      • Start subscription
      • List subscriptions - client mode
  • Recruitment
    • Recruitment
      • Register recruitment - client mode
      • List recruitments
      • List premium recruitments
      • Change premium recruitments
      • Register recruitments
    • RecruitmentCampaign
      • List recruitment campaign - client mode
  • User Data
    • Access
      • Check access
      • Check access - client mode
    • Credential
      • Check credential - client mode
    • Metadata
      • List metadata
      • Change metadata
      • Remove metadata
      • List metadata - client mode
      • Change metadata - client mode
      • Remove metadata - client mode
    • Profile
      • List user profile
      • List external user profiles
  • Diverse
    • External Identity
      • Register external Id - client mode
      • Register customer - client mode
    • Message
      • List messages
      • Send message
      • Send message - client mode
    • Status
      • List status messages
    • Stock
      • Change stocks - client mode
      • List stocks - client mode
      • List stocks for product - client mode
  1. Overview

Unite payment SDK

This feature allows our clients to easily enable different payment method options on their websites. We will collect payments on your behalf. It is a javascript library that our clients can use to facilitate integration with payment intermediaries. It is possible to do payments on the same page(seamless view flow) or use redirect(redirect flow). In order to use this feature please contact Unite by sending an email to support@mediaconnect.no.

UnitePay servers

There are currently two types of servers in use, namely the mcPayCdnServer and the mcPayApiServer.

mcPayCdnServer

This provides static files e.g. javascript.

  • Production: https://api.mediaconnect.no/mcpay
  • Test: https://api-test.mediaconnect.no/mcpay

mcPayApiServer

This specifies API server, when initializing javascript library it must be provided.

  • Production: https://api.mediaconnect.no/capi/mcpay
  • Test: https://api-test.mediaconnect.no/capi/mcpay

Payment methods

There are several possible payment methods. Payment provider configuration is needed to use these payment methods. Some of the payment providers support recurring payment, see the table below.
Note that only some of these payment methods may be available to you, e.g. due to geographic availability, etc.

paymentMethod recurring=true recurring=false flow
creditcardPayex ✔ ✔ seamless, redirect
vippsRecurring ✔ redirect
vippsEcommerce ✔ redirect
nexi ✔ ✔ seamless, redirect

How to use UnitePay

To use the library you need to include our javascript on your website.

Example:

<script src="[mcPayCdnServer]/lib/v/1/mediaconnectpay.js"></script>

The library is available under mediaconnectpay namespace in javascript.
mcPayCdnServer supports different url schemes

  • /lib/v/{dynamicVersion}/mediaconnectpay.js - suggested way of loading the newest version matching requested dynamic version e.g. 1 may return 1.1.2, 1.0 may return 1.0.1, 1.1 may return 1.1.2, 2 may return 2.0.0
  • /lib/public/{version}/mediaconnectpay.js - specific version where version is composed of {major}.{minor}.{patch}, exact matching e.g. 1.0.1, 1.1.2, 2.0.0
  • /lib/beta/mediaconnectpay.js - the newest version under development, should not be used under normal circumstances
    The newest libary version at this moment is v. 1.4.0.

Please note: Never show the payment script inside an iframe. In general, it may break the payment flow - if not today, then later.

Then you need to initialize it.

Example:

<div id="mediaconnectpay-id"></div>
<script>
    mediaconnectpay.Api.init({
        // see [mcPayApiServer]
        baseUrl: 'https://api-test.mediaconnect.no/capi/mcpay',
        elementId: 'mediaconnectpay-id'
    });
    // ...
</script>

Technical details of init argument object:

Property Type Description
baseUrl string mcPayApiServer url
required
elementId string html element id where library can place generated content
required

Next step is to initiate payment.

Example:

    mediaconnectpay.Api.paymentInit(request, callback, options?);

Technical details of paymentInit request object:

Property Type Description
clientCode string Client code
required
sign string Signed JWT token with payment init parameters
required

Example:

{
  "clientCode": "no.mediaconnect.test",
  "sign": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJwYXltZW50TWV0aG9kIjoiY3JlZGl0Y2FyZFBheWV4IiwicHJvZHVjdFNwZWNDb2RlIjoiVE9UVCIsInByb2R1Y3RTcGVjTm8iOjEsInJlY3VycmluZyI6dHJ1ZSwiY2xpZW50Q29kZSI6Im5vLm1lZGlhY29ubmVjdC50ZXN0IiwiZXh0ZXJuYWxSZWZlcmVuY2UiOiJVVUlELTIwMjItMDMtMDRUMTI6MDA6MDAuMDAwWiIsIm5iZiI6MTY0NjM5NTQ0NywiaWF0IjoxNjQ2Mzk1NDQ3LCJleHAiOjE2NDYzOTkwNDd9._zH3XwyzOzgaaIvsIpw5byAT2It84zrr7t4U65fTmDNoI8AfC8O3f_G99qGv7OkEB1zBJ7Om33XtmB2-9QCwCA"
}

Technical details of paymentInit request sign object before being signed:

Property Type Description
clientCode string Client code
required
paymentMethod string creditcardPayex, vippsRecurring, vippsEcommerce, nexi
required
paymentFlow string seamless, redirect
optional
paymentScope string Scope for vipps payment, space delimited: address birthDate email name phoneNumber
optional
productSpecCode string Coupon code
optional, reuired for recurring
productSpecNo number Coupon number
optional, required for recurring
currency string Currency, if not provided taken from the coupon or partner company default currency
optional
amount number Amount, if not provided taken from the coupon, if coupon is not provided, amount is required
optional, required for non-coupons/multiline orders
vatAmount number Vat amount
optional, should be send for non-coupons/multiline orders
subscriptionStartAmount number Amount that overrides standard start coupon amount
optional
recurring boolean Is this recurring payment
required
description string Passed to payment provider payment window
optional
externalReference string External reference to this payment from client side, unique, one time use only
required
phoneNumber string Phone number
optional
returnUrl string Return url. Url will have additional parameters added about the payment:
mcPayRef - id of the payment, after successful payment use it as mcPayRef to place the order
status - status of the payment, success or failure

optional, required if payment method uses redirect flow
checkoutUrl string Checkout url. Specifies where the checkout will be loaded.

optional, required if payment method is nexi and uses seamless flow
merchantId string Merchant Id
companyCode string The company code

Example:

{
  "paymentMethod": "creditcardPayex",
  "productSpecCode": "TOTT",
  "productSpecNo": 1,
  "recurring": true,
  "clientCode": "no.mediaconnect.test",
  "externalReference": "UUID-2022-03-04T12:00:00.000Z"
}

Technical details of paymentInit callback object:

Property Type Description
onInit function Callback called after payment was initialized, user may fulfill the payment details.
Callback argument #1, paymentInit api response, structure: { mcPayRef: string; }
mcPayRef string, id of the payment
onSuccess function Callback called after payment was successfully completed. Works only during seamless flow, not during redirect flow.
Callback argument #1, paymentInit api response, structure: { mcPayRef: string; }
mcPayRef string, id of the payment, after successful payment use it as mcPayRef to place the order
Callback argument #2, complete response passed from payment provider, available if payment provider make it available otherwise undefined.
onFailure function Callback called after payment failed.
Callback argument #1, paymentInit api response, available if payment was initialized otherwise is undefined, structure: { mcPayRef: string; }
mcPayRef string, id of the payment
Callback argument #2, error response.
Callback argument #3, error response passed from payment provider, available if payment provider make it available otherwise undefined. Callback argument #4, optional, string, failure reason e.g. 'cancel'.
onRedirect function Callback called after payment was initialized with redirect flow. Optional, if onRedirect function provided then you are responsible for handling it, either do redirect in same window or for example in new tab.
Callback argument #1, paymentInit redirect response, structure: { mcPayRef: string; redirectUrl: string; }
mcPayRef string, id of the payment
redirectUrl string, redirect url

Example:

{
    onInit: function (paymentInitResponse) {
        // ...
    },
    onSuccess: function (paymentInitResponse, providerResponse) {
        // ...
    },
    onFailure: function (paymentInitResponse, errorResponse, providerResponse) {
        // ...
    },
    // if onRedirect function provided then you are responsible for handling it
    onRedirect: function (redirectResponse) {
        // ...
    },
}

Technical details of paymentInit options object: This is optional argument, allows you to pass custom options to payment view. After payment is finished base on redirect flow mcPayRef will be returned together with status for payment (success/failure). If payment scope was provided for Vipps payment sub for Vipps user will be also returned.

Previous
Google analytics
Next
Authentication
Built with