Skip To Content

Developer Documenation: Quotes – API

Difficulty: Medium

We recommend that a developer integrate this API as there are elements which need to be dynamically generated.

The first tab to the right includes a jQuery plus Ajax example to communicate with our new API to receive real-time quotes.

Json request structure

  1. Submit your request in POST
  2. Headers need to include:
    1. Content Type: application/json
    2. Your x-api-key
    3. Authorization: Basic username & password in base 64
  3. Body must be submitted as JSON and needs to include:
    1. PartnerID
    2. totalCost

About the required details

  1. Partner ID : PartnerID
    1. If you don’t know what your partner ID is please consult with your Marlin Capital representative.
  2. Total Cost: totalCost
    1. This should represent the cumulative value of the item(s) on your product page. For example if the
      visitor selects more than 1 item, please ensure that the total cost is reflected in the totalCost.
      field.

Legend

While testing please use testdevportal & devapply and when ready for production be sure use devportal & apply respectively.

The total cost will need to be dynamically populated and should be integrated by your web developer. Also please make note to replace the example Partner ID with yours.

  1. Lastly, please download our zipped logo package to upload on your website. Be sure to select the logo with appropriate color type, depending on the button color you choose to use: i.e., PEAC_icon_white_bg.png for the white background button and PEAC_icon_dark_bg.png for either the dark buttons.
<div class="mcs_finance">

	  <!-- WHITE Button -->
	  <form action="https://devapply.marlincapitalsolutions.com/auth/EF" method="post" id="product_info">
	    <input value="1408" type="hidden" style="display: none" name="estimatedEquipmentCost" class="mcs-product-price">
	    <input value="*******************" type="hidden" style="display: none" name="partnerid" class="mcs-partner-id">
	    <a href="#" class="financelink_1" id="financelink_1"
		style="position:relative;font-family: arial, sans-serif ; line-height: 17px; letter-spacing: .02em; font-weight: 400; font-size: 17px;padding:15px; display: inline-block; text-align:center;width:100%;border: 1px solid #979797; color: #434343; background-color: #FFFFFF;"
					target="_blank"><span style="display: block; position: relative; margin-right: 25px">Finance for as low as <strong
					class="financeamount_1" id="financeamount_3" style="color:#000000;"></strong></span><img
					src="https://yourdomain.com/images/PEAC_icon_white_bg.png"
					style="position: absolute; right: 13px; top: 50%; margin-top: -10px; width: 36px; height: auto;"></a>
	  </form>

	  <!-- Quotes Script -->
<script>

	jQuery( document ).ready( function() {
		var partnerID   = jQuery( '.mcs-partner-id' ).val(),
			totalPrdtCost = parseFloat( jQuery( '.mcs-product-price' ).val(), 10 ).toFixed( 2 );
		if ( totalPrdtCost > 1000 ) {
			callQuotesApi( totalPrdtCost, partnerID );
		}
	} );

	function callQuotesApi( totalCost, partnerId ) {
			var requri = 'https://testdevportal.marlincapitalsolutions.com:8077/ws/rest/quotesapi/v1/createQuotesAPI/',
				username = '*********************',
				password = '*********************',
				jsonRequest = {
					'PartnerId': partnerId,
					'totalCost': totalCost,
				},
				jsonHeaders = {
					'x-api-key': '********-********-**********-*************',
					'Authorization': 'Basic ' + btoa( username + ':' + password ),
				};
			jQuery.ajax( {
				method: 'POST',
				dataType: 'json',
				contentType : 'application/json',
				url: requri,
				headers: jsonHeaders,
				data: JSON.stringify( jsonRequest ),
				success: function( json ) {
					var thtml = '';
					if ( json[ 'meta' ] ) {
						if ( json[ 'meta' ][ 'code' ] === '200' ) {
							if ( json[ 'result' ][ 'lowestPayment' ].length > 0 ) {
								thtml = json[ 'result' ][ 'lowestPayment' ];
								jQuery( '.financeamount_1' ).html( thtml + ' per month' );
								jQuery( '.financelink_1' ).attr( 'href', 'https://devapply.marlincapitalsolutions.com/auth/EF?partnerid=' + partnerId + '&estimatedEquipmentCost=' + totalCost );
							}
						} else {
							jQuery( '#financeamount_1' ).html( '' + json[ 'meta' ][ 'message' ] );
						}
					}
				} // Success Ends here
			} );
		}
</script>

</div>

Example Buttons

JSON Field Name Required/Optional Format Sample Values
PartnerId Required String 23188714NAHEAA2
totalCost Required String 1000
Sample Request JSON

{
    "PartnerId": "23188714NAHEAA2",
    "totalCost": "1000"
} 

Successful Response 

{
    "meta": {
        "code": "200"
    },
    "result": {
        "lowestPayment": "$24.63",
        "termPeriod": "60 Months"
    }
}

PartnerId Required Error Message

{
    "meta": {
        "code": 400,
        "message": "PartnerId is required"
    }
}

totalCost required Error Message

{
    "meta": {
        "code": 400,
        "message": "totalCost is required"
    }
}

Not a Valid PartnerId Error Message

{
    "meta": {
        "code": 400,
        "message": "Not a valid PartnerId"
    }
}

Generate Quote Error Message:

{
    "meta": {
        "message": "We couldn't generate a quote for you based on this total cost. Please contact us to arrange special financing.",
        "contact": {
            "name": "",
            "email": "",
            "phone": "",
            "extension": ""
        },
        "code": 200
    }
}
HTTP Method POST
Development Environment
URL https://testdevportal.marlincapitalsolutions.com:8077/ws/rest/quotesapi/v1/createQuotesAPI/
Headers
Content Type application/json
x-api-key FROM TEST DEV PORTAL UNDER SUBSCRIPTION
Authorization Basic Auth (username : password) in Base 64 formatting
Username: TEST DEV PORTAL UID
Password: TEST DEVPORTAL PWD
Body
PartnerID Your Partner ID as a string
totalCost The total cost of the equipment as a string
Production Environment
URL https://devportal.marlincapitalsolutions.com:8077/ws/rest/quotesapi/v1/createQuotesAPI/
Headers
Content Type application/json
x-api-key FROM PROD DEV PORTAL UNDER SUBSCRIPTION
Authorization Basic Auth (username : password) in Base 64 formatting
Username: PROD DEV PORTAL UID
Password: PROD DEVPORTAL PWD
Body
PartnerID Your Partner ID as a string
totalCost The total cost of the equipment as a string