Skip to content

Pay IOU

Request URL

POST /iou/:IOUTransactionId/pay

Description

Make a payment on an IOU transaction. Used by the borrower to pay back a specified amount. The amount may be less than or equal to the amount of the IOU. If no amount is specified, then the remaining IOU balance will be used as the default amount to pay.

The payment is taken from the borrower's main account. If the available funds are not sufficient a partial payment is made. If the IOU is paid in full, the transaction is deleted.

Schema

Property table for iou/:IOUTransactionId/pay

Property Description Required Schema
IOUTransactionId IOUTransactionId Yes {
  "type": "string"
}
amount Amount No {
  "type": "number",
  "nullable": true
}

Request Body

{
    "amount": 0.33
}

Snippet Examples

javascript

const axios = require('axios');
const data = {
    "amount": 0.33
};
const config = {
  method: 'POST',
  url: '${AMPLIFI_BASE_URL}/iou/:IOUTransactionId/pay',
  headers: {
    'Content-Type': "application/json",
    'token': "A long random string token received from /token request"
  },
  data
};

let result;
try {
  result = await axios.request(config);
  if (result.status === 200) {
    console.log(JSON.stringify(result.data));
  }
} catch (err) {
  console.log({
    errCode: err.code,
    responseStatus: err.response && err.response.status,
    data: err.response && JSON.stringify(err.response.data)
  });
}

cURL

curl --location "AMPLIFI_BASE_URL/iou/:IOUTransactionId/pay" --data "{    \"amount\":0.33}" --header "Content-Type: application/json" --header "token: A long random string token received from /token request" 

Successful Response Examples

200 IOU/:IOUTRANSACTIONID/PAY SUCCESSFUL RESPONSE IOU BALANCE WAS PAID

HEADERS

Header Value
Content-Type application/json
token A long random string token received from /token request

PARAMETERS

Parameter Description Value
IOUTransactionId [required] qweioutr70kszstgeioecqsprgphwshi

REQUEST BODY

{

}

RESPONSE BODY

{
    "success": true
}

200 IOU/:IOUTRANSACTIONID/PAY SUCCESSFUL RESPONSE SPECIFIED AMOUNT PAID ON IOU

HEADERS

Header Value
Content-Type application/json
token A long random string token received from /token request

PARAMETERS

Parameter Description Value
IOUTransactionId [required] qweioutr70ftlidyhakwlqtthykgkqqn

REQUEST BODY

{
    "amount": 0.33
}

RESPONSE BODY

{
    "success": true
}