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
- A customer visits your store and chooses to purchase or subscribe to one of your services.
- 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.
- The result of the API call will contain a redirect URL to which you should redirect the customer.
- The customer will receive a one-time PIN code to their handset which they will use to complete the form on the payment window.
- 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.
- If the customer declines the confirmation then they will be sent to your failure URL.
- 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.
- 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 |
---|---|---|
|
String |
The name of your campaign from my.messagecloud.com. This can also be referred to as a |
|
String |
The API key of your campaign from my.messagecloud.com. This can also be referred to as an |
|
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. |
|
Integer |
The shortcode on which the billing is performed. |
|
Decimal |
The price that will be charged, in DKK. Not all tariffs are available by default but can be enabled upon request. |
|
String |
The MSISDN of the customer. This should be in the international format, with no leading plus (+) and beginning with 45. |
|
Integer |
This value should be set to |
|
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. |
|
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 |
---|---|---|
|
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. |
|
Boolean |
If the request was successful, this will be true. False will be returned if we could not generate a window URL. |
|
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. |
|
String |
A human-readable message that describes the problem indicated by the error code. |
|
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 |
---|---|---|
|
String |
The ID that uniquely identifies this request in the MessageCloud platform. |
|
Boolean |
If the request was successful, this will be true. False will be returned if we could not generate a window URL. |
|
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. |
|
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 |
---|---|
|
The request was successful and a |
|
The request did not contain all the required parameters or the parameters sent were not valid. The |
|
Authentication error. Check the |
|
Could not find service details. Please ensure your |
|
Shortcode/tariff error. Not all shortcode/tariff combinations are supported by default. Contact business@messagecloud.com to request custom price points, if required. |
|
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.