---
updatedAt: 2026-10-19T16:06:57.000Z
agentTools:
  projectIndex: https://developer.launchpay.com/llms.txt
---

# Hosted iFrame Integration Guide

Integrate a secure, hosted payment iframe into your application powered by **Orchestrate** to accept credit card, Apple Pay, and Google Pay payments. This guide walks you through the full setup process, from generating an access token to handling transaction responses.

### Before You Begin

Make sure you have the following:

* Your API Key
* Your Client ID
* Your Location ID
* Your iframe URL

<br />

***

<br />

# Step 1: Generate an Access Token

<Callout icon="❗️" theme="error">
  **Important**: This API call must be made from your backend server. Never expose your API key or client ID in client-side code.
</Callout>

Your server must request an access token before loading the iframe. This token authenticates the session and is required in all subsequent steps. Use the [Access Token](https://developer.launchpay.com/reference/post_api-locations-location-id-auth) endpoint to generate your token.

<br />

#### Example Request (Node.js)

```node
async function fetchAccessToken() { 
  const url = 'https://sandbox-api-gtw.softpoint.io/locations/' + locationId + '/auth'; 
	
  const params = { 
		api_key: 'your_api_key', 
    client: 'your_client_id' 
  }; 

  const requestOptions = { 
    method: 'POST', 
    headers: { 
      'Content-Type': 'application/json', 
    }, 
    body: JSON.stringify(params),
  }; 

	const response = await fetch(url, requestOptions);
	const data = await response.json();
	return data.accessToken;
}
```

<br />

#### Example Response

The token expires after the duration specified in `expires_in` (in seconds). Generate a new token as needed.

```json
{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6...",
  "expires_in": 3600
}
```

<br />

<br />

# Step 2: Add the iframe Script to Your Page

Include the following `<script>` tag in the `<head>` of your HTML page. This loads the payment form library and authenticates the session using your access token from Step 1.

```html
<script
  src="[IFRAME_URL]/api/softpoint-pay?location_id=[LOCATION_ID]&session_key=[ACCESS_TOKEN]">
</script>
```

<br />

Replace the bracketed values:

| Placeholder      | Value                                |
| :--------------- | :----------------------------------- |
| \[IFRAME\_URL]   | \[PLACEHOLDER: your iframe base URL] |
| \[LOCATION\_ID]  | Your Location ID                     |
| \[ACCESS\_TOKEN] | The access token returned in Step 1  |

<br />

<br />

# Step 3: Add the iframe Container HTML

Add a `<div>`with the ID iframeContent inside a `<form>` element. The iframe library will inject the payment input fields into this div. You control the surrounding layout — header, footer, container styling, and the submit button are all yours to customize.

```html
<div id="containerIframe" class="your-custom-styles">
  <form>
    <!-- Payment fields render here automatically -->
    <div id="iframeContent"></div>

    <!-- Your custom submit button -->
    <div>
      <button id="btnSubmit" class="btn btn-primary" type="submit">
        Pay Now
      </button>
    </div>
  </form>
</div>
```

<br />

<br />

# Step 4: Initialize the Payment Form

Call `initPaymentForm()` to render the payment fields inside the `iframeContent` div. Pass a configuration object to control which fields appear and how the payment is processed.

Configuration Parameters

| Parameter          | Description                                         | Value                                                 |
| :----------------- | :-------------------------------------------------- | :---------------------------------------------------- |
| location\_id       | Location ID                                         |                                                       |
| timestamp          | Current Unix timestamp -> used for<br />auto-reload | unix timestamp                                        |
| process\_type      | Transaction type                                    | tokenize, authorize, sale                             |
| payment\_methods   | Payment methods displayed in the<br />iframe        | “credit\_card”,<br />“apple\_pay”,<br />“google\_pay” |
| include-cardholder | Turn cardholder field on/off                        | 0 or 1 - default = 0                                  |
| include-street     | Turn street field on/of                             | 0 or 1 - default = 0                                  |
| include-street2    | Turn street 2 field on/of                           | 0 or 1 - default = 0                                  |
| include-zip        | Turn zip field on/off                               | 0 or 1 - default = 0                                  |
| include-email      | Turn email field on/of                              | 0 or 1 - default = 0                                  |
| country\_iso       | ISO 3166-1 Alpha-2 code                             | Default = US                                          |
| currency\_iso      | ISO 4217 alphabetic code                            | USD                                                   |

<br />

#### Example

```javascript
const conf = {
  "location_id": YOUR_LOCATION_ID,
  "access_token": "your_access_token",
  "process_type": "tokenize",
  "timestamp": Math.floor(Date.now() / 1000),
  "include-cardholder": 1,
  "include-street": 1,
  "include-street2": 1,
  "include-zip": 1,
  "country_iso": "US",
  "currency_iso": "USD"
};

initPaymentForm('iframeContent', conf);
```

<br />

<br />

# Step 5: Handle Payment Submission

When the user clicks your **Submit** button, call `submitPayment()` with the payment details.

**Submit Parameters**

| Parameter     | Description                                                          | Value                                   |
| :------------ | :------------------------------------------------------------------- | :-------------------------------------- |
| amount        | Amount of order or shopping cart to be charged                       | Example: 20.00                          |
| orderid       | Unique order ID                                                      |                                         |
| user\_id      | Unique user ID                                                       |                                         |
| location\_id  | Location ID                                                          |                                         |
| domain        | Domain URL                                                           |                                         |
| access\_token | Access token                                                         |                                         |
| store-card    | Tokenize card for later use. Enabled when process\_type is tokenize. | 0 or 1 - Default = 0, Tokenize Card = 1 |
| phone\_number | The user phone number                                                | Example: 7513200000                     |
| email         | The user email                                                       |                                         |

<br />

#### Example

```javascript
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);
});
```

<br />

<br />

# Step 6: Handle the Responses

Define the following two callback functions in your page's JavaScript. The iframe calls these automatically after a transaction attempt.

```javascript
function onApprovedCallback(e) {
  // Handle successful transaction
  console.log('Payment approved:', e);
}

function onDeclinedCallback(e) {
  // Handle failed transaction
  console.log('Payment declined:', e);
}
```

<br />

# Support

> Have a question? Contact us on the <Anchor target="_blank" href="https://infinicept.atlassian.net/servicedesk/customer/portal/13">Customer Support Portal</Anchor>.
>
> Learn about updates in our [Changelog](https://developer.launchpay.com/changelog).

<br />

<br />