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!

After The Payment

Once you have concluded a customer- or merchant-initiated transaction you can proceed with further actions. You can either settle, cancel, refund, or check the status of a transaction. The details of these operations can be found on this page.

Settling a Transaction

To settle or capture a transaction you have two options: Either you settle transactions automatically with the authorization or you send us a request to settle them. The first approach is the easier one, as you do not have to think about sending a second call to our API to settle a transaction. However, the second approach allows you to debit your customers only if you have successfully processed the payment response in your system. So if your business case requires it, you may defer the settlement and send us an additional call to our settlement endpoint.

We strongly suggest you to settle transactions as fast as possible, as some payment methods or acquirers decline settlements after a few days. Usually, a transaction can be settled up to 30 days after the authorization.

To settle transactions automatically, add the parameter autoSettle to your payload when initializing a transaction.

"autoSettle": true

Below is an example showing you how to settle a transaction using our API. You can also settle a lower amount than the one previously authorized. This can be useful if you wish to finalize transactions with a lower amount or to settle the full amount in separate intervals (so-called partial settlements). A settlement with a higher amount than the authorized amount is not supported.

curl 'https://api.sandbox.datatrans.com/v1/transactions/{{transactionId}}/settle' \
--header 'Authorization: Basic {{basicAuth}}' \
--header 'Content-Type: application/json' \
--data-raw '{
	"currency": "CHF",
	"amount": 100,
	"refno": "Test-1234-settled"
}'

Deferred Settlements not possible with all payment methods

Please be aware that not all payment methods support deferred settlements. More details on which payment methods accept deferred settlements can be found on our payment methods overview.

Marketplace Settlements

Marketplace settlements require you to send an additional parameter and an object within the payload. This object specifies which sub-merchant within the marketplace will receive the settlement. Please refer to the marketplace page for more details.

{
    "closeTransaction": "no",
    "marketplace": {
        "subMerchantId": {{submerchantId}},
        "fee": {
            "amount": 400,
            "currency": "CHF"
        }
    }
}

Cancelling a Transaction

A transaction that has not been settled yet can be cancelled. This will lead to a cancelled transaction which will no longer be debited from your customer and the amount will be unblocked on the customer's account. The cancel request is also referred to as a reversal. Send a call to our cancel endpoint.

curl 'https://api.sandbox.datatrans.com/v1/transactions/{{transactionId}}/cancel' \
--header 'Authorization: Basic {{basicAuth}}' \
--header 'Content-Type: application/json' \
--data-raw '{
	"refno": "Test-1234-cancelled"
}'

Refunding a Transaction

A settled transaction can be refunded to any amount equal or lower than the settled amount. Send a call to our refund endpoint to refund a transaction. A refund will create a new transactionId dedicated to the refund process.

curl 'https://api.sandbox.datatrans.com/v1/transactions/{{transactionId}}/credit' \
--header 'Authorization: Basic {{basicAuth}}' \
--header 'Content-Type: application/json' \
--data-raw '{
	"amount": 100,
	"currency": "CHF",
	"refno": "Test-1234-credit"
}'

Marketplace Refunds

Marketplace refunds require you to send an additional object within the payload. This object specifies which sub-merchant within the marketplace will receive the refund. Please refer to the marketplace page for more details.

{
    "marketplace": {
        "subMerchantId": {{submerchantId}},
        "fee": {
            "amount": 400,
            "currency": "CHF"
        }
    }
}

Checking the Status of a Transaction

Regardless of the status of a transaction, you can check for the current status at any time. This call will return all steps previously completed and useful information related to the transaction. Call our status endpoint to do check for the status.

curl 'https://api.sandbox.datatrans.com/v1/transactions/{{transactionId}}' \
--header 'Authorization: Basic {{basicAuth}}' \
--header 'Content-Type: application/json'

Reconciling your Transactions

Add our reconciliation service to reconcile your online transactions with your acquirers' payouts. This gives you the option to identify missing payouts and chargebacks quickly and easily from your merchant dashboard. Please refer to our dedicated Reconciliation page in our documentation for more information.

Updated about a month ago

After The Payment


Suggested Edits are limited on API Reference Pages

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