Create an Alias
Prerequisites for Creating an Alias
- The merchant ID has to support the Alias feature.
- The payment method has to support the Alias feature.
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.
There exist some exceptions, where a token can only be created with a dedicated registration. This is the case for Twint when using our mobile SDK integration.
Card Registration after a successful payment transaction
Parameter to return an Alias after a transaction
Simply add the parameter
useAlias=yes
in your request to return a token of the card used during the purchase.
Merchants can send the parameter useAlias=yes
within their requests to create a token. After successful authorization, the response will contain the alias in the return parameter aliasCC
. You can save this value together with the expiry date to process recurring payments.
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. Once 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 only
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
}
});
Alias Creation in iOS SDK
iOS app developers can refer to chapter 3, which describes how to set several options within the payment controller DTPaymentController
. You will need to define the following option to request an alias creation:
paymentController.paymentOptions.returnsAlias = YES;
Alias Creation in Android SDK
Android app developers can refer to the classes AliasPaymentMethod*
to create an alias after a successful transaction. You will also need to set the method setRecurringPayment
to true
within the PaymentOptions
class.
Updated over 2 years ago