Docs
Fraud

Score a Transaction

Use scoring engine to score a transaction

POST
/v1/transactions

Header Parameters

x-api-keystring
ip?string

The ip address of customer that you could detect

actionTypestring

default is purchase

Default"purchase"
Value in"purchase" | "refund" | "transfer_in" | "transfer_out" | "topup" | "withdrawal" | "card_payment" | "wallet_payment" | "internal_adjustment" | "fee" | "chargeback" | "reversal" | "credit" | "debit" | "trade_buy" | "trade_sell"
actionName?string

you can name it. this is used for fraud experts to align with your internal system

Lengthlength <= 100
label?string

A label used on your end

Lengthlength <= 100
transactionIdstring

transaction id on your end

affiliateId?string

if you have affiliate id

session?string

if you need device fingerprint, check javascript sdk integration page

paymentMode?string
paymentProvider?string
transactionTypestring

this will be used for rule types to apply. default is order

Default"order"
Value in"order" | "transaction" | "login"
transactionAmountnumber

double format

transactionCurrencystring

ISO 4217 format currency code

cryptoCurrencyPair?string

Crypto currency pair, with base currency first, e.g. BTCETH

merchant?object
detailsUrl?string

this could be order/transfer/cart url on your end

items?array<object>
card?object
customerobject
billing?object
shipping?object

Response Body

curl -X POST "https://api.ambriel.io/v1/transactions/" \
  -H "x-api-key: string" \
  -H "Content-Type: application/json" \
  -d '{
    "actionType": "purchase",
    "transactionId": "Test123123",
    "transactionType": "order",
    "transactionAmount": 1000.33,
    "transactionCurrency": "USD",
    "customer": {
      "id": "12345",
      "name": "John Doe",
      "firstName": "John",
      "lastName": "Doe"
    }
  }'
const body = JSON.stringify({
  "actionType": "purchase",
  "transactionId": "Test123123",
  "transactionType": "order",
  "transactionAmount": 1000.33,
  "transactionCurrency": "USD",
  "customer": {
    "id": "12345",
    "name": "John Doe",
    "firstName": "John",
    "lastName": "Doe"
  }
})

fetch("https://api.ambriel.io/v1/transactions/", {
  headers: {
    "x-api-key": "string"
  },
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://api.ambriel.io/v1/transactions/"
  body := strings.NewReader(`{
    "actionType": "purchase",
    "transactionId": "Test123123",
    "transactionType": "order",
    "transactionAmount": 1000.33,
    "transactionCurrency": "USD",
    "customer": {
      "id": "12345",
      "name": "John Doe",
      "firstName": "John",
      "lastName": "Doe"
    }
  }`)
  req, _ := http.NewRequest("POST", url, body)
  req.Header.Add("x-api-key", "string")
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://api.ambriel.io/v1/transactions/"
body = {
  "actionType": "purchase",
  "transactionId": "Test123123",
  "transactionType": "order",
  "transactionAmount": 1000.33,
  "transactionCurrency": "USD",
  "customer": {
    "id": "12345",
    "name": "John Doe",
    "firstName": "John",
    "lastName": "Doe"
  }
}
response = requests.request("POST", url, json = body, headers = {
  "x-api-key": "string",
  "Content-Type": "application/json"
})

print(response.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import java.time.Duration;
import java.net.http.HttpRequest.BodyPublishers;

var body = BodyPublishers.ofString("""{
  "actionType": "purchase",
  "transactionId": "Test123123",
  "transactionType": "order",
  "transactionAmount": 1000.33,
  "transactionCurrency": "USD",
  "customer": {
    "id": "12345",
    "name": "John Doe",
    "firstName": "John",
    "lastName": "Doe"
  }
}""");
HttpClient client = HttpClient.newBuilder()
  .connectTimeout(Duration.ofSeconds(10))
  .build();

HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
  .uri(URI.create("https://api.ambriel.io/v1/transactions/"))
  .header("x-api-key", "string")
  .header("Content-Type", "application/json")
  .POST(body)
  .build();

try {
  HttpResponse<String> response = client.send(requestBuilder.build(), BodyHandlers.ofString());
  System.out.println("Status code: " + response.statusCode());
  System.out.println("Response body: " + response.body());
} catch (Exception e) {
  e.printStackTrace();
}
using System;
using System.Net.Http;
using System.Text;

var body = new StringContent("""
{
  "actionType": "purchase",
  "transactionId": "Test123123",
  "transactionType": "order",
  "transactionAmount": 1000.33,
  "transactionCurrency": "USD",
  "customer": {
    "id": "12345",
    "name": "John Doe",
    "firstName": "John",
    "lastName": "Doe"
  }
}
""", Encoding.UTF8, "application/json");

var client = new HttpClient();
client.DefaultRequestHeaders.Add("x-api-key", "string");
var response = await client.PostAsync("https://api.ambriel.io/v1/transactions/", body);
var responseBody = await response.Content.ReadAsStringAsync();
{
  "success": true,
  "state": "approve",
  "score": 64,
  "appliedRules": [
    {
      "code": "BI4969",
      "name": "Card Country AF,AD",
      "operation": "score",
      "category": "bin",
      "score": 30
    }
  ],
  "responseTime": 233
}
Empty
Empty
{
  "errors": [
    {
      "message": "The field must be a valid value",
      "rule": "ruleName",
      "field": "phone"
    }
  ]
}
Empty