Skip to content

Update Payment

Request URL

POST /public/merchant/payment/update

Description

After authenticating the merchant through your existing front-end merchant portal UI and requesting a merchant JSON Web Token through the `/payment-link/merchant/get-token` endpoint, you may make a call to this endpoint in order to allow the merchant corresponding to the provided 'x-connectfi-jwtoken' header to update the details of an existing payment link, specified by the "cFiTransactionId" property. This action can also be facilitated through the Payment Link Iframe script when embedded into your existing front-end merchant portal UI.

Schema

Property table for public/merchant/payment/update

Property Description Required Schema
invoiceNumber The invoice number No {
  "type": "string",
  "pattern": "^((?![<>]).)*$",
  "minLength": 0,
  "maxLength": 50,
  "nullable": true,
  "$id": "common-commonStr50"
}
amount Amount No {
  "type": "number",
  "exclusiveMinimum": 0,
  "amountPrecision": 2,
  "$id": "common-amount"
}
currency A three character ISO alphabetic code to identify the currency No {
  "type": "string",
  "maxLength": 3,
  "minLength": 3,
  "pattern": "^[A-Z]+$",
  "$id": "common-currency"
}
dueDate The due date No {
  "oneOf": [
    {
      "type": "string",
      "format": "dateISO"
    },
    {
      "type": "string",
      "enum": [ "" ] } ]
}
description Description No {
  "type": "string",
  "pattern": "^((?![<>]).)*$",
  "minLength": 0,
  "maxLength": 500,
  "nullable": true,
  "$id": "common-commonStr500"
}
fields An array of fields Yes array of fields item objects
availablePaymentType The types of payments that are accepted No array of {
  "type": "string",
  "nullable": true,
  "enum": [ "card", "ach" ]
}
cFiTransactionId The transaction ID in the connectFi system Yes {
  "type": "string",
  "pattern": "^[0-9a-zA-Z_]+$",
  "minLength": 1,
  "maxLength": 36,
  "$id": "common-id"
}

Property table for fields array item object

Property Description Required Schema
index index Yes {
  "type": "integer"
}
code code Yes {
  "type": "string",
  "pattern": "^((?![<>]).)*$",
  "minLength": 0,
  "maxLength": 50,
  "nullable": true,
  "$id": "common-commonStr50"
}
label label Yes {
  "type": "string",
  "pattern": "^((?![<>]).)*$",
  "minLength": 0,
  "maxLength": 50,
  "nullable": true,
  "$id": "common-commonStr50"
}
value value No {
  "type": "string",
  "pattern": "^((?![<>]).)*$",
  "minLength": 0,
  "maxLength": 100,
  "nullable": true,
  "$id": "common-commonStr100"
}

Request Body

{
  "cFiTransactionId": "FvuOBABxhupaLH4x2hn33",
  "fields": [
    {
      "index": 1,
      "code": "firstName",
      "label": "First Name",
      "value": "John"
    },
    {
      "index": 2,
      "code": "lastName",
      "label": "Last Name",
      "value": "Doe"
    },
    {
      "index": 3,
      "code": "email",
      "label": "Email",
      "value": "customer_email@email.test"
    },
    {
      "index": 4,
      "code": "phone",
      "label": "Phone",
      "value": "15556667777"
    }
  ],
  "invoiceNumber": "11123",
  "amount": 22.50,
  "currency": "USD"
}

Snippet Examples

javascript

