Synswi
  1. Payment instruments
Synswi
  • Guides
    • Getting Started With the API
  • API Reference
    • Accounts
      • Onboarding forms
        • Create a Onboarding Form
      • Get account setting
      • Update account setting
      • Get profile
      • Create new profile
      • Register webhook
    • Devices
      • Get Devices
    • Dispute
      • Get disputes
    • Invoice
      • Get invoice by id
      • Get invoices
      • Create an invoice
      • Pay an invoice
      • Send Invoice
      • Update an invoice
    • Payment instruments
      • Create a payment instrument
      • Get payment instruments
        GET
      • Get a payment instrument by id
        GET
      • Create a Payment Instrument
        POST
    • Transactions
      • Get a transaction by id
      • Get transactions
      • Create a transaction
    • Settlements
      • get settlements
      • get settlement entries
    • Identity
      • Register an user
      • Validate Token
      • Create an api key
      • List api keys
      • Get Users
    • Programs
      • Accounts
    • Permission
      • Verify user permissions
      • Get Account Users
  1. Payment instruments

Create a payment instrument

Tokenization#

Use iframe from tokenization-form-sandbox.synswi.com/card-form and tokenization-form-sandbox.synswi.com/bank-form with query parameter accountId
1.
Render the iframe
2.
Post message with a type of submit_form to iframe
3.
Listen to message event with type of tokenization_success to get the paymentInstrumentId
Below are all the messages events the iframe emits:
1.
This event tells the paymentInstrumentId that you will use to create a transaction
{ 
    paymentInstrumentId: "string", 
    type: "tokenization_success" 
}
2.
This event is emitted when the tokenization fails for some reason. Message field contains the relevant reason
{ 
    message: "string", 
    type: "tokenization_failure"
}
3.
This event is emitted every second, and the height field tells the current iframe content's height. You could listen to this event to dynamically update the iframe's container's height
{ 
    height: "number", 
    type: "set_height"
}
Below are all the messages that you will send to iframe:
1.
This event tells the iframe to create a payment instrument using the information currently in the form
2.
This event tells the iframe to clear all the contents in the form
Previous
Update an invoice
Next
Get payment instruments
Built with