Account

Get started with the Switch Platform.

When starting out with the Switch Platform, properly setting up your account can be crucial to your integration efforts. Learn more about Merchant Keys and Environment and how to proceed regarding Authentication.

Authentication

All requests to Switch APIs must use HTTPS. In our examples, we use curl, nonetheless any language-specific HTTPS request method or library will work. All requests to Switch API use HTTPS Basic Auth. If your library does not support it as a function, you can add the following header to your requests.

BASIC AUTHORIZATION
Authorization: Basic {credentials}

For requests from the server-side, {credentials} should be replaced with the base64 encoded string accountId:privateKey. For requests from the client-side, {credentials} should be replaced with the base64 encoded string publicKey:.

Never expose your Private Key on the client-side!

Keep your transactions secure and your clients’ information safe.

If you are not using the correct Authentication, you will receive a 401 or 403 HTTP error. Merchant server Webhooks should use HTTPS and self-signed certificates are not accepted. During development, it might be helpful using a service such as ngrok to expose an HTTPS tunnel to your local environment.

Merchant Keys and Environment

You can also find these account details on the Switch Dashboard Settings screen.

We recommend using the Switch Dashboard for ease of access and a user-friendly work environment. Contact our Support Team to enable this feature.

Merchant Keys and the Environment you set are essential for communicating with Switch throughout your Payment operation.

Different combinations between the Merchant API Keys or Processing API Keys and your Account ID grant Authentication in your requests. It is important to be well aware of when to use each of the Keys and how to gain access to them. If you have any trouble with these, please contact our Support Team.

Environments can be set to TEST or LIVE depending on where you are at with your operations. If you are looking to test new features or still going through onboarding, use TEST. When your operations are up and running, LIVE should be the standard.

  • Public Key

    Used in requests coming from the client-side, to create Dynamic Forms and Instruments.
  • Account ID + Private Key

    Used in requests coming from the Merchant server, to create Charges, Payments, Reversals, and Refunds, as well as accessing Management APIs. This key SHOULD NEVER BE SHARED in client-side code.
  • Environment

    TEST or LIVE, corresponding to https://api-test.switchpayments.com/v2/ and https://api.switchpayments.com/v2/, respectively. The v2 part of the URL corresponds to API versioning.

Next Steps

Now that you have gone through the Switch starting kit, head over to the Integrating with Switch to learn more about the integration patterns available and choose the one that best suits your needs.