Quick Start
Get setup to accept payments in less than 5 minutes...
NOTE: Our quick start guide can help you set up our API quickly in a few easy steps. However, we encourage you to read through it in order to utilize its full power!
Get your API keys
Your API requests are authenticated using API keys. Any request that doesn't include an API key will return an error. API keys from client applications must also include your public key so we know it's for you. For client-side initialized transactions, only public keys are allowed for security purposes.
You can generate and retrieve your API key from your Dashboard at any time.
Install the SwitchApp inline library
The easiest way to interact with our API is to use our official javascript inline library:
You may also use SwitchApp via a javascript tag if you do not wish to install packages
How it helps: Using our library enables you to get up and running quickly with minimal coding.
Initialize the library with your public key
Pass your public key as the publicApiKey
property to the initialization function.
Setup your payment
Assemble all the details of your payment. This includes the country, currency, the amount you would like to receive, and the customer's details.
Make your first request
To make your first request, pass the assembled payment information to the showCheckoutModal
function in the SwitchApp client returned after initialization with your public key. This will initialize a new payment
transaction and pop up a hosted page modal for the customer to complete payment.
Once payment is completed or canceled, the checkout modal closes and invokes any functions passed to it ie onSuccess
and onClose
passing parameters to them that describe the payment info.
IMPORTANT: Your secret key should always remain hidden from the public. This includes ensuring it is never committed to source control eg git
and that it is never bundled in your client-side code.
If your secret keys are compromised at any time, terminate them and generate new ones. This will render the compromised keys invalid. This can be done via the API or on your dashboard.
The process described above only works while initializing from a client device eg a customer's mobile phone or computer. To initialize via your server, you need to call the server-initialize
endpoint while authenticating with your secret key.
Last updated