const axios = require('axios');
const data = {
  "cFiTransactionId": "FvuOBABxhupaLH4x2hn33",
  "fields": [
    {
      "index": 1,
      "code": "firstName",
      "label": "First Name",
      "value": "John"
    },
    {
      "index": 2,
      "code": "lastName",
      "label": "Last Name",
      "value": "Doe"
    },
    {
      "index": 3,
      "code": "email",
      "label": "Email",
      "value": "customer_email@email.test"
    },
    {
      "index": 4,
      "code": "phone",
      "label": "Phone",
      "value": "15556667777"
    }
  ],
  "invoiceNumber": "11123",
  "amount": 22.50,
  "currency": "USD"
};
const config = {
  method: 'POST',
  url: '${CONNECTFI_BASE_URL}/public/merchant/payment/update',
  headers: {
    'Content-Type': "application/json",
    'x-connectfi-jwtoken': "A long random string token received from /payment-link/merchant/get-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 "CONNECTFI_BASE_URL/public/merchant/payment/update" --data "{  \"cFiTransactionId\":\"FvuOBABxhupaLH4x2hn33\", \"fields\":[    {      \"index\":1,     \"code\":\"firstName\",     \"label\":\"First Name\",     \"value\":\"John\"    },   {      \"index\":2,     \"code\":\"lastName\",     \"label\":\"Last Name\",     \"value\":\"Doe\"    },   {      \"index\":3,     \"code\":\"email\",     \"label\":\"Email\",     \"value\":\"customer_email@email.test\"    },   {      \"index\":4,     \"code\":\"phone\",     \"label\":\"Phone\",     \"value\":\"15556667777\"    }  ], \"invoiceNumber\":\"11123\", \"amount\":22.50, \"currency\":\"USD\"}" --header "Content-Type: application/json" --header "x-connectfi-jwtoken: A long random string token received from /payment-link/merchant/get-token request" 

Successful Response Examples

200 SUCCESSFUL RESPONSE

HEADERS

Header Value
Content-Type application/json
x-connectfi-jwtoken A long random string token received from /payment-link/merchant/get-token request

REQUEST BODY

{
  "cFiTransactionId": "FvuOBABxhupaLH4x2hn33",
  "fields": [
    {
      "index": 1,
      "code": "firstName",
      "label": "First Name",
      "value": "John"
    },
    {
      "index": 2,
      "code": "lastName",
      "label": "Last Name",
      "value": "Doe"
    },
    {
      "index": 3,
      "code": "email",
      "label": "Email",
      "value": "customer_email@email.test"
    },
    {
      "index": 4,
      "code": "phone",
      "label": "Phone",
      "value": "15556667777"
    }
  ],
  "invoiceNumber": "11123",
  "amount": 22.50,
  "currency": "USD"
}

RESPONSE BODY

{
    "code": "0",
    "data": {
        "cFiTransactionId": "FvuOBABxhupaLH4x2hn33",
        "cFiAggregatorId": "CLIENTID",
        "cFiMerchantId": "2Bc0QW0VYJe7VhTyXXEYNQ",
        "payerName": "Doe John",
        "cFiMerchantRef": "1",
        "invoiceNumber": "11123",
        "amount": 22.5,
        "currency": "USD",
        "dueDate": "2024-07-29",
        "description": "test description",
        "status": "Initiated",
        "fields": [
            {
                "index": 1,
                "code": "firstName",
                "label": "First Name",
                "value": "John"
            },
            {
                "index": 2,
                "code": "lastName",
                "label": "Last Name",
                "value": "Doe"
            },
            {
                "index": 3,
                "code": "email",
                "label": "Email",
                "value": "customer_email@email.test"
            },
            {
                "index": 4,
                "code": "phone",
                "label": "Phone",
                "value": "15556667777"
            }
        ],
        "availablePaymentType": [
            "card",
            "ach"
        ],
        "statusChangeHistory": [
            {
                "initiatorId": "2Bc0QW0VYJe7VhTyXXEYNQ",
                "initiatorType": "merchant",
                "status": "Initiated",
                "dtsCreatedAt": "2024-07-30T16:30:51.807Z",
                "dtsUpdatedAt": "2024-07-30T16:30:51.807Z"
            }
        ],
        "dtsCreatedAt": "2024-07-30T16:30:51.807Z"
    },
    "requestId": "99db53c04e9b11ef92543a54d404e711"
}