Create Payment
Request URL
POST /public/merchant/payment/create
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 create a new payment link. 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/create
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" ] } |
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
{
"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": "15555555555"
}
],
"invoiceNumber": "11124",
"amount": 10,
"currency": "USD",
"dueDate": "2024-08-29",
"description": "test description",
"availablePaymentType": [
"card",
"ach"
]
}
Snippet Examples
javascript
const axios = require('axios');
const data = {
"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": "15555555555"
}
],
"invoiceNumber": "11124",
"amount": 10,
"currency": "USD",
"dueDate": "2024-08-29",
"description": "test description",
"availablePaymentType": [
"card",
"ach"
]
};
const config = {
method: 'POST',
url: '${CONNECTFI_BASE_URL}/public/merchant/payment/create',
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/create" --data "{ \"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\":\"15555555555\" } ], \"invoiceNumber\":\"11124\", \"amount\":10, \"currency\":\"USD\", \"dueDate\":\"2024-08-29\", \"description\":\"test description\", \"availablePaymentType\":[ \"card\", \"ach\" ]}" --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
{
"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": "15555555555"
}
],
"invoiceNumber": "11124",
"amount": 10,
"currency": "USD",
"dueDate": "2024-08-29",
"description": "test description",
"availablePaymentType": [
"card",
"ach"
]
}
RESPONSE BODY
{
"code": "0",
"data": {
"cFiTransactionId": "FvuOBABxhupaLH4x2hn33",
"cFiAggregatorId": "CLIENTID",
"cFiMerchantId": "2Bc0QW0VYJe7VhTyXXEYNQ",
"payerName": "Doe John",
"cFiMerchantRef": "1",
"invoiceNumber": "11124",
"amount": 10,
"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": "15555555555"
}
],
"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": "15fecfa04e9111ef92543a54d404e711"
}