Process payments quickly and easily
Open Speed Function
The openSpeed
function allows you to make payments in a simple and fast way.
Parameters
The openSpeed
has two parameters:
Data Parameter (required)
Speed Matic requires some data about the transaction to be made.
Property | Description | Type | Default |
---|---|---|---|
merchant_id | Required Allows you to identify the merchant that will receive the payments; to obtain the merchant_id you need to create a new merchant or use an existing one. | String | |
total | Required Corresponds to the amount of the transaction. | Float | |
apply_cfee | Required Indicates whether or not the total includes the amount corresponding to the convenience fee. | Boolean | False |
merchant_gateway_id | Indicates the gateway through which the transaction is to be processed (manual routing), the gateway must be previously created and associated to the merchant. | String | |
sec_code | Required for ACH transactions Are used to identity the NACHA payment type (standard entry class). The SEC options to choose from are (WEB, PPD, TEL or CCD) The value depends on the Payment Type. | String | |
create_third_party_token | Indicates if you want to generate a token of the payment method being used in the transaction being processed that can be used directly in a gateway without the need for this gateway to be integrated with Matic. | Boolean | False |
trans_metatada | This is needed so they can data store it in our system so later in any listing or data retrieval, they can have their metadata there able to identity and map any of their record to them. | Object | |
require_terms_and_conditions | Indicates that the transaction requires, in order to be executed, the acceptance of terms and conditions previously established by the merchant. | Boolean | False |
show_powered | Allows to display the "Powered by Matic" footer. | Boolean | False |
invoice_number | An optional invoice number. | String | |
items | JSON array of objects of transaction products.title: String description: String quantity: integer unit_price: number | Object | [ ] |
Example data:
{
merchant_id: '5d20342d-7585-4e4d-90c7-afe7cdae8407',
total: "2.00",
apply_cfee: true,
merchant_gateway_id: '5d20342d-7585-4e4d-90c7-afe7cdae8407',
show_powered: true,
invoice_number: "1",
items: [
{
title: "Title",
description: "Description",
quantity: 2,
unit_price: "1.00",
},
]
}
Second Parameter (optional)
To provide a faster and easier way to the customer when filling out the form to add a credit/debit card, we choose to use the second parameter, is an object that has the properties customer_email
and billing_address
with which the inputs will be pre-filled with this information in the form.
Property | Description | Type |
---|---|---|
customer_email | Email indicated by the customer. | String |
billing_address | This object contains the following properties and types:address1: String address2: String city: String state: String (e.g. "AL", "AB") see reference zip_code: String country: String (e.g "US", "CA") see reference | Object |
Example usage:
import MaticSDK from '@matic.co/sdk'
const Sdk = MaticSDK('your sdk key');
//you can find the sdk_key on the get companies endpoint using the consumer secret and consumer key with authBasic
const data = {
merchant_id: '5d20342d-7585-4e4d-90c7-afe7cdae8407',
total: "2.00",
apply_cfee: true,
merchant_gateway_id: '5d20342d-7585-4e4d-90c7-afe7cdae8407',
show_powered: true,
invoice_number: "1",
items: [
{
title: "Title",
description: "Description",
quantity: 2,
unit_price: "1.00",
},
]
}
// open Speed Matic
Sdk.openSpeed(data)
if (window.MaticSDK) {
// Initilalize instance
const SDK = window.MaticSDK('your sdk key');
const data = {
merchant_id: '5d20342d-7585-4e4d-90c7-afe7cdae8407',
total: 100,
apply_cfee: true,
cfee_included: false,
merchant_gateway_id: '5d20342d-7585-4e4d-90c7-afe7cdae8407',
show_powered: true,
invoice_number: "1",
items: [
{
title: "Title",
description: "Description",
quantity: 2,
unit_price: "1.00",
},
]
}
// open Speed Matic
SDK.openSpeed(data)
}
Once you call the method, if the checkout data (items and invoice_number) isn't exists then the Speed Matic will be opened as the image below:

Speed Matic opened once the openSpeed method is called.
Once you call the method, if the checkout data (items and invoice_number) exists then the Speed Matic will be opened as the image below:

