Skip to content

Upload Logo

Request URL

POST /public/merchant/logo/upload/:type

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 upload a logo image. This action can also be facilitated through the Payment Link Iframe script when embedded into your existing front-end merchant portal UI.

The type of logo image can be specified through the ":type" path parameter, such as "light", "dark", "big", "small", etc. Multiple logos may be uploaded for the same Merchant.

Request Body

File should be uploaded as multipart/form-data.

Snippet Examples

javascript

const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');
const fileStream = fs.createReadStream('./file/path/fileName.jpg');
const form = new FormData();
form.append('file', fileStream, 'fileName.jpg');
const data = form;
const config = {
  method: 'POST',
  url: '${CONNECTFI_BASE_URL}/public/merchant/logo/upload/:type',
  headers: {
    ...form.getHeaders(),
    '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/logo/upload/:type" --form "file=@./file/path/fileName.jpg" --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 multipart/form-data
x-connectfi-jwtoken A long random string token received from /payment-link/merchant/get-token request

PARAMETERS

Parameter Description Value
type light1

REQUEST BODY

none

RESPONSE BODY

{
    "code": "0",
    "data": {
        "logoId": "3MPbtqzn0pB62JiNUNF6c9"
    },
    "requestId": "7c3756704ea011ef92543a54d404e711"
}