Spreedly Test gateway guide

Additional notes
Spreedly’s Test gateway allows you to use a number of test cards to help you verify your integration. Any card not in the list of test cards is considered a real credit card and will fail when using a Test gateway. Review Test data for the list.

If you’d like to use a real credit card (a card not listed in the list of test cards), then your Spreedly account must be upgraded to a paid account.

Adding a Spreedly Test gateway

The test gateway is simple to add as there are no required credentials.

curl https://core.spreedly.com/v1/gateways.xml \
  -u 'C7cRfNJGODKh4Iu5Ox3PToKjniY:4UIuWybmdythfNGPqAqyQnYha6s451ri0fYAo4p3drZUi7q2Jf4b7HKg8etDtoKJ' \
  -H 'Content-Type: application/xml' \
  -d '<gateway>
        <gateway_type>test</gateway_type>
      </gateway>'

This call will give you a gateway token you can use for all test transactions.

<gateway>
  <token>7tUozIeQUFZGd2M8M3GzmIqQ2pM</token>
  <gateway_type>test</gateway_type>
  <name>Spreedly Test</name>
  <description nil="true"/>
  <merchant_profile_key nil="true"/>
  <sub_merchant_key nil="true"/>
  <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_adjust type="boolean">true</supports_adjust>
    <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_offsite_synchronous_purchase type="boolean">true</supports_offsite_synchronous_purchase>
    <supports_offsite_synchronous_authorize type="boolean">true</supports_offsite_synchronous_authorize>
    <supports_3dsecure_purchase type="boolean">true</supports_3dsecure_purchase>
    <supports_3dsecure_authorize type="boolean">true</supports_3dsecure_authorize>
    <supports_3dsecure_2_mpi_purchase type="boolean">true</supports_3dsecure_2_mpi_purchase>
    <supports_3dsecure_2_mpi_authorize type="boolean">true</supports_3dsecure_2_mpi_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_network_tokenization type="boolean">true</supports_network_tokenization>
    <supports_populate_mit_fields type="boolean">true</supports_populate_mit_fields>
    <supports_inquire_by_gateway_transaction_id type="boolean">false</supports_inquire_by_gateway_transaction_id>
    <supports_inquire_by_order_id type="boolean">false</supports_inquire_by_order_id>
    <supports_transaction_retry type="boolean">true</supports_transaction_retry>
    <supports_stored_stored_credentials type="boolean">false</supports_stored_stored_credentials>
    <supports_reference_authorization type="boolean">true</supports_reference_authorization>
    <supports_3dsecure_2_purchase type="boolean">true</supports_3dsecure_2_purchase>
    <supports_3dsecure_2_authorize type="boolean">true</supports_3dsecure_2_authorize>
    <supports_stored_credentials type="boolean">true</supports_stored_credentials>
  </characteristics>
  <credentials>
  </credentials>
  <gateway_settings>
  </gateway_settings>
  <gateway_specific_fields>
    <gateway_specific_field>simulate_error</gateway_specific_field>
    <gateway_specific_field>simulate_decline</gateway_specific_field>
    <gateway_specific_field>idempotency_key</gateway_specific_field>
    <gateway_specific_field>mit_override_demo</gateway_specific_field>
  </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>google_pay</payment_method>
  </payment_methods>
  <state>retained</state>
  <redacted type="boolean">false</redacted>
  <sandbox type="boolean">false</sandbox>
  <mode>default</mode>
  <created_at type="dateTime">2023-06-06T17:11:33Z</created_at>
  <updated_at type="dateTime">2023-06-06T17:11:33Z</updated_at>
</gateway>

Please review Testing & troubleshooting for more information on testing your Spreedly implementation.

Testing Capture and Credit with the test gateway

To test an authorize with the test gateway, you can use one of the test credit cards in Test data. On the test gateway, both the capture operation and the credit operation always succeed unless you use an amount of 44 cents. The test gateway knows that amount and returns a failure in that case to allow you to test your handling of capture and credit failures.

Offsite gateway testing using the test gateway

If you’re using an offsite gateway, there’s a step in the process when your customer gets redirected to the offsite gateway’s site to actually pay. When you’re using the Test Gateway and the Sprel payment method, your customer gets redirected to a special UI on the Spreedly site. From there, you can trigger a number of different error conditions directly through the UI.

There’s a point though, before you redirect your customer offsite, that you need to initiate a purchase transaction which under the hood talks to the remote gateway to know the actual url you need to redirect your customer to. And of course, it’s possible for this process to fail.

If you’re using the Test Gateway and Sprel, you can simulate this type of error by specifying an amount of 44 cents.

If you’re using the Test Gateway and Sprel and you’d like to test delayed payments that take some time to settle (like ACHs), then you can use the Test Gateway’s api call to settle transactions.