### Example GET Request for Redirecting to Buy Crypto Source: https://integrations.simplex.com/docs/jwt-redirect-to-buy-crypto This example demonstrates the GET request format to initiate the buy crypto process. It requires partner ID and a JWT token. The JWT token should include user-specific details like wallet address, crypto/fiat currencies, and fiat amount. ```HTTP GET / ?partner= &t= &pyms=credit_card ``` -------------------------------- ### Simplex iFrame URL with Parameters Source: https://integrations.simplex.com/docs/iframe Example of a redirect URL demonstrating how to pass various parameters to the Simplex iFrame. This allows pre-filling fields such as cryptocurrency, fiat currency, amount, wallet address, and a reference ID. ```http https://{your_whitelisted_domain}/?crypto=ETH&fiat=EUR&amount=5000&wallet_address=&ref_id=simplex ``` -------------------------------- ### Get Quote Estimation API Request Example Source: https://integrations.simplex.com/docs/jwt-get-quote-estimation Demonstrates how to make a GET request to the /quote endpoint to retrieve a live quote. This is useful for displaying estimated amounts to users. It requires a partner ID, a JWT, and the payment method. ```HTTP GET /api/quote?partner=&t=&pyms=credit_card ``` -------------------------------- ### Wallet API Integration - Get Quote Source: https://integrations.simplex.com/docs/getting-started The Quote API allows you to retrieve current prices for an order, supporting any supported cryptocurrency, fiat, and payment method. ```APIDOC ## GET /quote ### Description Retrieves current prices for a cryptocurrency, fiat, and payment method combination. ### Method GET ### Endpoint /quote ### Query Parameters - **`crypto_currency`** (string) - Required - The cryptocurrency symbol (e.g., "BTC"). - **`fiat_currency`** (string) - Required - The fiat currency symbol (e.g., "USD"). - **`payment_method`** (string) - Required - The payment method (e.g., "credit_card"). - **`fiat_amount`** (number) - Optional - The amount in fiat currency. - **`crypto_amount`** (number) - Optional - The amount in cryptocurrency. ### Response #### Success Response (200) - **`quote_id`** (string) - Unique identifier for the quote. - **`success`** (boolean) - Indicates if the request was successful. - **`currency_details`** (object) - Details about the currencies involved. - **`crypto_currency`** (string) - The cryptocurrency symbol. - **`fiat_currency`** (string) - The fiat currency symbol. - **`payment_details`** (object) - Details about the payment. - **`fiat_total`** (number) - The total amount in fiat. - **`crypto_total`** (number) - The total amount in cryptocurrency. - **`fees`** (object) - Fee breakdown. - **`fiat_fees`** (number) - Fees in fiat. - **`crypto_fees`** (number) - Fees in cryptocurrency. #### Response Example ```json { "quote_id": "q_abc123", "success": true, "currency_details": { "crypto_currency": "BTC", "fiat_currency": "USD" }, "payment_details": { "fiat_total": 100.00, "crypto_total": 0.0025, "fees": { "fiat_fees": 2.50, "crypto_fees": 0.0001 } } } ``` ``` -------------------------------- ### Get Quote Estimation JWT Payload Example Source: https://integrations.simplex.com/docs/jwt-get-quote-estimation Provides an example JSON structure for the 't' parameter (JWT) used in the Get Quote estimation API request. This payload includes details like timestamp, amounts, currencies, user ID, and client IP. ```JSON { "timestamp": 1539064222, "sourceAmount": 120, "sourceCurrency": "USD", "targetCurrency": "BTC", "endUserID": "b175257e-1f30-49cc-84b7-0a7c8abc4526", "clientIP": "35.194.68.120" } ``` -------------------------------- ### Reporting API - Get Payments Source: https://integrations.simplex.com/docs/getting-started This endpoint enables you to retrieve your transaction data, sorted with the latest transactions first and supports paging. ```APIDOC ## GET /payments ### Description Retrieves transaction data with sorting and pagination support. ### Method GET ### Endpoint /payments ### Query Parameters - **`limit`** (integer) - Optional - Number of transactions per page. - **`offset`** (integer) - Optional - Number of transactions to skip. - **`from_date`** (string) - Optional - Filter transactions from a specific date (YYYY-MM-DD). - **`to_date`** (string) - Optional - Filter transactions to a specific date (YYYY-MM-DD). ### Response #### Success Response (200) - **`payments`** (array of objects) - List of transactions. - **`transaction_id`** (string) - Unique transaction identifier. - **`status`** (string) - Status of the transaction. - **`amount`** (number) - Transaction amount. - **`currency`** (string) - Transaction currency. - **`timestamp`** (string) - Transaction timestamp. - **`total_count`** (integer) - Total number of transactions matching the criteria. #### Response Example ```json { "payments": [ { "transaction_id": "txn_ghi789", "status": "completed", "amount": 100.00, "currency": "USD", "timestamp": "2023-10-26T12:00:00Z" } ], "total_count": 50 } ``` ``` -------------------------------- ### Get Supported Cryptocurrencies using NodeJS and Axios Source: https://integrations.simplex.com/docs/step-3-first-api-call This snippet demonstrates how to call the Simplex API to get a list of supported cryptocurrencies. It uses the axios library for making the HTTP GET request and includes basic error handling for invalid public keys. The function returns a Promise that resolves with the data or rejects with an error. ```javascript const axios = require("axios"); const simplexDomain = "https://sandbox.test-simplexcc.com/v2/supported_crypto_currencies"; const publicKey = "pk_test_0c3e2ecd-1546-4068-ae01-d49382e1266a"; function getSupportedCryptoCurrencies({ publicKey }) { return new Promise((resolve, reject) => { axios .get(simplexDomain, { params: { public_key: publicKey } }) .then(({ data }) => { resolve(data); }) .catch((error) => { const responseError = error.response.data; if (responseError && responseError.error === "invalid public key") { return reject("wrong public key"); } reject(error); }); }); } getSupportedCryptoCurrencies({ publicKey }).then((data)=>{ console.log("The result succeeded!",data) }).catch((error) => { console.error(error); }) ``` -------------------------------- ### Run Simplex API Collection in Postman Source: https://integrations.simplex.com/docs/step-2-postman This HTML snippet provides a button to directly import and run the Simplex API collection in Postman. It includes basic styling for the button and form element. No external dependencies are required, as it relies on Postman's web interface. ```html
``` -------------------------------- ### GET / - Redirect to Buy Crypto Source: https://integrations.simplex.com/docs/jwt-redirect-to-buy-crypto Initiates the cryptocurrency purchase flow by redirecting the user. This endpoint should be called after a quote has been confirmed. It requires a JWT token containing user and transaction details. ```APIDOC ## GET / ### Description Redirects the user to the Simplex buy crypto interface after they confirm a quote. This endpoint requires a JWT token containing necessary transaction details. ### Method GET ### Endpoint / ### Query Parameters - **partner** (string) - Required - Your partner ID. - **t** (string) - Required - The JWT token containing user and transaction details. - **pyms** (string) - Optional - Payment method (e.g., `credit_card`). ### Request Example `GET /?partner=&t=&pyms=credit_card` ### Request Body N/A (GET request) ### Response #### Success Response (302 Found) Redirects the user to the Simplex payment page. #### Response Example N/A (Redirection) ### JWT Payload Example ```json { "timestamp": 1531916946, "endUserID": "b175257e-1f30-49cc-84b7-0a7c8abc4526", "cryptoAddress": "3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy", "cryptoCurrency": "BTC", "fiatCurrency": "USD", "fiatAmount": 120 } ``` ``` -------------------------------- ### Simplex Reporting API - Get Payments Source: https://integrations.simplex.com/docs/index Enables retrieval of transaction data, with the latest transactions listed first and support for paging. ```APIDOC ## GET /payments ### Description Retrieves a list of your transactions data, sorted by the latest transactions first. ### Method GET ### Endpoint /payments ### Parameters #### Query Parameters - **partner_id** (string) - Required - Your unique partner identifier. - **limit** (integer) - Optional - The maximum number of transactions to return per page (default: 50). - **offset** (integer) - Optional - The number of transactions to skip for pagination (default: 0). - **start_date** (string) - Optional - Filter transactions starting from this date (YYYY-MM-DD). - **end_date** (string) - Optional - Filter transactions up to this date (YYYY-MM-DD). ### Request Example ``` GET /payments?partner_id=YOUR_PARTNER_ID&limit=10&offset=20 ``` ### Response #### Success Response (200) - **total_count** (integer) - The total number of transactions available. - **limit** (integer) - The limit applied for this request. - **offset** (integer) - The offset applied for this request. - **payments** (array) - A list of transaction objects. - **transaction_id** (string) - Unique identifier for the transaction. - **partner_transaction_id** (string) - Your unique identifier for the transaction. - **status** (string) - The status of the transaction (e.g., "completed", "failed", "pending"). - **amount_details** (object) - Details about the amounts. - **fiat_total_amount** (number) - The total amount in fiat currency. - **fiat_currency** (string) - The fiat currency code. - **crypto_amount** (number) - The amount of cryptocurrency. - **crypto_currency** (string) - The cryptocurrency code. - **timestamp** (string) - The timestamp when the transaction was created. #### Response Example ```json { "total_count": 150, "limit": 10, "offset": 20, "payments": [ { "transaction_id": "TRANSACTION_ID_1", "partner_transaction_id": "PARTNER_TX_ID_1", "status": "completed", "amount_details": { "fiat_total_amount": 100.50, "fiat_currency": "USD", "crypto_amount": 0.00025, "crypto_currency": "BTC" }, "timestamp": "2023-10-26T15:00:00Z" } ] } ``` ``` -------------------------------- ### GET /quote Source: https://integrations.simplex.com/docs/jwt-get-quote-estimation Retrieves current rate quotes for fiat/crypto pairs. This endpoint is optional and can be used to display an estimation of the amount a user would receive. ```APIDOC ## GET /quote ### Description Retrieves current rate quotes for fiat/crypto pairs. This endpoint is optional and can be used to display an estimation of the amount a user would receive. ### Method GET ### Endpoint /quote ### Parameters #### Query Parameters - **partner** (string) - Required - Your partner ID. - **t** (object) - Required - JWT token containing transaction details. See example below. - **pyms** (string) - Optional - Payment method, e.g., `credit_card`. ### Request Example ``` GET /api/quote?partner=&t=&pyms=credit_card ``` ### Response #### Success Response (200) - **sourceAmount** (number) - The estimated amount in the source currency. - **sourceCurrency** (string) - The currency of the source amount (e.g., USD). - **targetCurrency** (string) - The currency of the target amount (e.g., BTC). - **quoteId** (string) - A unique identifier for the quote. #### Response Example ```json { "sourceAmount": 100, "sourceCurrency": "USD", "targetCurrency": "BTC", "quoteId": "q_123abc456" } ``` ### JWT Token (t) Example ```json { "timestamp": 1539064222, "sourceAmount": 120, "sourceCurrency": "USD", "targetCurrency": "BTC", "endUserID": "b175257e-1f30-49cc-84b7-0a7c8abc4526", "clientIP": "35.194.68.120" } ``` ``` -------------------------------- ### Simplex Wallet API - Get Quote Source: https://integrations.simplex.com/docs/index The Quote API allows you to retrieve current prices for an order, supporting any supported cryptocurrency, fiat, and payment method. ```APIDOC ## POST /quote ### Description Retrieves current prices for a cryptocurrency order based on specified fiat and payment method. ### Method POST ### Endpoint /quote ### Parameters #### Request Body - **partner_id** (string) - Required - Your unique partner identifier. - **partner_transaction_id** (string) - Required - A unique identifier for the transaction from your system. - **order_id** (string) - Required - A unique identifier for the quote request. - **fiat_currency** (string) - Required - The fiat currency for the transaction (e.g., "USD", "EUR"). - **crypto_currency** (string) - Required - The cryptocurrency for the transaction (e.g., "BTC", "ETH"). - **payment_method** (object) - Required - Details about the payment method. - **type** (string) - Required - The type of payment method (e.g., "credit_card", "apple_pay"). - **installments** (integer) - Optional - Number of installments for credit card payments. - **return_url** (string) - Required - The URL to redirect the user to after the transaction. - **requested_digital_currency** (string) - Optional - The specific digital currency to purchase (if different from crypto_currency). - **wallet_id** (string) - Optional - The user's wallet ID. - **user_id** (string) - Optional - The user's identifier. ### Request Example ```json { "partner_id": "YOUR_PARTNER_ID", "partner_transaction_id": "YOUR_TRANSACTION_ID", "order_id": "YOUR_ORDER_ID", "fiat_currency": "USD", "crypto_currency": "BTC", "payment_method": { "type": "credit_card" }, "return_url": "https://your-website.com/return" } ``` ### Response #### Success Response (200) - **quote_id** (string) - Unique identifier for the quote. - **amount** (object) - The amount details for the transaction. - **total** (number) - The total amount including fees. - **crypto** (number) - The amount of cryptocurrency to be received. - **fees** (object) - Fee details. - **ச்சி** (number) - Simplex fee. - **ச்சி_percent** (number) - Simplex fee percentage. - **ச்சி_fixed** (number) - Simplex fixed fee. - **ச்சி** (number) - Network fee. - **ச்சி_percent** (number) - Network fee percentage. - **ச்சி_fixed** (number) - Network fee fixed amount. - **price** (number) - The price of the cryptocurrency per unit. - **agreement_id** (string) - Identifier for the user agreement. - **payment_methods** (array) - List of available payment methods for this quote. #### Response Example ```json { "quote_id": "QUOTE_ID", "amount": { "total": 100.50, "crypto": 0.00025, "fees": { "ச்சி": 5.00, "ச்சி_percent": 5.0, "ச்சி_fixed": 0.50, "ச்சி": 1.00, "ச்சி_percent": 0.1, "ச்சி_fixed": 0.01 } }, "price": 40200.00, "agreement_id": "AGREEMENT_ID", "payment_methods": [ { "type": "credit_card", "installments": [1, 3, 6] } ] } ``` ``` -------------------------------- ### Example JWT Payload for Buy Crypto Redirect Source: https://integrations.simplex.com/docs/jwt-redirect-to-buy-crypto This JSON structure represents the payload for the JWT token used in the buy crypto redirect. It includes essential details such as a timestamp, user ID, crypto address, preferred cryptocurrencies, fiat currencies, and the fiat amount. ```JSON { "timestamp": 1531916946, "endUserID": "b175257e-1f30-49cc-84b7-0a7c8abc4526", "cryptoAddress": "3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy", "cryptoCurrency": "BTC", "fiatCurrency": "USD", "fiatAmount": 120 } ``` -------------------------------- ### Generate JWT Token with JavaScript Source: https://integrations.simplex.com/docs/jwt-client-integration-tutorial This snippet demonstrates how to generate a JWT token for Simplex API requests using JavaScript. It includes creating a payload with transaction details, setting the JWT header, and signing the token with an API secret key. Ensure you have a JWT library like jwt.io installed. ```javascript const quotePayload = { "timestamp": 1539064222, "sourceAmount": 100, "sourceCurrency": "USD", "targetCurrency": "BTC", "endUserID": "b175257e-1f30-49cc-84b7-0a7c8abc4526", "clientIP": "35.194.68.120" }; const header = { alg: 'HS256', typ: 'JWT' }; const token = jwt.sign(quotePayload, API_SECRET_KEY); ``` -------------------------------- ### Create Payment Request using NodeJS and Axios Source: https://integrations.simplex.com/docs/step-5-create-payment-request This code snippet demonstrates how to create a payment request to Simplex using NodeJS and the Axios library. It requires an API key and quote ID as inputs and returns the transaction details or an error. Ensure you have 'axios' and 'crypto' modules installed. ```javascript const axios = require("axios"); const crypto = require('crypto'); const simplexURL = "https://sandbox.test-simplexcc.com/wallet/merchant/v2/payments/partner/data"; const APIKey = "INSERT_API_KEY"; const quoteId = 'INSERT_QUOTE_ID'; const walletName = 'wallex'; const uniquePaymentId = crypto.randomUUID(); paymentRequest(APIKey,{quoteId,walletName,uniquePaymentId}) .then((data) => { console.log("The result succeeded!", data); console.log("The transaction which was created is ",uniquePaymentId) }) .catch((error) => { console.error(error); }); function paymentRequest(APIKey, { quoteId, walletName, uniquePaymentId }) { const data = { account_details: { app_provider_id: walletName, app_version_id: "1.3.1", app_end_user_id: "11b111d1-161e-32d9-6bda-8dd2b5c8af17", app_install_date: "2018-01-03T15:23:12Z", email: "example.cohen@simplex.com", phone: "+972509123456", verified_details: ["email", "phone"], signup_login: { ip: "212.179.111.110", location: "36.848460,-174.763332", uaid: "IBAnKPg1bdxRiT6EDkIgo24Ri8akYQpsITRKIueg+3XjxWqZlmXin7YJtQzuY4K73PWTZOvmuhIHu + ee8m4Cs4WLEqd2SvQS9jW59pMDcYu + Tpl16U / Ss3SrcFKnriEn4VUVKG9QnpAJGYB3JUAPx1y7PbAugNoC8LX0Daqg66E = ", accept_language: "de,en-US;q=0.7,en;q=0.3", http_accept_language: "de,en-US;q=0.7,en;q=0.3", user_agent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0", cookie_session_id: "7r7rz_VfGC_viXTp5XPh5Bm--rWM6RyU", timestamp: "2021-08-03T08:18:53.200Z", }, }, transaction_details: { payment_details: { quote_id: quoteId, payment_id: uniquePaymentId, order_id: "48382395-f584-4a63-a3f7-f7b2f25c3a23", destination_wallet: { currency: "BTC", address: "1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2", tag: "", }, original_http_ref_url: "https://www.partner.com/", }, }, }; return new Promise((resolve, reject) => { axios .post(simplexURL, data, { headers: { Authorization: "APIKey " + APIKey, }, }) .then(({ data }) => { resolve(data); }) .catch((error) => { const responseStatus = error.response.status; if (responseStatus && responseStatus === 401) { return reject("Wrong ApiKey"); } //reject(error); console.log(error.response.data) }); }); } ``` -------------------------------- ### Payment Status: payment_request_submitted Source: https://integrations.simplex.com/docs/payment-events Indicates that a payment has been successfully submitted by the user after completing the checkout process. This event signifies the start of the payment flow, but the payment is not yet finalized. ```text payment_request_submitted ``` -------------------------------- ### Wallet API Integration - Create Checkout Source: https://integrations.simplex.com/docs/getting-started Initializes the checkout process, which can be implemented as a new window redirect or a widget pop-up. ```APIDOC ## POST /checkout ### Description Initializes the checkout process for a transaction. ### Method POST ### Endpoint /checkout ### Parameters #### Request Body - **`transaction_id`** (string) - Required - The ID of the transaction obtained from the Initiate Payment API. - **`integration_method`** (string) - Required - Either "new_window" or "widget". ### Request Example ```json { "transaction_id": "txn_def456", "integration_method": "widget" } ``` ### Response #### Success Response (200) - **`checkout_url`** (string) - The URL for the checkout process. #### Response Example ```json { "checkout_url": "https://checkout.simplexcc.com/widget?token=..." } ``` ``` -------------------------------- ### iFrame Checkout in New Window (Sandbox) Source: https://integrations.simplex.com/docs/iframe This snippet demonstrates how to load the Simplex quote form and initiate checkout in a new window using the Sandbox environment. It includes basic CSS for styling the continue button and loads the necessary JavaScript from Simplex's Sandbox domain. ```html
``` -------------------------------- ### Simplex Wallet API - Create Checkout Source: https://integrations.simplex.com/docs/index Initializes the checkout process, which can be done via a new window redirect or a pop-up widget. ```APIDOC ## POST /create-checkout ### Description Creates a checkout session for a transaction, allowing users to complete the payment. ### Method POST ### Endpoint /create-checkout ### Parameters #### Request Body - **transaction_id** (string) - Required - The ID of the transaction obtained from the Initiate Payment API. - **checkout_type** (string) - Required - The type of checkout: "new_window" or "widget". - **return_url** (string) - Required - The URL to redirect the user to after checkout completion. ### Request Example ```json { "transaction_id": "TRANSACTION_ID", "checkout_type": "widget", "return_url": "https://your-website.com/checkout-complete" } ``` ### Response #### Success Response (200) - **checkout_url** (string) - The URL for the checkout session. - **payment_status** (string) - The status of the payment. #### Response Example ```json { "checkout_url": "https://checkout.simplexcc.com/pay?token=...", "payment_status": "pending_checkout" } ``` ``` -------------------------------- ### General APIs - Supported Currencies and Countries Source: https://integrations.simplex.com/docs/getting-started Retrieve information about supported fiat currencies, cryptocurrencies, and countries available to your customers. ```APIDOC ## GET /supported/fiat_currencies ### Description Retrieves a list of supported fiat currencies. ### Method GET ### Endpoint /supported/fiat_currencies ### Response #### Success Response (200) - **`currencies`** (array of strings) - e.g., ["USD", "EUR"] ## GET /supported/crypto_currencies ### Description Retrieves a list of supported cryptocurrencies. ### Method GET ### Endpoint /supported/crypto_currencies ### Response #### Success Response (200) - **`currencies`** (array of strings) - e.g., ["BTC", "ETH"] ## GET /supported/countries ### Description Retrieves a list of supported countries. ### Method GET ### Endpoint /supported/countries ### Response #### Success Response (200) - **`countries`** (array of objects) - Each object contains country code and name. - **`code`** (string) - e.g., "US" - **`name`** (string) - e.g., "United States" ``` -------------------------------- ### iFrame Checkout as Widget (Production) Source: https://integrations.simplex.com/docs/iframe This snippet integrates the Simplex checkout as an in-page widget in the Production environment. It includes the necessary initialization script with a partner public key, the Simplex SDK, and the form-sdk JavaScript, along with the checkout SDK. ```html
``` -------------------------------- ### iFrame Checkout as Widget (Sandbox) Source: https://integrations.simplex.com/docs/iframe This code snippet configures the Simplex checkout to appear as a widget within the same page for the Sandbox environment. It requires a partner public key for initialization and loads the SDK and form-sdk JavaScript files. ```html
``` -------------------------------- ### Wallet API Integration - Initiate Payment Source: https://integrations.simplex.com/docs/getting-started The Payment API allows you to share user and transaction data before reaching the payment checkout stage. This step always follows the Quote API. ```APIDOC ## POST /payment ### Description Initiates a payment transaction using details obtained from the Quote API. ### Method POST ### Endpoint /payment ### Parameters #### Request Body - **`quote_id`** (string) - Required - The ID obtained from the Get Quote API. - **`user_id`** (string) - Required - Your internal user identifier. - **`return_url`** (string) - Required - The URL to redirect the user to after payment completion. - **`client_ip_address`** (string) - Required - The IP address of the client. - **`payment_method`** (object) - Required - Details about the payment method. - **`type`** (string) - e.g., "credit_card" - **`card_details`** (object) - Required if type is "credit_card". - **`card_number`** (string) - **`expiry_month`** (string) - **`expiry_year`** (string) - **`cvv`** (string) - **`cardholder_name`** (string) - **`billing_address`** (object) - **`street`** (string) - **`city`** (string) - **`zip`** (string) - **`country`** (string) - **`state`** (string) - Optional ### Request Example ```json { "quote_id": "q_abc123", "user_id": "user_xyz789", "return_url": "https://yourwebsite.com/payment_success", "client_ip_address": "192.168.1.1", "payment_method": { "type": "credit_card", "card_details": { "card_number": "4111111111111111", "expiry_month": "12", "expiry_year": "2025", "cvv": "123", "cardholder_name": "John Doe", "billing_address": { "street": "123 Main St", "city": "Anytown", "zip": "12345", "country": "USA", "state": "CA" } } } } ``` ### Response #### Success Response (200) - **`transaction_id`** (string) - Unique identifier for the transaction. - **`payment_status`** (string) - e.g., "pending_authorization" - **`redirect_url`** (string) - URL for the user to complete the payment. #### Response Example ```json { "transaction_id": "txn_def456", "payment_status": "pending_authorization", "redirect_url": "https://checkout.simplexcc.com/pay?token=..." } ``` ``` -------------------------------- ### Add Simplex SDK to Webpage (Sandbox) Source: https://integrations.simplex.com/docs/widget-1 Include the Simplex JavaScript SDK in the head section of your HTML page for sandbox environments. This initializes the SDK with your partner public key. ```html ``` -------------------------------- ### URL Parameters for Simplex Integration Source: https://integrations.simplex.com/docs/iframe Simplex supports URL parameters to pass data directly into the iFrame, allowing pre-filling of fields such as default crypto-fiat pairs, purchase amounts, and user wallet addresses. ```APIDOC ## Available URL Parameters Simplex supports inserting URL parameters into your URL to pass data in to the iFrame. For example you can pass the default crypto-fiat pair to display and the default amount to purchase as well as as the users wallet address (if you have it). The parameters are made of a key and a value separated by an equals sign (=) and joined by an ampersand (&). The first parameter always comes after a question mark in a URL. ### Parameters #### Query Parameters - **crypto** (string) - Optional - The initial cryptocurrency selection option from the dropdown we will present to the end-user on load of the iFrame. - **fiat** (string) - Optional - The initial fiat currency selection from the dropdown we will present to the end-user on load. Must be used together with the amount parameter. - **amount** (number) - Optional - The amount of fiat money that will be presented to the end-users once they quote form is loaded. - **wallet_address** (string) - Optional - The wallet address field will be prefilled on load. Requires integration team to approve and enable using the feature. - **tag** (string) - Optional - The wallet address tag/memo will be prefilled if required. - **ref_id** (string) - Optional - A parameter for tracking reference to the iFrame page. It allows to get tracking information and optimize your campaigns or business profitability accordingly. The reference ID can be either a number, integer or a mix of both and it is limited for 100 characters. ### Request Example ```http https://{your_whitelisted_domain}/?crypto=ETH&fiat=EUR&amount=5000&wallet_address=&ref_id=simplex ``` ``` -------------------------------- ### Add Simplex SDK to Webpage (Production) Source: https://integrations.simplex.com/docs/widget-1 Include the Simplex JavaScript SDK in the head section of your HTML page for production environments. This initializes the SDK with your partner public key. ```html ``` -------------------------------- ### Wallet API Integration - Events Source: https://integrations.simplex.com/docs/getting-started Allows you to follow the status of a transaction (submitted, approved, or declined) by polling an events queue. ```APIDOC ## GET /events ### Description Retrieves transaction status events from the queue. You must delete events after processing. ### Method GET ### Endpoint /events ### Query Parameters - **`limit`** (integer) - Optional - The maximum number of events to retrieve. ### Response #### Success Response (200) - **`events`** (array) - An array of event objects. - **`event_id`** (string) - Unique identifier for the event. - **`transaction_id`** (string) - The ID of the associated transaction. - **`status`** (string) - The status of the transaction (e.g., "payment_completed", "payment_failed"). - **`timestamp`** (string) - The time the event occurred. #### Response Example ```json { "events": [ { "event_id": "evt_ghi789", "transaction_id": "txn_def456", "status": "payment_completed", "timestamp": "2023-10-27T10:00:00Z" } ] } ``` ## DELETE /events/{eventId} ### Description Deletes a processed event from the queue. ### Method DELETE ### Endpoint /events/{eventId} ### Parameters #### Path Parameters - **`eventId`** (string) - Required - The ID of the event to delete. ### Response #### Success Response (204) No content is returned upon successful deletion. ``` -------------------------------- ### iFrame Checkout in New Window (Production) Source: https://integrations.simplex.com/docs/iframe This snippet shows how to integrate the Simplex quote form for checkout in a new window using the Production environment. It requires including the Simplex iFrame JavaScript and the checkout SDK, with a simple script to initiate the form. ```html
``` -------------------------------- ### Simplex Wallet API - Initiate Payment Source: https://integrations.simplex.com/docs/index The Payment API allows you to share user and transaction data before the user reaches the payment checkout stage. This step always follows the Quote API. ```APIDOC ## POST /initiate-payment ### Description Initiates a payment transaction using the details obtained from the Quote API. ### Method POST ### Endpoint /initiate-payment ### Parameters #### Request Body - **quote_id** (string) - Required - The ID of the quote obtained from the Get Quote API. - **identifier** (string) - Required - The user's identifier (e.g., email address, user ID). - **partner_transaction_id** (string) - Required - A unique identifier for the transaction from your system. - **return_url** (string) - Required - The URL to redirect the user to after completing the payment. - **payment_details** (object) - Required - Details specific to the payment method. - **card_number** (string) - Required for credit card - The card number. - **expiry_month** (string) - Required for credit card - The expiry month (MM). - **expiry_year** (string) - Required for credit card - The expiry year (YYYY). - **cvv** (string) - Required for credit card - The CVV code. - **card_holder_name** (string) - Required for credit card - The name of the cardholder. - **billing_address** (object) - Required for credit card - The billing address details. - **city** (string) - Required - The city. - **address_line_1** (string) - Required - The first line of the address. - **zip** (string) - Required - The postal code. - **country** (string) - Required - The country code (ISO 3166-1 alpha-2). - **apple_pay_token** (string) - Required for Apple Pay - The Apple Pay token. - **additional_data** (object) - Optional - Additional data to be included in the transaction. - **user_id** (string) - Optional - The user's internal ID. - **device_id** (string) - Optional - The device identifier. - **ip_address** (string) - Optional - The user's IP address. ### Request Example ```json { "quote_id": "QUOTE_ID", "identifier": "user@example.com", "partner_transaction_id": "YOUR_TRANSACTION_ID", "return_url": "https://your-website.com/success", "payment_details": { "type": "credit_card", "card_number": "4111111111111111", "expiry_month": "12", "expiry_year": "2025", "cvv": "123", "card_holder_name": "John Doe", "billing_address": { "city": "New York", "address_line_1": "123 Main St", "zip": "10001", "country": "US" } } } ``` ### Response #### Success Response (200) - **transaction_id** (string) - Unique identifier for the initiated transaction. - **payment_status** (string) - The status of the payment (e.g., "pending_authorization", "completed"). - **redirect_url** (string) - URL to redirect the user for payment completion (if applicable). #### Response Example ```json { "transaction_id": "TRANSACTION_ID", "payment_status": "pending_authorization", "redirect_url": "https://checkout.simplexcc.com/pay?token=..." } ``` ```