Add a Gateway

Before you can run a transaction through Spreedly, you will need to add a gateway to your environment. This page explains how to specify which gateway you wish to execute transactions against, the gateway credentials, and any other gateway-specific properties.

If you wish to transact against a third-party API instead of a gateway, please read about payment method distribution.

Add a gateway

Using your API credentials, you can add a gateway by POSTing to the Spreedly API endpoint<format>. For example, to add the Spreedly test gateway to your environment, you can run the following curl command (remembering to replace the example environment key and access secret with your own):

$ curl \
  -u 'C7cRfNJGODKh4Iu5Ox3PToKjniY:4UIuWybmdythfNGPqAqyQnYha6s451ri0fYAo4p3drZUi7q2Jf4b7HKg8etDtoKJ' \
  -H 'Content-Type: application/json' \
  -d '{
        "gateway": {
          "gateway_type": "test"

$ curl \
  -u 'C7cRfNJGODKh4Iu5Ox3PToKjniY:4UIuWybmdythfNGPqAqyQnYha6s451ri0fYAo4p3drZUi7q2Jf4b7HKg8etDtoKJ' \
  -H 'Content-Type: application/xml' \
  -d '<gateway>

The response you receive will be a new gateway record identified by its token element. Store this token in your system so you can reference it later to execute a transaction.

  "gateway": {
    "token": "6DqX57I6fHgIuUkVN2HGszjDSu1",
    "gateway_type": "test",
    "description": null,
    "payment_methods": [
    "state": "retained",
    "created_at": "2017-07-27T17:54:39Z",
    "updated_at": "2017-07-27T17:54:39Z",
    "name": "Spreedly Test",
    "characteristics": [
    "credentials": [

    "gateway_specific_fields": [

    "redacted": false
  <name>Spreedly Test</name>
  <description nil="true"></description>
    <supports_purchase type="boolean">true</supports_purchase>
    <supports_authorize type="boolean">true</supports_authorize>
    <supports_capture type="boolean">true</supports_capture>
    <supports_credit type="boolean">true</supports_credit>
    <supports_general_credit type="boolean">true</supports_general_credit>
    <supports_void type="boolean">true</supports_void>
    <supports_verify type="boolean">true</supports_verify>
    <supports_reference_purchase type="boolean">true</supports_reference_purchase>
    <supports_purchase_via_preauthorization type="boolean">true</supports_purchase_via_preauthorization>
    <supports_offsite_purchase type="boolean">true</supports_offsite_purchase>
    <supports_offsite_authorize type="boolean">true</supports_offsite_authorize>
    <supports_3dsecure_purchase type="boolean">true</supports_3dsecure_purchase>
    <supports_3dsecure_authorize type="boolean">true</supports_3dsecure_authorize>
    <supports_store type="boolean">true</supports_store>
    <supports_remove type="boolean">true</supports_remove>
    <supports_fraud_review type="boolean">false</supports_fraud_review>
    <supports_disburse type="boolean">true</supports_disburse>
    <supports_reference_authorization type="boolean">true</supports_reference_authorization>
  <redacted type="boolean">false</redacted>
  <created_at type="dateTime">2017-07-27T17:54:39Z</created_at>
  <updated_at type="dateTime">2017-07-27T17:54:39Z</updated_at>

Spreedly supports many production gateways (not sandboxes). While this example uses a test gateway, you can provision any of the supported production gateways in the same way by specifying the correct gateway_type parameter along with any credentials required for the desired gateway.

Store gateway token

When you add a gateway, the response contains a token element that represents the specific gateway (it’s like the gateway’s ID). You don’t need to create a new gateway token every time you want to run a transaction.

All future references to that gateway will use the same token, so you will need to store the gateway token for future use. Reference your saved gateway token to transact against the gateway ad infinitum. If you forget to save a gateway’s token, you can always use the API to list all your provisioned gateways.


Once you’ve created a gateway and stored its token, you can start collecting payment information from your users.