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!

Charge an Alias

Once the aliasCC has been obtained it can be used to make subsequent payment transactions.

Using the Payment Page

When using the payment page all the possible (e.g when using a credit card alias only the card number will be pre-filled) input fields are getting pre-filled.

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<form id="redirect-mode" method="POST" class="form-horizontal" target="_self" action="https://pay.sandbox.datatrans.com/upp/jsp/upStart.jsp">
   <div class="form-group">
    <label for="pmethod" class="col-sm-4 control-label">Payment Method</label>
    <div class="col-sm-8">
      <input type="text" class="form-control" id="pmethod" name="paymentmethod" value="VIS">
    </div>
  </div>
  <div class="form-group">
    <label for="merchantId" class="col-sm-4 control-label">MerchantId</label>
    <div class="col-sm-8">
      <input type="text" class="form-control" id="merchantId" name="merchantId" value="1100004624">
    </div>
  </div>
  <div class="form-group">
    <label for="amount" class="col-sm-4 control-label">Amount</label>
    <div class="col-sm-8">
      <input type="text" class="form-control" id="amount" name="amount" value="100">
    </div>
  </div>
  <div class="form-group">
    <label for="currency" class="col-sm-4 control-label">Currency</label>
    <div class="col-sm-8">
      <input type="text" class="form-control" id="currency" name="currency" value="CHF">
    </div>
  </div>
  <div class="form-group">
    <label for="refno" class="col-sm-4 control-label">Reference number</label>
    <div class="col-sm-8">
      <input type="text" class="form-control" id="refno" name="refno" value="">
    </div>
  </div>
    <div class="form-group">
    <label for="sign" class="col-sm-4 control-label">Sign</label>
    <div class="col-sm-8">
      <input type="text" class="form-control" id="refno" name="sign" value="30916165706580013">
    </div>
  </div>  
  
  <div class="form-group">
    <label for="sign" class="col-sm-4 control-label">AliasCC</label>
    <div class="col-sm-8">
      <input type="text" class="form-control" id="aliasCC" name="aliasCC" value="70119122433810042">
    </div>
  </div>
  
   <div class="form-group">
    <label for="sign" class="col-sm-4 control-label">Expiry Month</label>
    <div class="col-sm-8">
      <input type="text" class="form-control" id="expm" name="expm" value="12">
    </div>
  </div>
  
  <div class="form-group">
    <label for="sign" class="col-sm-4 control-label">Expiry Year</label>
    <div class="col-sm-8">
      <input type="text" class="form-control" id="expy" name="expy" value="21">
    </div>
  </div>
  
  <input type="hidden" name="successUrl" value="https://docs.datatrans.ch/docs/payment-process-charge-an-alias" />
    <input type="hidden" name="errorUrl" value="https://docs.datatrans.ch/docs/payment-process-charge-an-alias" />
    <input type="hidden" name="cancelUrl" value="https://docs.datatrans.ch/docs/payment-process-charge-an-alias" />
  
   <input type="hidden" name="uppWebResponseMethod" value="GET" />
  
  <div class="form-group">
    <div class="col-sm-offset-4 col-sm-8">
      <button  type="submit" class="btn btn-primary">Charge an Alias</button>
    </div>
  </div>
</form>

<script type="application/javascript">
   function randomRefno() {
        return new Date().getTime()%1000000;
    }

    var refnoElm = $("input[name=refno]");
    if ( refnoElm.length == 1 )
    {
        var randomizeNext = false;
        refnoElm.val(randomRefno());
        refnoElm.change(function () {
            // user manually changed the refno, leave it as it is
            randomizeNext = false;
        });

        refnoElm.parents("form").submit(function () {
            if (randomizeNext)
                refnoElm.val(randomRefno());
            randomizeNext = true;
        });
    }
</script>

The payment page is getting pre-filled with the masked creditcard number and the expiry date only. If no additional information is needed the transaction automatically succeeds.

