Sample code: REST

 

Below you can find an example of the payment done via REST interface. It is first registered, then authorized and captured, and finally searched from Netaxept by using the Query call to find out detailed information about the transaction. Parameters in the API calls sent via REST interface need to be URL encoded, otherwise spaces and special characters will break the call and Netaxept will not receive it in its complete form.

Please note that below mentioned API calls are meant to be only examples and shouldn’t be used as such.  For example [MERCHANTID] and [TOKEN] in the examples need to be replaced for the values provided by Nets. In addition, a unique value needs to be generated for each transaction in the TransactionId tag. After the registration phase, you should refer to this unique value in all later operations for this transaction.

 

Step 1: Register payment

Merchant sends the Register call to Netaxept:

https://test.epayment.nets.eu/Netaxept/Register.aspx?merchantId=[MERCHANTID]&token=[TOKEN]&orderNumber=T12345&amount=100&CurrencyCode=EUR&redirectUrl=http://localhost/Test/

Merchant receives the RegisterResponse from Netaxept:

<RegisterResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<TransactionId>6c5e402a4ee445ba9f19411f55c75b91</TransactionId>
</RegisterResponse>

 

Step 2: Send customer to the payment window

Merchant sends the Terminal call to Netaxept:

https://test.epayment.nets.eu/Terminal/default.aspx?merchantId=[MERCHANTID]&transactionId=6c5e402a4ee445ba9f19411f55c75b91

After the terminal phase customer is redirected to the URL specified in the Register call:

http://localhost/Test/?transactionId=6c5e402a4ee445ba9f19411f55c75b91&responseCode=OK

 

Step 3: Authorize payment

Merchant sends the Process (AUTH) call to Netaxept:

https://test.epayment.nets.eu/Netaxept/Process.aspx?merchantId=[MERCHANTID]&token=[TOKEN]&transactionId=6c5e402a4ee445ba9f19411f55c75b91&operation=AUTH 

Merchant receives the ProcessResponse from Netaxept:

<ProcessResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<AuthorizationId>258460</AuthorizationId>
<BatchNumber>642</BatchNumber>
<ExecutionTime>2017-01-24T07:47:28.1900126+01:00</ExecutionTime>
<MerchantId>[MERCHANTID]</MerchantId>
<Operation>AUTH</Operation>
<ResponseCode>OK</ResponseCode>
<TransactionId>6c5e402a4ee445ba9f19411f55c75b91</TransactionId>
</ProcessResponse>

 

Step 4: Capture payment

Merchant sends the Process (CAPTURE) call to Netaxept: 

https://test.epayment.nets.eu/Netaxept/Process.aspx?merchantId=[MERCHANTID]&token=[TOKEN]&transactionId=6c5e402a4ee445ba9f19411f55c75b91&transactionAmount=100&operation=CAPTURE

Merchant receives the ProcessResponse from Netaxept:

<ProcessResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<BatchNumber>642</BatchNumber>
<ExecutionTime>2017-01-24T07:54:53.4580815+01:00</ExecutionTime>
<MerchantId>[MERCHANTID]</MerchantId>
<Operation>CAPTURE</Operation>
<ResponseCode>OK</ResponseCode>
<TransactionId>6c5e402a4ee445ba9f19411f55c75b91</TransactionId>
</ProcessResponse>

 

Step 5: Perform query on transaction

Merchant sends the Query call to Netaxept:

https://test.epayment.nets.eu/Netaxept/Query.aspx?merchantId=[MERCHANTID]&token=[TOKEN]&transactionId=6c5e402a4ee445ba9f19411f55c75b91

Merchant receives the Query response from Netaxept:

<PaymentInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MerchantId>[MERCHANTID]</MerchantId>
<QueryFinished>2017-01-24T08:00:38.2923444+01:00</QueryFinished>
<TransactionId>6c5e402a4ee445ba9f19411f55c75b91</TransactionId>
<AuthenticationInformation/>
<AvtaleGiroInformation/>
<CardInformation>
<ExpiryDate>1901</ExpiryDate>
<Issuer>Visa</Issuer>
<IssuerCountry>NO</IssuerCountry>
<MaskedPAN>492500******0004</MaskedPAN>
<PaymentMethod>Visa</PaymentMethod>
<IssuerId>3</IssuerId>
</CardInformation>
<CustomerInformation>
<Address1>Test road 1</Address1>
<Address2/>
<CompanyName>Test company</CompanyName>
<CompanyRegistrationNumber/>
<CustomerNumber>Cust30048</CustomerNumber>
<Country>FI</Country>
<Email>bill.buyer@test.com</Email>
<FirstName>Bill</FirstName>
<IP>12.12.123.123</IP>
<LastName>Buyer</LastName>
<PhoneNumber>+35840123456</PhoneNumber>
<Postcode>00510</Postcode>
<SocialSecurityNumber/>
<Town>Helsinki</Town>
</CustomerInformation>
<ErrorLog/>
<History>
<TransactionLogLine>
<DateTime>2017-01-24T08:35:07.63</DateTime>
<Description>
This is a test transaction. Do not deliver the product.
</Description>
<Operation>Register</Operation>
<TransactionReconRef>1084073201</TransactionReconRef>
</TransactionLogLine>
<TransactionLogLine>
<BatchNumber>642</BatchNumber>
<DateTime>2017-01-24T08:47:28.19</DateTime>
<Description>12.12.123.123</Description>
<Operation>Auth</Operation>
<TransactionReconRef>1084073201</TransactionReconRef>
</TransactionLogLine>
<TransactionLogLine>
<Amount>100</Amount>
<BatchNumber>642</BatchNumber>
<DateTime>2017-01-24T08:54:53.457</DateTime>
<Description>12.12.123.123</Description>
<Operation>Capture</Operation>
<TransactionReconRef>1084073201</TransactionReconRef>
</TransactionLogLine>
</History>
<OrderInformation>
<Amount>100</Amount>
<Currency>EUR</Currency>
<Fee>0</Fee>
<OrderDescription>Test transaction</OrderDescription>
<OrderNumber>T12345</OrderNumber>
<Timestamp>2017-01-24T08:35:07.63</Timestamp>
<Total>100</Total>
<RoundingAmount>0</RoundingAmount>
</OrderInformation>
<SecurityInformation>
<CustomerIPCountry>FI</CustomerIPCountry>
<IPCountryMatchesIssuingCountry>false</IPCountryMatchesIssuingCountry>
</SecurityInformation>
<Summary>
<AmountCaptured>100</AmountCaptured>
<AmountCredited>0</AmountCredited>
<Annuled>false</Annuled>
<Annulled>false</Annulled>
<AuthorizationId>258460</AuthorizationId>
<Authorized>true</Authorized>
</Summary>
<TerminalInformation>
<Browser>
Chrome-Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
</Browser>
<CustomerEntered>2017-01-24T07:40:44.760</CustomerEntered>
<CustomerRedirected>2017-01-24T08:41:26.993</CustomerRedirected>
</TerminalInformation>
</PaymentInfo>

 

Step 6: Fetch batch information

Merchant sends the GetBatch call to Netaxept:

https://test.epayment.nets.eu/Netaxept/reports/getbatch.aspx?merchantId=[MERCHANTID]&token[TOKEN]&fromTimestamp=2020-10-12T00:00:00&toTimestamp=2020-10-12T11:05:00

Merchant receives the GetBatch response from Netaxept:

<BatchResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Summary>
<TotalCaptured>310</TotalCaptured>
<TotalCredited>310</TotalCredited>
</Summary>
<Items>
<BatchResponseItem>
<Timestamp>2020-10-12T11:00:04.237</Timestamp>
<Issuer>Visa</Issuer>
<Operation>Capture</Operation>
<MaskedPan>472012******1234</MaskedPan>
<Currency>EUR</Currency>
<BatchNumber>818</BatchNumber>
<TransactionId>d1f9c48cfd764c8ca9d71edb3dc59631</TransactionId>
<OrderNumber>Test1</OrderNumber>
<AuthorizationId>602781</AuthorizationId>
<TransactionReconRef>12345678</TransactionReconRef>
<Amount>310</Amount>
</BatchResponseItem>
<BatchResponseItem>
<Timestamp>2020-10-12T11:00:16.203</Timestamp>
<Issuer>Visa</Issuer>
<Operation>Credit</Operation>
<MaskedPan>472012******1234</MaskedPan>
<Currency>EUR</Currency>
<BatchNumber>818</BatchNumber>
<TransactionId>d1f9c48cfd764c8ca9d71edb3dc59631</TransactionId>
<OrderNumber>Test1</OrderNumber>
<AuthorizationId>602781</AuthorizationId>
<TransactionReconRef>12345678</TransactionReconRef>
<Amount>310</Amount>
</BatchResponseItem>
</Items>
</BatchResponse>

 

Step 7: Retrieve information about the card used for the transaction

Merchant sends the GetCardInformation call to Netaxept:

https://test.epayment.nets.eu/netaxept/getcardinformation.aspx?merchantid=[MERCHANTID]&token=[TOKEN]&transactionId=6c5e402a4ee445ba9f19411f55c75b91]

Merchant receives the GetCardInformation response from Netaxept:

<GetCardInfoResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Issuer>Visa</Issuer>
<CardType>Credit</CardType>
<CountryCode>840</CountryCode>
<CountryName>US</CountryName>
<CardProductType>Corporate</CardProductType>
<CardOrigin>Outside EU/EEA</CardOrigin>
</GetCardInfoResponse>

 

Step 8: Handle error situations

Merchant sends incorrect API credentials along the Query call to Netaxept:

https://test.epayment.nets.eu/Netaxept/Query.aspx?merchantId=[MERCHANTID]&token=[WRONGTOKEN]

Merchant receives the exception from Netaxept:

<Exception xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Error xsi:type="AuthenticationException">
<Message>Authentication failed (Test) MerchantId: [MERCHANTID]</Message>
</Error>
</Exception>