4T Denmark Payment Window

Denmark – 4T Payment Window

The information provided in this document is intended for developers to integrate the subscription and charging of customers in Denmark using 4T's new PIN opt-in flow. If you have not already done so, please contact the business development team before attempting to follow this guide; business@messagecloud.com or +44 (0)330 1130 243, option 2.

Background

Since 1st June 2021, 4T has mandated the use of a payment window to approve all purchases of digital goods that can be ordered online, including in-app purchases. This mandate applies to one-time purchases and subscription services. In order to comply with this, there is a new process for charging for content in Denmark that must be implemented.

Flow Diagram

Explanation of Flow Diagram

  1. A customer visits your store and chooses to purchase or subscribe to one of your services.
  2. You call our 4T Payment Window API requesting a window be generated. The window will contain details like the price of the service and any subscription period information, where applicable.
  3. The result of the API call will contain a redirect URL to which you should redirect the customer.
  4. The customer will receive a one-time PIN code to their handset which they will use to complete the form on the payment window.
  5. If the customer confirms the payment, a delivery report will be sent to your callback URL to notify you before they are redirected back to your success URL.
  6. If the customer declines the confirmation then they will be sent to your failure URL.
  7. If a subscription was started, then you can call the same API weekly or monthly according to the agreed interval to continue the subscription. No repeating PIN opt-in will be required for this.
  8. If a customer opts out of your subscription then you will receive a STOP request to your callback URL. See Stop Requests for more information.

Getting Started

To use this payment window then you must first ensure that the following information is given to our team:

  • Service name — this will appear on the payment window and should identify the service being purchased.
  • Bill text — this will appear on the bill of the customer, as well as on the payment window itself. Normally, it would include the name of the service, the name of your company and a local contact number for the customer to request further information.
  • Success URL — this is where the customer will be directed upon successful payment.
  • Failure URL — this is where the customer will be directed if they cancel the payment.
  • Callback URL — this is a URL to which we will send billing and delivery notifications. We will also use it to send any opt-outs.
  • Subscription or one-time payment information — whether the service is a one-time or subscription service.
  • Subscription period — if this is a subscription service, what is the interval between the billing events (possible: weekly or monthly).

Once this information has been processed, we will give you a service ID that you can use during your API calls when generating a window. 

It is also very important that any communications sent to the customer originate from the 4T API, including welcome messages, spending reminders and opt-out confirmations. This can be achieved by using the sendSms API.

Generating a Window

When your customer confirms their intention to make a purchase you should send the following parameters to our API, located at:

https://client.txtnation.com/4t/generate

You must send your requests using the HTTP GET method.

Variable Type Contents

campaign_name

String

The name of your campaign from my.messagecloud.com. This can also be referred to as a cc or a campaign_name.

api_key

String

The API key of your campaign from my.messagecloud.com. This can also be referred to as an ekey.

service_id

String

The service ID that uniquely identifies your service. This is provided by MessageCloud on approval of your service. See Getting Started (above) for further details.

shortcode

Integer

The shortcode on which the billing is performed.

tariff

Decimal

The price that will be charged, in DKK. Not all tariffs are available by default but can be enabled upon request.

msisdn

String

The MSISDN of the customer. This should be in the international format, with no leading plus (+) and beginning with 45.

start_subscription

Integer

This value should be set to 1 if this request is the first subscription interaction. Only the first subscription interaction with the customer requires a payment window to be generated. Any subsequent subscription charges can use 0 for this parameter and the charging will happen without a payment window.

message

String

(Optional) The message to send to the customer, often used as a welcome message or receipt of purchase. This should not contain any premium content as the message is sent to the customer before they have confirmed their intent to pay.

id

String

(Optional) A merchant-generated ID that can uniquely identify the transaction. This will be used in any callbacks to your HTTP receiver.

Generate Window Responses

Once a successful request has been sent to our API, the response body will contain the following in JSON format:

{
    requestId: "89a1be63-ac06-44d3-8200-054668a77108",
    status: true,
    code: 0,
    message: "Success",
    redirectUrl: "https://betaling.4-t.dk/792af4f6-97aa-4472-b9b6-0ead3638af8e?merchantId=27",
    subscriptionId: 256791563732
}

The customer should then be forwarded to the redirectUrl to complete their payment or subscription. An explanation for the parameters returned in the response body is below:

Variable Type Contents

requestId

String

The ID that uniquely identifies this request in the MessageCloud platform. Note that if you use an id in your initial request, any subsequent notifications and callbacks will use your id and not ours.

status

Boolean

If the request was successful, this will be true. False will be returned if we could not generate a window URL.

code

Integer

The error code gives more detail about the problem that prevented a window from being generated. See the table of error codes below for more details.

message

String

A human-readable message that describes the problem indicated by the error code.

redirectUrl

String

The URL to which the customer should be redirected to complete their purchase.

subscriptionId
Integer The subscription ID for the customer. This ID should be used for any subsequent free messages sent via the Send SMS API.

Sending an SMS

When you wish to communicate with your customer, all free messages must be sent via the following URL:

https://client.txtnation.com/4t/sendsms

You must send your requests using the HTTP GET method.

Variable Type Contents
campaign_name String The name of your campaign from my.messagecloud.com. This can also be referred to as a cc or a campaign_name.
api_key String The API key of your campaign from my.messagecloud.com. This can also be referred to as an ekey.
service_id String The service ID that uniquely identifies your service. This is provided by MessageCloud on approval of your service. See Getting Started (above) for further details.
tariff Decimal This should always be set to 0.00 when sending an SMS.
shortcode Integer The shortcode on which the accompanying billing is performed.
msisdn String The MSISDN of the customer. This should be in the international format, with no leading plus (+) and beginning with 45.
message String The message to send to the customer.
subscription_id
Integer (Required if part of a subscription) The subscriptionId that was returned to you after generating the initial window. This is used to link your free messages to the relevant subscriptions.

Send SMS Responses

Once a successful request has been sent to our API, the response body will contain the following in JSON format:

{
    requestId: "1b89ae63-ac06-44d3-8200-0a7715466808",
    status: true,
    code: 0,
    message: "Success"
}

An explanation for the parameters returned in the response body is below:

Variable Type Contents

requestId

String

The ID that uniquely identifies this request in the MessageCloud platform.

status

Boolean

If the request was successful, this will be true. False will be returned if we could not generate a window URL.

code

Integer

The error code gives more detail about the problem that prevented a window from being generated. See the table of error codes below for more details.

message

String

A human-readable message that describes the problem indicated by the error code.

Error Codes

The following error codes could be returned by the API if something doesn't work as expected.

Error Code Description

0

The request was successful and a redirectUrl will be provided.

1

The request did not contain all the required parameters or the parameters sent were not valid. The message field will contain more information about which field was not valid.

2

Authentication error. Check the campaign_name and api_key fields contain valid authentication details.

3

Could not find service details. Please ensure your service_id is valid.

4

Shortcode/tariff error. Not all shortcode/tariff combinations are supported by default. Contact business@messagecloud.com to request custom price points, if required.

5

Could not authorise the transaction with 4T. This is normally due to restrictions on the MSISDN you are attempting to charge, like premium barring or age checks.

Receiving the Callbacks

There are two types of callbacks that you will need to handle: the customer returning to your shop after a successful or failed purchase and the charge notification or delivery report. When the customer is being redirected to the success or failure URL, we will append the transaction ID to the redirect so that you are able to identify them and also check for the result of the charging which we will post to your callback URL in the form of a delivery report.

For more details on receiving delivery reports, you can the Receiving a Delivery Report page.