Speed Matic with information from Matic Checkout
Speed Matic Events
Once you open the Speed Matic, you may want to know the status of transactions. To that end, you can use the MaticSDK events. You can listen to matic events with the on
function
Example
import MaticSDK from '@matic.co/sdk'
const onSuccess = (data) => {
// Your custom code
}
const onError = (data) => {
// Your custom code
}
MaticSDK.on('success', onSuccess)
MaticSDK.on('error', onError)
if (window.MaticSDK) {
const onSuccess = (data) => {
// Your custom code
}
const onError = (data) => {
// Your custom code
}
window.MaticSDK.on('success', onSuccess)
window.MaticSDK.on('error', onError)
}
Success Events
To receive information about successful transactions, you can listen to success events
Success event listeners will receive an object with the transaction data
Example of a card transaction
{
"status": "success",
"data": {
"payment_method_id": "8c2a5370-650e-4d57-93a9-5ac2682fbfcd",
"transaction": {
"amount": "100.00",
"apply_cfee": true,
"auth_code": "877433",
"billing_address": {
"address1": "Test",
"address2": "",
"city": "Phoenix",
"country": "US",
"state": "AZ",
"zip_code": "12345"
},
"card": {
"bank_name": "Unknown",
"card_brand": "visa",
"card_type": "credit",
"cardholder": "John Doe",
"expiration_month": 6,
"expiration_year": 2024,
"fingerprint": "e3cef43464fc832f6e04f187df25af497994",
"first_six_digits": "411111",
"id": "8c2a5370-650e-4d57-93a9-5ac2682fbfcd",
"issuer_identification_number": "41111111",
"last_four_digits": "1111",
"number": "4111-11**-****-1111",
"token": "7KfF4YbxYVuRTdd84fGqI2tNJ4k"
},
"card_id": "8c2a5370-650e-4d57-93a9-5ac2682fbfcd",
"cfee_total": "0.01",
"cfee_type": "amount",
"cfee_value": "0.01",
"company_id": "b50f7289-e37f-4da1-b935-354879b253b3",
"create_third_party_token": false,
"created_at": "2023-06-15T14:09:40.366827",
"customer_email": "[email protected]",
"customer_id": null,
"gateway_id": null,
"gateway_transaction_id": "3159029464",
"id": "1da7c40d-1b82-40ce-88eb-679cfaef7a9d",
"invoice": null,
"merchant_gateway_id": "b0287b04-8c80-482a-a9fb-eda048935651",
"merchant_id": "2e4e0f08-023e-42d9-a1ac-1f5f21ef676e",
"message": "Transaction processed successfully",
"method_type": "credit_card",
"note": null,
"status": "succeeded",
"subscription_id": null,
"subscription_settings": null,
"subscription_status": null,
"succeeded": true,
"terms_accepted": true,
"third_party_token": null,
"total_charged": "100.01",
"trans_metadata": null,
"updated_at": "2023-06-15T14:09:40.367606"
}
}
}
Example of a ACH transaction
{
"status": "success",
"data": {
"payment_method_id": "7ce75d3f-31a7-401b-ad6a-f51addd53fc1",
"transaction": {
"ach_type": "debit",
"amount": "100.00",
"apply_cfee": true,
"bank_account": {
"account_holder_type": "personal",
"account_number": "******1010",
"account_type": "savings",
"accountholder": "John Doe",
"bank_name": "Unknown",
"id": "7ce75d3f-31a7-401b-ad6a-f51addd53fc1",
"routing_number": "053******"
},
"bank_account_id": "7ce75d3f-31a7-401b-ad6a-f51addd53fc1",
"cfee_total": "0.01",
"cfee_type": "amount",
"cfee_value": "0.01",
"company_id": "b50f7289-e37f-4da1-b935-354879b253b3",
"created_at": "2023-06-15T16:18:13.889664",
"customer_email": null,
"customer_id": null,
"gateway_transaction_id": "32707",
"id": "2c00624a-e49f-490e-b2ea-8d7d9c2aa3e0",
"invoice": {
"id": null,
"items": [],
"number": "123"
},
"merchant_gateway_id": "0d6a1ca2-904d-40b7-b79b-a316b8b50bfd",
"merchant_id": "2e4e0f08-023e-42d9-a1ac-1f5f21ef676e",
"message": "Transaction processed successfully",
"method_type": "bank_account",
"note": null,
"sec_code": "WEB",
"status": "pending",
"subscription_id": null,
"subscription_settings": null,
"subscription_status": null,
"succeeded": true,
"terms_accepted": true,
"total_charged": "100.01",
"trans_metadata": null,
"updated_at": "2023-06-15T16:18:14.011260"
}
}
}
Error Events
In case the authentication process fails, it will emit an error event
Error event listeners will receive an object with the error data
Example
{
"status": "failed",
"errors": [
{
"code": 1,
"message": "The bank routing number is not a valid U.S. or Canadian routing. Please verify the routing number or try another payment method. - Error (0009)"
}
]
}