Setting it up

To setup a SoftPoint iframe, you need to add our iframe script and an "iframeContent" div, which contains the iframe with all the fields specified in the configuration of the iframe. Note that this "iframeContent" only contains the input fields, so you can design the iframe header, footer, and container as you like.

Setup

Add a <script> block to the <head> block of your webpage.

<head>
...
<script src="[iframe_url]/api/softpoint-pay?location_id=[location_id]&session_key=[$accessToken] "></script>
</head>

Code Example:

<div id="containerIframe" style="padding: 24px 1rem !important;" class="justify-
content-center mt-5 mb-5 col-md-3">
...
<form>
<div id="iframeContent"></div>
<div style="padding-left: 1rem !important; padding-right: 1rem !important;
padding-bottom: 1rem !important;">
<button id="btnSubmit" class="btn btn-primary btn-block free-button">
Custom Submit
</button>
</div>
</form>
...
</div>

Initializing iframe

This section provides detailed information on how to embed an iframe within your webpage and pass parameters dynamically to the content inside the iframe. You can use this to customize the content displayed based on the parameters you send.

❗️

NOTE: AVS (Address Verification Service) is enabled by default. To use it, set the corresponding parameter to 1 as outlined in the table below. If you wish to disable AVS, set the parameter to 0. However, please be aware that you'll also need to coordinate with your payment processor to ensure AVS is disabled on their end.

ParameterDescriptionValue
location_idLocation id provided by SoftPoint
timestampCurrent Unix timestamp -> used for auto-reloadUnix timestamp
process_typeAction to be processed [tokenize, authorize, sale]. Note: tokenize will only tokenize the card, no amount will be processed.[tokenize, authorize, sale]
include-cardholderTurn cardholder field on/off0 or 1 - default = 0
include-streetTurn street field on/off. Required for US and CAN unless disabled at MID level (contact support to make it optional).0 or 1 - default = 1
include-street2Turn street 2 field on/off0 or 1 - default = 0
include-zipTurn zip field on/off. Required for US and CAN unless disabled at MID level (contact support to make it optional).0 or 1 - default = 1
include-cityTurn city field on/off. Required for US and CAN unless disabled at MID level (contact support to make it optional).0 or 1 - default = 1
include-stateTurn state field on/off. Required for US and CAN unless disabled at MID level (contact support to make it optional).0 or 1 - default = 1
include-countryTurn country field on/off. Required for US and CAN unless disabled at MID level (contact support to make it optional).0 or 1 - default = 1
include-emailTurn email field on/off0 or 1 - default = 0
country_isoISO 3166-1 Alpha-2 code. Required for US and CAN unless disabled at MID level (contact support to make it optional).default = US
currency_isoISO 4217 alphabetic code. Ex: USDUSD
session_idUsed for fingerprint (optional)string
payment_methodsArray used to display specific payment methods["credit_card", "google_pay", "apple_pay"]
phone_numberPhone number of the userstring
default_cardholder_nameCardholder name of the userstring
default_emailEmail of the userstring
default_streetStreet of the userstring
default_street_2Street 2 of the userstring
client_urlThe url of your website. Required for Apple Paystring
credit-card-onlyAccept only credit cards. Debit card will be declined.0 or 1 - default = 0
validate-addressVerify that ZIP is valid and belongs to US.0 or 1 - default = 0

Example:

const conf = {
"location_id": [location_id],
"access_token": "[your access token]",
"process_type": 'tokenize',//when process_type is Tokenize, amount will be
ignored
"timestamp": Math.floor(Date.now() / 1000),
"include-cardholder": 1,
"include-street": 1,
"include-street2": 1,
"include-zip": 1,
"country_iso": "US",
"currency_iso": "USD",
“client_url”: “https://your-store.com
}
initPaymentForm('iframeContent', conf);

Submit Action

When the submit button is pressed, call submitPayment javascript function sending the following parameters:


ParameterDescriptionValue
amountAmount of order or shopping cart to be chargedex. 20.10
orderidUnique order id
user_idUnique user idex. 5000
location_idLocation id provided by SoftPointEx: 1000000
domainDomain URL
access_tokenAccess token in "Generate Access Token"
store-cardStore card for later use. Enabled when process_type is tokenize.0 or 1 - default = 0
phone_numberThe user phone numberEx: 7513200000
emailThe user email
orderThe order in array format
market_country_isoISO 3166-1 Alpha-2 codeEx: US, default is country_iso
itemsAn array of items
idUnique item IDEx: 1000
productSKUProduct SKU
nameItem nameEx: Credit
quantityQuantityEx: 1
priceItem priceEx: 10.00
price_currency_isoISO 4217 alphabetic codeEx: USD, default is currency_iso
taxTax amountEx: 1.00
tax_currency_isoISO 4217 alphabetic codeEx: USD, default is currency_iso
tax_typeTax type [Exempt, Inclusive, Exclusive]
discountsArray of discounts
idUnique discount IDEx: 5000
discountCodeDiscount code
discountProgramDiscount program
nameDiscount nameEx: disc
amountDiscount amountEx: 5.00
amount_currency_isoISO 4217 alphabetic codeEx: USD, default is currency_iso

Example:

const form = document.querySelector('form');
form.addEventListener('submit', (event) => {
event.preventDefault();
//Prepare settings
let amount = 10;
const paymentDetails = {
"location_id": [location_id],
"access_token": "[your access token]",
"amount": amount,
"domain": "https://www.domain.com/",
"store-card": 1,
"user_id": "5000",
"order": {
"items": [{
"id": "1000",
"productSKU": "productSKU",
"name": "Credit",
"quantity": 1,
"price": 10.00,
"tax": 1.00,
"phone_number": "[optional]"
}]
}
}
submitPayment(paymentDetails);
});

And the last step is to add the response functions:

function onApprovedCallback(e) {
console.log('onApprovedCallback called', e);
}
function onDeclinedCallback(e) {
console.log('onDeclinedCallback called', e);
}

What’s Next