The developer.datatrans.com Developer Hub

Welcome to the developer.datatrans.com developer hub. You'll find comprehensive guides and documentation to help you start working with developer.datatrans.com as quickly as possible, as well as support if you get stuck. Let's jump right in!

Create an Alias

Prerequisite

  • Payment method has to support the Alias feature
  • Alias feature has to be enabled on your Datatrans merchant id

How to Create an Alias

There are two ways to create an Alias:

  • As a result of a payment transaction.
  • As a result of a dedicated registration.

By doing a payment

Receive an Alias for each payment transaction

Apply parameter useAlias=yes

The merchant should use this parameter when doing a normal payment. After a successful authorization the response will contain the parameter aliasCC.

Datatrans.startPayment({
          form: "#lightbox-form",
          params: {
            "merchantId": merchantId,
            "amount": amount,
            "currency": currency,
            "refno": refno,
            "sign": sign,
            "successUrl":successUrl,
            "errorUrl":errorUrl,
            "cancelUrl":cancelUrl,
            "useAlias":"yes"
          }      
        });    

Receive an Alias on customers choice

Apply parameter uppRememberMe=true

When using this parameter the consumer will see a "remember payment credentials" checkbox on the payment page.

If the consumer checks the checkbox, the parameter useAlias=true will be added automatically to the request. Use uppRememberMe=checked if the checkbox should be checked as a default. Again, the response will contain the aliasCC parameter.

Datatrans.startPayment({
         form: "#lightbox-mode",
         params: {
            "merchantId": merchantId,
            "amount": amount,
            "currency": currency,
            "refno": refno,
            "sign": sign,
            "successUrl":successUrl,
            "errorUrl":errorUrl,
            "cancelUrl":cancelUrl,
            "uppRememberMe":"checked"
          }      
        });

By doing a registration

This approach should be used if the merchant only wants to register a consumer payment credentials without doing an actual payment. If the merchant sends parameter amount=0, Datatrans validates the card number accordingly.

Datatrans.startPayment({
          form: "#lightbox-mode3",
          params: {
            "merchantId": merchantId,
            "amount": 0,
            "currency": currency,
            "refno": refno,
            "sign": sign,
            "successUrl":successUrl,
            "errorUrl":errorUrl,
            "cancelUrl":cancelUrl
          }      
        });

Create an Alias


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.