Merchant Initiated Payments
Any transaction where you as a merchant are directly asking to authorize payment information is referred to as a merchant-initiated transaction. Such transactions are those that occur for example during subscription billing cycles or payments where your customer is not available to interact at all.
You may require additional approval
Depending on the payment methods you wish to register, you may require additional approval or even an additional agreement with your acquirer. Please contact us to check the requirements based on your merchant setup.
Please also check the tokenization overview to see if your payment method supports registrations and if they can be done with a payment or require a dedicated registration.
After sending all the needed parameters to our endpoint authorize
or validate
, you will receive our response with a transactionId
and the relevant information of the transaction in the response body. No webhook will be sent for such transactions since we directly communicate with your server. From there, you can proceed with your backend operations.
Authorizing payments
At Datatrans we want to give you the maximum flexibility with payments. That's why we don't want to limit merchant initiated payments to any amount or currency. To process a merchant-initiated payment you can call our authorize endpoint. You can switch your subscription amounts for recurring payments at any time or even change the currency if a customer wishes to change that. To process merchant-initiated payments, you will have to first have your customer process a customer initiated payment or registration. Once this has been completed, you will receive a token for their card or payment method account. With this, you can proceed with the payment request from your backend. Card payments require the token to be sent inside the object card
with the expiry date whereas other payment methods need a simple token inside their own object. More details can be found in our API reference. Check the example below to process a card transaction as a merchant.
curl 'https://api.sandbox.datatrans.com/v1/transactions/authorize' \
--header 'Authorization: Basic {basicAuth}' \
--header 'Content-Type: application/json' \
--data-raw '{
"currency": "CHF",
"refno": "Test-1234",
"amount": 100,
"card": {
"alias": "{cardAlias}",
"expiryMonth": 12,
"expiryYear": 21
},
"autoSettle": true
}'
Verifying payment information
If you require to check if a payment account is still valid you can call our validate endpoint. This API call will return if a card is still valid or not. This is useful for business cases where you wish to check a card's validity without having to debit any amount from your customers.
curl 'https://api.sandbox.datatrans.com/v1/transactions/validate' \
--header 'Authorization: Basic {basicAuth}' \
--header 'Content-Type: application/json' \
--data-raw '{
"refno": "Test-1234",
"currency": "CHF",
"card": {
"alias": "{cardAlias}",
"expiryMonth": "12",
"expiryYear": "21"
}
}'
Updated 10 months ago