API Overview


1. Request merchant account

Contact D2I to receive a merchant account with user, login, merchant_id and secret key to merchant. 


2. Develop an integration

Implement a call to Direct2Internet Payment Window API, passing payment details merchant_id, order_id, amount, accept_url, do_3d_secure and mac calculated with your secret key.

Optionally you can use an already built integration for a store front application, like for example WooCommerce.


3. Sign additional contract (if needed)

Sign a contract for making payments with Direct2Internet to allow you to go live. Depending on connection type and agreement with Direct2Internet you may have to sign additional contracts with an additional party (such as a Bank)


4. Go Live

You can start processing real payments once you have signed a contract with Direct2Internet and Direct2Internet has configure your account. Contact Direct2Internet and make sure that your account has been activated for payments.

Depending on the store and type of purchases you may be required to use 3D Secure for all of your transactions.

While there is no testing or certification requirements to start processing payments to go live ,you are advised to test and ensure that your integration is working. Direct2Internet could be forced to disable your payment processing if your integration is faulty, talk to Direct2Internet about recommended testing procedures.

How it works

To use Direct2Internet as a service provider you only have to implement a single API call. The only mandatory API call that needs to be implemented is the Payment window API called by the customer/client. The call to the payment window is performed by the browser of the customer/client and is done by sending for example the following html code to the client.

<form action="https://pay.direct2internet.com/pay" method="post" id="store-send-params">  
     <table>
     <tr><td>Merchant id</td><td><input  name="merchant_id" value="your merchant id"> </td></tr>
     <tr><td>Order id</td><td><input  name="order_id" value="your order id"></td></tr>
      <tr><td>Amount (öre 0.01sek)</td><td><input  name="amount" value="100"> </td></tr>
      <tr><td>Accept URL</td><td><input  name="accept_url" value="your accept url"></td> </tr>
      <tr><td>3D Secure</td><td><input  name="do_3d_secure" value="YES"> </td></tr>
      <tr><td>MAC</td><td><input  id="actMAC" name="mac" value="<calc this>"> </td><tr>
    </table>
    <button type="submit"">send to server</button>
</form>

The mac must be calculated as by instruction (see API), the other fields should be replaced with correct values for your merchant/account. It is strongly recommended to hide the mac field, merchant id field, accept url, 3D Secure field and any additional field that should not be displayed to the client.

It is strongly advised to include the callback_url parameter and to implement the callback logic to ensure successful payments are correctly processed as payed in your store (or back office). 

Debit Payments First

Swedish law demands that debit options are displayed first when selecting payment options. This can be implemented on a merchant page by adding two payment options to the Direct2Internet PSP. The first option will use payment methods to only debit styled payments (using pay_method option), the second option will contain all credit payment methods. Because CARD payments can be both credit and debit card the payment options DEBITCARD and CREDITCARD should be used to comply with this Swedish law. Because of the age of the law there are different interpretations of the law an consequently these instructions should be considered best practice only.

One click payments

Implementing one click payments that allows you to do multiple payments without entering card data for every payment again is done by using recurring payments. Set the create_subscription parameter in the call to the payment window API to 'YES'. Use the recurring payment API for any subsequent payment of the customer/client. It is possible to use 3DSecure with one click payments when entering card data to reduce financial risks.

Be aware that one click payments are more dangerous to use than ordinary payments. When using one click payments the customer/client can easily become the victim of fraud, for instance a lost mobile phone could be stolen and used to make payments without the consent of the customer. Contact Direct2Internet for advice on how to reduce financial risk for one click payments.

Instantaneous settlements of payments

If you want instant settlements of payments you need to set the option capture_now to 'YES' in the call to Payment window API. There is no other change needed to settle payments instantly. Using instant settlements whenever possible is recommended for all payments.

Payments by email

If you want to charge customers by email by having customers use Link payments. In this case you embed a link/url in the email and send this to the client. Link payments function exactly as other payments except that your server makes the payment call and then sends the resulting link to a customer/client.

Be aware that when customers use Linked payments the same order id will be used multiple times as customers will reuse the same url when using multiple debit/credit cards.

3D Secure / Payer authentication

The PSP supports 3D Secure out of the box using the parameter do_3d_secure in call payment window API. When making calls to the payment window API the parameter do_3d_secure must be set to YES and the create_subscription parameter should be omitted. If you need subscription make sure that your merchant is configured to allow subscriptions and when creating subscriptions it is recommended to use do_3d_secure set to YES and create_subscription with parameter set to YES. If 3D Secure parameters are incorrectly set you will receive an error when trying to make a payment through the payment window API. 

More features

There are additional features like recurring payments (also known as card on file operations), debit API, credit API for use with payments for merchants. If you want to manage multiple merchants there are additional APIs to manage and process large number of merchants. This 'PSP' account allows easier processing of day to day operation of multiple merchants. Use a 'PSP' account if you want to resell D2I payment services.

API Overview

API name Merchant Account PSP Account Called by customer Called by server Access by MAC Access by user/user password Access by PSP key Online Payments One Click Payments Payments by email

Payment window API

 yes yes yes no yes no no yes yes no
API debit payment  yes yes no yes yes  yes  no  no no no
API void payment yes  yes  no yes yes yes no  no no no
API credit payment yes  yes no yes yes yes no no no no
API recurring payment yes  yes no yes yes yes no no yes no
Link payment API yes  yes no yes yes no no no no yes
Listing merchants no  yes no yes no no yes no no no
Getting merchants no yes  no yes no no yes no no no
Creating merchants no yes  no yes no no yes no no no
Updating merchants no yes no yes no no yes no no no

Deleting merchants

no yes no yes no no yes no no no

Listing transactions

no yes no yes no no yes no no no

Getting transactions

no yes no yes no no yes no no no
Listing subscriptions no yes no yes no no yes no no no
Getting subscriptions no yes no yes no no yes no no no
Updating subscriptions no yes no yes no no yes no no no

Deleting subscriptions

no yes no yes no no yes no no no

Listing users

no yes no yes no no yes no no no

Getting users

no yes no yes no no yes no no no

Creating users

no yes no yes no no yes no no no

Updating users

no yes no yes no no yes no no no

Deleting users

no yes no yes no no yes no no no

Listing files

no yes no yes no no yes no no no

Download file

no yes no yes no no yes no no no

Upload file

no yes no yes no no yes no no no