Using the Authorization API

If they payment method is of type credit card (VIS, ECA, AMX, DIN, DIS, JCB, CUP) the <aliasCC> together with <expm> and <expy> can be used to make an authorization.

curl -v -X POST https://api.sandbox.datatrans.com/upp/jsp/XML_authorize.jsp \
-H 'Content-Type: application/xml' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d @- << EOF
<?xml version="1.0" encoding="UTF-8" ?>
<authorizationService version="4">
  <body merchantId="1100004624">
    <transaction refno="358838">
      <request>
        <amount>1000</amount>
        <currency>CHF</currency>
        <reqtype>CAA</reqtype>
        <aliasCC>70323122544331174</aliasCC>
        <expm>12</expm>
        <expy>21</expy>
        <sign>30916165706580013</sign>
      </request>
    </transaction>
  </body>
</authorizationService>
EOF
<?xml version='1.0' encoding='UTF-8'?>
<authorizationService version='4'>
  <body merchantId='1000011011' status='accepted'>
    <transaction refno='358838' trxStatus='response'>
      <request>
        <amount>1000</amount>
        <currency>CHF</currency>
        <reqtype>CAA</reqtype>
        <aliasCC>70323122544331174</aliasCC>
        <expm>12</expm>
        <expy>21</expy>
        <sign>30916165706580013</sign>
      </request>
      <response>
        <responseCode>01</responseCode>
        <responseMessage>Authorized</responseMessage>
        <uppTransactionId>190211113120063336</uppTransactionId>
        <authorizationCode>120083337</authorizationCode>
        <acqAuthorizationCode>113120</acqAuthorizationCode>
        <maskedCC>375811xxxxx1115</maskedCC>
        <returnCustomerCountry>CHE</returnCustomerCountry>
      </response>
    </transaction>
  </body>
</authorizationService> 

Regulatory restrictions

Due to PSD2 and 3DS 2 we recommend to use the Authorization API for credit cards only for merchant initiated transactions and not use cases like 1-click-checkout.

Authorization without CVV and 3D

The method above is only available if the CVV code and 3D process for the particular payment method are optional. You need to have a special acquiring contract for this. Please Contact us for more information.

Non credit card alias payments

If the payment method is not a credit card the parameters <expm> and <expy> are not needed anymore. But please make sure to submit the <pmethod> parameter. For example:

curl -v -X POST https://api.sandbox.datatrans.com/upp/jsp/XML_authorize.jsp \
-H 'Content-Type: application/xml' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d @- << EOF
<?xml version="1.0" encoding="UTF-8" ?>
<authorizationService version="3">
  <body merchantId="1000011011">
    <transaction refno="33233434">
      <request>
        <amount>1000</amount>
        <currency>CHF</currency>
        <aliasCC>B-74T26709GN402081M</aliasCC>
        <pmethod>PAP</pmethod>
        <sign>30916165706580013</sign>
      </request>
    </transaction>
  </body>
</authorizationService>
EOF
<?xml version='1.0' encoding='UTF-8'?>
<authorizationService version='3'>
    <body merchantId='1000011011' status='accepted'>
        <transaction refno='33233434' trxStatus='response'>
            <request>
                <amount>1000</amount>
                <currency>CHF</currency>
                <aliasCC>B-74T26709GN402081M</aliasCC>
                <pmethod>PAP</pmethod>
                <sign>30916165706580013</sign>
                <PayPalBillingAgreementId/>
                <reqtype>NOA</reqtype>
            </request>
            <response>
                <responseCode>01</responseCode>
                <responseMessage>PayPal trx successful</responseMessage>
                <uppTransactionId>181015163514275498</uppTransactionId>
                <authorizationCode>514285499</authorizationCode>
                <acqAuthorizationCode>0KF20791F3399283T</acqAuthorizationCode>
            </response>
        </transaction>
    </body>
</authorizationService>

Charge 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.