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 https://core.spreedly.com/v1/gateways.<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 https://core.spreedly.com/v1/gateways.json \
  -u 'C7cRfNJGODKh4Iu5Ox3PToKjniY:4UIuWybmdythfNGPqAqyQnYha6s451ri0fYAo4p3drZUi7q2Jf4b7HKg8etDtoKJ' \
  -H 'Content-Type: application/json' \
  -d '{
        "gateway": {
          "gateway_type": "test"
        }
      }'

$ curl https://core.spreedly.com/v1/gateways.xml \
  -u 'C7cRfNJGODKh4Iu5Ox3PToKjniY:4UIuWybmdythfNGPqAqyQnYha6s451ri0fYAo4p3drZUi7q2Jf4b7HKg8etDtoKJ' \
  -H 'Content-Type: application/xml' \
  -d '<gateway>
        <gateway_type>test</gateway_type>
      </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": [
      "credit_card",
      "sprel",
      "third_party_token",
      "bank_account",
      "apple_pay",
      "android_pay"
    ],
    "state": "retained",
    "created_at": "2017-07-27T17:54:39Z",
    "updated_at": "2017-07-27T17:54:39Z",
    "name": "Spreedly Test",
    "characteristics": [
      "purchase",
      "authorize",
      "capture",
      "credit",
      "general_credit",
      "void",
      "verify",
      "reference_purchase",
      "purchase_via_preauthorization",
      "offsite_purchase",
      "offsite_authorize",
      "3dsecure_purchase",
      "3dsecure_authorize",
      "store",
      "remove",
      "disburse",
      "reference_authorization"
    ],
    "credentials": [

    ],
    "gateway_specific_fields": [

    ],
    "redacted": false
  }
}
<gateway>
  <token>3XJsMWZgoUjMwjGD1AySTW8Bab1</token>
  <gateway_type>test</gateway_type>
  <name>Spreedly Test</name>
  <description nil="true"></description>
  <characteristics>
    <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>
  </characteristics>
  <credentials>
  </credentials>
  <gateway_specific_fields>
  </gateway_specific_fields>
  <payment_methods>
    <payment_method>credit_card</payment_method>
    <payment_method>sprel</payment_method>
    <payment_method>third_party_token</payment_method>
    <payment_method>bank_account</payment_method>
    <payment_method>apple_pay</payment_method>
    <payment_method>android_pay</payment_method>
  </payment_methods>
  <state>retained</state>
  <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>
</gateway>

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.

Next

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