Payment Fraud Integration

Sending Updates

After you have acted on our recommendation it is important to update us on the order, transaction, payment method or any refunds.

On this page:

Accepted orders

If you have accepted an order you should send a Checkout request with an updated order status. Since you are not requesting another recommendation, you do not need to add a checkpoint query parameter to the URL.

You should set the following two fields:

order.status.stage = "accepted"
order.status.actor = "merchant"

You should also provide the latest transaction details in the transaction object.

An example request is shown below:

POST https://api.ravelin.com/v2/checkout HTTP/1.1
Authorization: token ...
Content-Type: application/json

{
  "timestamp": 1512828988826,
  "customerId": "abc-123-ZYZ",
  "order": {
    "orderId": "abcde12345-ZXY",
    "status": {
      "stage": "accepted",
      "actor": "merchant"
    }
  },
  "transaction": {
    "transactionId": "123-abc-XYZ",
    "time": 1512828988826,
    "amount": 1500,
    "currency": "GBP",
    "type": "auth",
    "gateway": "example-gateway",
    "gatewayReference": "1234",
    "success": true,
    "3ds": {
      "attempted": true,
      "challenged": false,
      "success": true,
      "version": "2.2.1",
      "eci": "05"
    }
  }
}

Completed orders

When an order has been completed you should send a Checkout request with an updated order status.

You should set the following two fields:

order.status.stage = "fulfilled"
order.status.actor = "merchant"

You should also provide the latest transaction details in the transaction object.

An example request is shown below:

POST https://api.ravelin.com/v2/checkout HTTP/1.1
Authorization: token ...
Content-Type: application/json

{
  "timestamp": 1512828988826,
  "customerId": "abc-123-ZYZ",
  "order": {
    "orderId": "abcde12345-ZXY",
    "status": {
      "stage": "fulfilled",
      "actor": "merchant"
    }
  },
  "transaction": {
    "transactionId": "123-abc-XYZ",
    "time": 1512828988826,
    "amount": 1000,
    "currency": "GBP",
    "type": "capture",
    "gateway": "example-gateway",
    "gatewayReference": "1234",
    "success": true
  }
}

Blocked orders

If you blocked an order because of our recommendation, you should send a Checkout request with an updated order status.

You should set the following two fields:

order.status.stage = "cancelled"
order.status.reason = "ravelin"

An example request is shown below:

POST https://api.ravelin.com/v2/checkout HTTP/1.1
Authorization: token ...
Content-Type: application/json

{
  "timestamp": 1512828988826,
  "customerId": "abc-123-ZYZ",
  "order": {
    "orderId": "abcde12345-ZXY",
    "status": {
      "stage": "cancelled",
      "reason": "ravelin"
    }
  }
}

Saving payment methods after checkout

If you do not know the paymentMethodId of a paymentMethodCipher payment method type at checkout, then you can refer to the payment method by a transaction which used it.

For example, you may have sent the following recommendation request:

POST https://api.ravelin.com/v2/checkout?score=checkoutPreAuth HTTP/1.1
Authorization: token ...
Content-Type: application/json

{
  "timestamp": 1536577389238679409,
  "customerId": "cust-123",
  "order": {
    "orderId": "ord-123"
  },
  "transaction": {
    "transactionId": "tx-123",
    "amount": 123
  },
  "paymentMethod": {
    "methodType": "paymentMethodCipher",
    "cardCiphertext": "...",
    "aesKeyCiphertext": "...",
    "algorithm": "RSA_WITH_AES_256_GCM",
    "ravelinjsVersion": "0.0.9"
  }
}

If the customer then saves the payment method to their account, and you generate a payment method ID, you can let us know the ID by sending a Payment Method request containing a payment method with the fromTransaction method type, the paymentMethodId which you just generated and the transactionId of the transaction which used it.

An example request is shown below:

POST https://api.ravelin.com/v2/paymentmethod HTTP/1.1
Authorization: token ...
Content-Type: application/json

{
  "timestamp": 1536578369411033583,
  "customerId": "cust-123",
  "paymentMethod": {
    "paymentMethodId": "pm-123",
    "methodType": "fromTransaction",
    "transactionId": "tx-123"
  }
}

We will then associate the payment method ID with the payment method sent in the original request.

Associating refunds with payment methods

When sending a refund transaction we need to know the payment method which the refund is taking place against. If you don’t know the payment method, but you do know the original transaction, you can use this to associate the refund with the payment method. An example of how to do this is shown below.

Given that you sent the following recommendation request, which did not contain a payment method ID:

POST https://api.ravelin.com/v2/checkout?score=checkoutPreAuth HTTP/1.1
Authorization: token ...
Content-Type: application/json

{
  "timestamp": 1536577389238679409,
  "customer": {
    "customerId": "cust-123"
  },
  "order": {
    "orderId": "ord-123"
  },
  "transaction": {
    "transactionId": "tx-123",
    "amount": 123
  },
  "paymentMethod": {
    "methodType": "paymentMethodCipher",
    "cardCiphertext": "...",
    "aesKeyCiphertext": "...",
    "algorithm": "RSA_WITH_AES_256_GCM",
    "ravelinjsVersion": "0.0.9"
  }
}

If a refund occurs, create a refund transaction without then knowing the payment method ID by sending a Transaction request containing a payment method with the fromTransaction method type and the transactionId of the original transaction.

An example request which does this is shown below:

POST https://api.ravelin.com/v2/transaction HTTP/1.1
Authorization: token ...
Content-Type: application/json

{
  "timestamp": 1536578369411033583,
  "customerId": "cust-123",
  "orderId": "ord-123",
  "transaction": {
    "transactionId": "refund-123",
    "type": "refund",
    "gateway": "my-psp",
    "gatewayReference": "gw-ref-123",
    "success": true,
    "amount": 1000,
    "currency": "GBP"
  },
  "paymentMethod": {
    "methodType": "fromTransaction",
    "transactionId": "tx-123"
  }
}

We can then associate the refund transaction with the payment method.

Feedback