post https://api.sandbox.datatrans.com/v1/transactions/secureFields
Proceed with the steps below to process Secure Fields payment transactions:
- Call the /v1/transactions/secureFields endpoint to retrieve a
transactionId. The success result of this API call is aHTTP 201status code with atransactionIdin the response body. - Initialize the
SecureFieldsJavaScript library with the returnedtransactionId:
var secureFields = new SecureFields();
secureFields.init(
transactionId, {
cardNumber: "cardNumberPlaceholder",
cvv: "cvvPlaceholder",
});
- Handle the
successevent of thesecureFields.submit()call. Examplesuccessevent data:
{
"event":"success",
"data": {
"transactionId":"{transactionId}",
"cardInfo":{"brand":"MASTERCARD","type":"credit","usage":"consumer","country":"CH","issuer":"DATATRANS"},
"redirect":"https://pay.sandbox.datatrans.com/upp/v1/3D2/{transactionId}"
}
}
- If 3D authentication is required, the
redirectproperty will indicate the URL that the browser needs to be redirected to. - Use the Authorize an authenticated transaction endpoint to authorize the Secure Fields transaction. This is required to finalize the authorization process with Secure Fields.
- Use the
transactionIdto check the status and to settle, cancel or credit (refund) an transaction.