Consider going over Dynamic Routing.
Dynamic Routing provides real-time switching capabilities that allow you to select the best provider for a given transaction.
The combination of a payment method and a provider, considering the integration of choice, represents a channel in the Switch Platform. It is an actual medium that can be used to perform a financial transaction (e.g. Credit Card through Elavon, or Alipay through Worldpay).
A channel is configured through our Dashboard UI using the API keys for the merchant account that you have opened with the provider. By setting up multiple payment channels for the same payment method, and leveraging our Dynamic Routing component, you can define specific rules for real-time transaction routing between multiple providers.
POST /v1/channels
Method | Path | Description |
---|---|---|
POST | Sandbox https://merchant-api-test.switchpayments.com/v1/channels Production https://merchant-api.switchpayments.com/v1/channels | Create a new channel. |
Request Parameter
Identifier of the charge type associated with the channel being created.
Designation attributed to the channel being created.
Whether the channel is currently enabled or not.
Metadata necessary for the provider to process payments. You can find the correct metadata schema using the GET /v1/channels/schemas
endpoint.
The provider associated with the channel you are creating.
REQUEST$ curl -vX POST https://merchant-api.switchpayments.com/v1/channels?merchant_id={accountId} -u accountId:merchantApiKey -d '{"charge_type": "card_onetime","enabled": true,"label": "card_onetime_acapture","metadata": {},"processor": "acapture"}'
Result Parameter
Unique identifier for the channel.
Identifier of the charge type associated with the channel in question.
Designation attributed to the channel.
Whether the channel is currently enabled or not.
The channel's payment provider.
RESULT: HTTP 201{"id": "1d52aab23982d512f651dcb98ffe010b7b8570ff5dd5312a","charge_type": "card_onetime","label": "card_onetime_acapture","enabled": true,"processor": "acapture"}
Find metadata requirements.
GET /v1/channels/schemas
Method | Path | Description |
---|---|---|
GET | Sandbox https://merchant-api-test.switchpayments.com/v1/channels/schemas Production https://merchant-api.switchpayments.com/v1/channels/schemas | Tap into the metadata required to manage each channel. |
Result Parameter
The channel's metadata schema in JSON schema format.
The channel's metadata UI schema in JSON Schema format. This field is non-compulsory.
REQUEST$ curl GET https://merchant-api.switchpayments.com/v1/channels/schemas?merchant_id={accountId}&charge_type={chargeType}&processor={processor} -u accountId:merchantApiKey
RESULT: HTTP 200{"schema": {"title": "Acapture","type": "object","properties": {"user_id": {"type": "string","title": "User ID","minLength": 1},"password": {"type": "string","title": "Password","minLength": 1},"webhook_secret_for_encryption": {"type": ["string", "null"],"title": "Webhook Decryption Secret","minLength": 1}},"required": ["user_id", "password"]},"ui_schema": {"user_id": {"ui:help": "Your unique identifier in Acapture."}}}
GET /v1/channels
Method | Path | Description |
---|---|---|
GET | Sandbox https://merchant-api-test.switchpayments.com/v1/channels Production https://merchant-api.switchpayments.com/v1/channels | List the available channels. |
Result Parameter
Identifier for the channel being listed.
Identifier of the charge type (e.g.card_onetime
, card_recurring
, paypal
.)
The routing conditions associated with each channel.
Designation attributed to the channel.
Whether the channel is currently enabled or not.
Provider associated with th channel in question.
Merchant associated with this channel.
Additional information related to this channel. Might include details on the integration.
REQUEST$ curl GET https://merchant-api.switchpayments.com/v1/channels?merchant_id={accountId} -u accountId:merchantApiKey
RESULT: HTTP 200{"multibanco": {"id": "multibanco","label": "Multibanco","channels": [{"id": "f030ea091b661bcba0dcdf0309ee8663505","charge_type": "multibanco","label": "multibanco_eupago","enabled": true,"processor": "eupago","merchant_id": "IdxIqq9YYvmQ4izAw6DZpm3nfhUGxHD1MnHTPZWC","metadata": {"environment": "middle earth","api_key": "12345","integration": "s_v1"}}]},"card_onetime": {"id": "card_onetime","label": "Card One-Time","channels": [{"id": "b348b08a74f9ac0f5f6b490de5eaaa3d9","charge_type": "card_onetime","label": "onetime_acapture","enabled": true,"processor": "acapture","merchant_id": "IdxIqq9YYvmQ4izAw6DZpm3nfhUGxHD1MnHTPZWC","metadata": {"user_id": "0","password": "0","channel_ids": {"card_onetime": "000"},"allow_test_mode": true,"webhook_secret_for_encryption": "0665","autodetect_card_brand": true}},{"id": "7adec7d5ec676f101909e661985501ec","charge_type": "card_onetime","label": "onetime_stripe","enabled": true,"processor": "stripe","merchant_id": "IdxIqq9YYvmQ4izAw6DZpm3nfhUGxHD1MnHTPZWC","metadata": {"secret_key": "034","publishable_key": "0","integration": "charges"}}]}}
GET /v1/channels/{id}
Method | Path | Description |
---|---|---|
GET | Sandbox https://merchant-api-test.switchpayments.com/v1/channels/{id} Production https://merchant-api.switchpayments.com/v1/channels/{id} | Get the details of a specific channel using its ID. |
Result Parameter
Unique identifier for the channel.
Identifier of the charge_type
.
Channel label.
Whether the channel is currently enabled or not.
The channel's payment provider.
REQUEST$ curl -vX GET https://merchant-api.switchpayments.com/v1/channels/{id}?merchant_id={accountId} -u accountId:merchantApiKey
RESULT: HTTP 200{"id": "1d52aab23982d512f651dcb98ffe010b7b8570ff5dd5312a","charge_type": "card_onetime","label": "card_onetime_acapture","enabled": true,"processor": "acapture"}
PATCH /v1/channels/{id}
Method | Path | Description |
---|---|---|
PATCH | Sandbox https://merchant-api-test.switchpayments.com/v1/channels/{id} Production https://merchant-api.switchpayments.com/v1/channels/{id} | Make changes to existing channel through its ID. |
Request Parameter
Whether the channel is currently enabled or not. This is the parameter we are making changes to in this example. Turning a previously enabled channel into an active channel.
Metadata necessary for the provider to process payments. You can find the correct metadata schema using the GET /v1/channels/schemas
endpoint. For changes it can include parameters like user_id
and password
.
REQUEST$ curl -vX PATCH https://merchant-api.switchpayments.com/v1/channels/{id}?merchant_id={accountId} -u accountId:merchantApiKey -d '{"enabled": true,"metadata": {}}'
Result Parameter
Unique identifier for the channel
Identifier of the charge type
Channel label
Whether the channel is currently enabled
The channel's payment processor
RESULT: HTTP 200{"id": "1d52aab23982d512f651dcb98ffe010b7b8570ff5dd5312a","charge_type": "card_onetime","label": "card_onetime_acapture","enabled": true,"processor": "acapture"}
Channel Shares
Merchants have access to all the channels made available to their account. They can choose which of these channels should be shared with their sub-merchants. In the following examples we will expand on how you can create new shares and consult the ones in use.
POST /v1/channels/{id}/shares
Method | Path | Description |
---|---|---|
POST | Sandbox https://merchant-api-test.switchpayments.com/v1/channels/{id}/shares Production https://merchant-api.switchpayments.com/v1/channels/{id}/shares | Create a new channel share. |
Request Parameter
The share label.
The merchant or sub-merchant with whom this channel should be shared with.
REQUEST$ curl -vX POST https://merchant-api.switchpayments.com/v1/channels/{id}/shares?merchant_id={accountId} -u accountId:merchantApiKey -d '{"label": "My Share","merchant": "121cd198aa405f7e9643a5ba083a3265f5f9a3745dd5228c"}'
Result Parameter
The share ID
The channel share label.
The channel ID this share is associated with.
The merchant or sub-merchant associated with this share.
Whether the share is currently enabled or not.
RESULT: HTTP 201{"id": "1d52aab23982d512f651dcb98ffe010b7b8570ff5dd5312a","label": "My Share","channel_id": "536dd315e6eaa162c9032930c71a0915a351a2c15dd53108","merchant": "121cd198aa405f7e9643a5ba083a3265f5f9a3745dd5228c","enabled": true}
GET /v1/channels/{id}/shares
Method | Path | Description |
---|---|---|
GET | Sandbox https://merchant-api-test.switchpayments.com/v1/channels/{id}/shares Production https://merchant-api.switchpayments.com/v1/channels/{id}/shares | List the shares associated with a specific channel through its ID. |
Result Parameter
The channel share identification.
The designation attributed to the channel share.
The channel ID this share is associated with.
The merchant associated with this share.
Whether the share is currently enabled or not.
REQUEST$ curl GET https://merchant-api.switchpayments.com/v1/channels/{id}/shares?merchant_id={accountId} -u accountId:merchantApiKey
RESULT: HTTP 200{"id": "1d52aab23982d512f651dcb98ffe010b7b8570ff5dd5312a","label": "My Share","channel_id": "536dd315e6eaa162c9032930c71a0915a351a2c15dd53108","merchant": "121cd198aa405f7e9643a5ba083a3265f5f9a3745dd5228c","enabled": true}
It is not possible to create a channel share without registering all the required fields. Tending to this error case, a list with all the invalid fields and the respective errors is returned.
REQUEST$ curl -vX POST https://merchant-api.switchpayments.com/v1/channels?merchant_id={accountId} -u accountId:merchantApiKey -d '{"label": "My Share"}'
Result Parameter
The channel share ID.
The share label.
The channel ID this share is associated with.
The merchant or sub-merchant associated with this share.
Whether the share is currently enabled or not.
RESULT: HTTP 400{"message": "Invalid parameters","parameters": {"merchant": ["This field is required."]}}
Next Steps
Understand how you can use settlements and sources to watch over your transactions and how to access agreements and disputes. Learn more about Reconciliation.
Complement your channels using routing rules, take a look into Dynamic Routing.