Stripe gateway guide

Quick Start

New to integrating Stripe with Spreedly? Here's your setup guide:

  1. Retrieve your Stripe credentials:
    1. Log in to the Stripe Dashboard.
    2. Open Developers, then API keys.
    3. Create a restricted API key (rktest... or rklive...). Spreedly recommends restricted keys. Install Spreedly's RAK application.
    4. Give the key Write on Charges, Customers, PaymentIntents, PaymentMethods, SetupIntents, and Tokens, and Read on Webhook Endpoints. For Connect, grant the same permissions on the connected account.
    5. A test key must be saved on a Spreedly sandbox gateway. A live key must be saved on a production gateway. Stripe rejects a mismatch.
  2. Get familiar with the Spreedly API:
    1. Review Spreedly API basics.
    2. Review Gateways, Payment Methods, and Transactions.
  3. Add an Stripe gateway to Spreedly in sandbox mode.
📘

Review this documentation to understand more about how to test transactions.

This gateway supports Level 2 and Level 3 data through gateway specific fields. Confirm with Stripe that the account is enabled for those rates before relying on them.

Additional notes
  • Supported operations: purchase, authorize, capture, credit, void, verify, store, remove.
  • Supported payment methods: credit card, third party token, Apple Pay, bank account, Google Pay.
  • 3D Secure: Gateway-specific 3DS1 is declared (supports_3dsecure_purchase and supports_3dsecure_authorize). Gateway-specific 3DS2 and Spreedly Global 3DS2 are not declared.
  • Network tokenization: Not supported (supports_network_tokenization is false).
  • Card Scheme NTID: card_scheme_ntid is declared. The ID Stripe returns is a scheme transaction ID, not a network token.
  • Stored credentials: stored_credentials is not declared, so Spreedly does not send a stored network transaction ID on a later Charge.
  • General credit: Not supported (a refund with no prior charge).
  • Partial capture and credit: supports_partial_capture and supports_partial_credit are declared. Partial capture and partial refund are supported. A lower amount on capture or credit is sent to Stripe. See the sections below.

API version

The Charges gateway default Stripe-Version header is 2026-09-30.endive. Pass version_override when creating or updating a gateway to pin a different Stripe API version. A blank override uses the default.

Review Stripe's API upgrades before choosing another version. Support is built for the default pin.

curl https://core.spreedly.com/v1/gateways.xml \
  -u 'EnvironmentKey:AccessSecret' \
  -H 'Content-Type: application/xml' \
  -d '<gateway>
        <gateway_type>stripe</gateway_type>
        <login>your api secret key</login>
        <version_override>2020-08-27</version_override>
      </gateway>'

On 2026-09-30.endive, Stripe still accepts the Charges request fields this gateway sends, including Level 3 merchant_reference names. Payment Intents renames do not apply to Charges. default_card on a customer update is still accepted; Stripe writes default_source.

Adding a Stripe gateway

Required credentials

  • login: Stripe secret or restricted API key (sk_... or rk_...), or a Stripe Connect access_token.

Optional gateway settings

  • version_override: Stripe API version sent as Stripe-Version. Blank uses 2026-09-30.endive.
  • webhook_id: Stripe webhook endpoint ID (we_...). Required for the 3DS1 source flow.
  • webhook_signing_secret: Signing secret for that endpoint.

To learn more about creating gateways, see the Gateway user guide.

REQUEST

curl https://core.spreedly.com/v1/gateways.xml \
  -u 'EnvironmentKey:AccessSecret' \
  -H 'Content-Type: application/xml' \
  -d '<gateway>
        <gateway_type>stripe</gateway_type>
        <login>your api secret key</login>
      </gateway>'

RESPONSE

<gateway>
  <token>Nz4bLMriDXlllDtWhBespFpsxyz</token>
  <gateway_type>stripe</gateway_type>
  <name>Stripe</name>
  <characteristics>
    <supports_purchase type="boolean">true</supports_purchase>
    <supports_authorize type="boolean">true</supports_authorize>
    <supports_capture type="boolean">true</supports_capture>
    <supports_partial_capture type="boolean">true</supports_partial_capture>
    <supports_credit type="boolean">true</supports_credit>
    <supports_partial_credit type="boolean">true</supports_partial_credit>
    <supports_general_credit type="boolean">false</supports_general_credit>
    <supports_void type="boolean">true</supports_void>
    <supports_verify type="boolean">true</supports_verify>
    <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">false</supports_3dsecure_2_mpi_purchase>
    <supports_3dsecure_2_mpi_authorize type="boolean">false</supports_3dsecure_2_mpi_authorize>
    <supports_store type="boolean">true</supports_store>
    <supports_remove type="boolean">true</supports_remove>
    <supports_network_tokenization type="boolean">false</supports_network_tokenization>
  </characteristics>
  <gateway_settings>
    <webhook_id nil="true"/>
    <version_override nil="true"/>
  </gateway_settings>
  <payment_methods>
    <payment_method>credit_card</payment_method>
    <payment_method>third_party_token</payment_method>
    <payment_method>apple_pay</payment_method>
    <payment_method>bank_account</payment_method>
    <payment_method>google_pay</payment_method>
  </payment_methods>
</gateway>

Stripe Connect

Stripe Connect gives you permission to use a customer's Stripe account. After the OAuth flow, pass the access_token as login.

curl https://core.spreedly.com/v1/gateways.xml \
  -u 'EnvironmentKey:AccessSecret' \
  -H 'Content-Type: application/xml' \
  -d '<gateway>
        <gateway_type>stripe</gateway_type>
        <login>access_token you received</login>
      </gateway>'

If Stripe returns an error that the connected account cannot be accessed, contact Stripe support and ask them to remove the OAuth restriction. Include the live publishable key and the email address on the Stripe account.

To create a direct charge on a connected account, pass the stripe_account gateway specific field instead of using the access token as login.

Purchase

curl https://core.spreedly.com/v1/gateways/GATEWAY_TOKEN/purchase.json \
  -u 'EnvironmentKey:AccessSecret' \
  -H 'Content-Type: application/json' \
  -d '{
    "transaction": {
      "payment_method_token": "PAYMENT_METHOD_TOKEN",
      "amount": 1000,
      "currency_code": "USD"
    }
  }'

A successful card charge returns response.network_transaction_id and gateway_specific_response_fields.stripe.authorization_code when Stripe sends them. Empty values are omitted from the JSON.

Partial capture

Capture part of an authorization by sending a lower amount on the capture. Stripe Charges can be captured once. Spreedly posts that amount to POST /v1/charges/:id/capture.

curl https://core.spreedly.com/v1/transactions/AUTHORIZATION_TOKEN/capture.json \
  -u 'EnvironmentKey:AccessSecret' \
  -H 'Content-Type: application/json' \
  -d '{
    "transaction": {
      "amount": 500,
      "currency_code": "USD"
    }
  }'

For a 1000 authorization captured for 500:

  • Spreedly amount is 500.
  • Spreedly local_amount is 1000, because Stripe's Charge amount stays the original authorization.
  • On 2020-08-27, Stripe also created a Refund for the uncaptured 500 and set amount_refunded to 500. On 2025-03-31.basil and 2026-09-30.endive, Stripe does not create that remainder Refund, and amount_refunded stays 0.

Spreedly does not read amount_refunded, refunded, or the Charge refund list. supports_partial_capture is true. Partial capture is supported.

Partial credit

Refund part of a captured charge by sending a lower amount on credit. Spreedly posts that amount to POST /v1/charges/:id/refunds. Repeat until the captured amount is used up. A credit that is not tied to a charge is not supported.

curl https://core.spreedly.com/v1/transactions/PURCHASE_TOKEN/credit.json \
  -u 'EnvironmentKey:AccessSecret' \
  -H 'Content-Type: application/json' \
  -d '{
    "transaction": {
      "amount": 500,
      "currency_code": "USD"
    }
  }'

The Stripe Refund amount is the refund amount, so a 500 credit of a 1000 purchase has Spreedly amount 500 and local_amount 500. supports_partial_credit is true. Partial refund is supported.

Gateway Specific Fields

Field nameTypeRequiredUse caseExample
application_feeintegerNoCents charged on top of Stripe fees for Connect authorize, purchase, or capture.103
application_fee_amountintegerNoFee when creating a charge on behalf of a connected account. Do not send with transfer_amount.100
refund_application_feebooleanNoRefund the application fee with the charge.true
refund_fee_amountintegerNoPartial application fee amount to refund.50
reverse_transferbooleanNoReverse the transfer when refunding or voiding a destination charge.true
reasonstringNoReason sent on refund or void.requested_by_customer
statement_descriptionstringNoStatement text shown to the cardholder. See Stripe statement descriptors.5K Race Ticket
statement_descriptor_suffixstringNoSuffix appended to the account statement descriptor.ORDER 10108
destinationstringNoConnected account that receives the funds.acct_123
destination_amountintegerNoAmount, in cents, transferred to destination.10
transfer_destinationstringNoDestination account for a charge on behalf of a connected account.acct_123
transfer_amountintegerNoAmount transferred. Mutually exclusive with application_fee_amount.400
transfer_groupstringNoGroup id for related transfers.xfer-group-1
on_behalf_ofstringNoConnected account the charge is made on behalf of.acct_123
stripe_accountstringNoDirect charge on this connected account.acct_123
idempotency_keystringNoSafe retry key so Stripe does not run the same operation twice.order-1001
metadataobjectNoCustom key-value data stored on the Stripe object.key: value
receipt_emailstringNoEmail address that receives the Stripe receipt.[email protected]
recurringbooleanNoMarks the transaction recurring or not. Confirm account settings with Stripe before use.true
radar_session_idstringNoRadar session from Spreedly.stripeRadar. Radar Sessions must be enabled by Stripe.rse_123
skip_radar_rulesbooleanNoSkip Radar rules for this transaction. Stripe must enable skip rules.true
merchant_referencestringNoLevel 2/3 order id, up to 25 characters.ORDER1001
customer_referencestringNoLevel 2/3 customer reference, up to 17 characters.CUST1001
shipping_address_zipstringNoCustomer U.S. shipping ZIP for Level 2/3.27705
shipping_from_zipstringNoMerchant U.S. shipping ZIP for Level 2/3.94107
shipping_amountintegerNoShipping cost in cents.200
line_itemsarrayNoLevel 3 lines. Up to 200 objects. Each has product_code (12), product_description (26), unit_cost, quantity, tax_amount, discount_amount. Amounts are cents.see below
account_idstringNoStripe account id used when storing.acct_123
customer_idstringNoExisting Stripe customer to attach a stored payment method to.cus_123
validatebooleanNoWhether Stripe validates the card on store.false
make_defaultbooleanNoMake the stored card the customer default. Stripe still accepts default_card and stores default_source.true

Gateway Specific Response Fields

Blank values are omitted from the API JSON.

Field nameTypeDescription
authorization_codestringIssuer authorization code from payment_method_details.card.authorization_code. Present on an approved card charge. Example: 381111.
electronic_commerce_indicatorstringECI from payment_method_details.card.electronic_commerce_indicator. If that is blank, Spreedly uses payment_method_details.card.three_d_secure.electronic_commerce_indicator. A non-3DS charge usually omits it. A completed Visa authentication is typically 05. This Charges gateway cannot complete 3DS1 authentication, so a live value is not produced today.
advice_codestringFrom outcome.advice_code, or error.advice_code on a decline. Example: try_again_later. Often absent on an approval.
network_advice_codestringFrom outcome.network_advice_code, or error.network_advice_code on a decline. Omitted when the network does not send one. Stripe test card 4000000000000002 returns generic_decline and often omits this field.
outcome_network_advice_codestringSame outcome value, kept under the existing name. network_advice_code does not replace it.
outcome_network_decline_codestringNetwork decline code from the Charge outcome.
outcome_network_statusstringOutcome network status, such as approved_by_network.
outcome_reasonstringOutcome reason.
outcome_risk_levelstringRadar risk level, such as normal.
outcome_seller_messagestringSeller-facing outcome message.
outcome_typestringOutcome type, such as authorized.
decline_codestringStripe decline code, such as generic_decline or authentication_required.
card_fundingstringFunding source, such as credit or debit.
network_tokenobjectWhether Stripe used a network token. Shape is { "used": true|false }. Merchant-supplied network tokens are not accepted on Charges.
receipt_urlstringStripe receipt URL.
stripe_source_brandstringBrand from the Charge source.
stripe_source_countrystringCountry from the Charge source.
stripe_source_fingerprintstringFingerprint from the Charge source.
stripe_source_fundingstringFunding from the Charge source.
customer_idstringStripe customer id returned when storing a bank account.
bank_account_idstringStripe bank account id returned when storing a bank account. Required to verify ACH micro-deposits.
webhook_idstringWebhook id used for the 3DS1 flow, when one was configured.
<gateway_specific_response_fields>
  <stripe>
    <authorization_code>381111</authorization_code>
    <advice_code>try_again_later</advice_code>
    <network_advice_code>01</network_advice_code>
    <decline_code>generic_decline</decline_code>
    <card_funding>credit</card_funding>
    <receipt_url>https://pay.stripe.com/receipts/payment/123456</receipt_url>
  </stripe>
</gateway_specific_response_fields>

Network transaction id

On a successful Authorize, Purchase, or Capture, Spreedly reads payment_method_details.card.network_transaction_id and returns it as transaction.response.network_transaction_id. The value is returned as Stripe sends it. A Visa id is numeric. A Mastercard trace id looks like MCC1X73PC1022.

Declines and card validations omit the property. Refund responses are Refund objects, not Charges, so this field is not taken from a credit. There is no root-level Charge.network_transaction_id on the current Charge object.

3DS transactions

Stripe rejects type=three_d_secure on both 2020-08-27 and 2026-09-30.endive with: the source type is no longer available as part of 3D Secure 1 deprecation. Spreedly then charges the card number. There is no checkout_url. Use Stripe Payment Intents for 3D Secure 2.

The declared flow is still gateway-specific 3DS1 through the Sources API. attempt_3dsecure: true stores three_ds_version 1 before Stripe is called. A successful row in reporting can still show version 1 when the card did not require authentication and the normal charge succeeded.

If you configure the legacy webhook, the endpoint URL must exactly match Spreedly's callback, and the endpoint must live on the same Stripe account as the gateway secret.

Save webhook_id (we_...) and webhook_signing_secret on the gateway.

Stripe Radar

Radar uses device and activity signals. Ask Stripe support to enable Radar Sessions, then:

  1. Include https://js.stripe.com/v3/ on the checkout page.
  2. Call Spreedly.stripeRadar(publishableKey, callback, options). For Connect, pass { stripeAccount: 'acct_...' }.
  3. Send the returned id as gateway specific field radar_session_id.
  4. To skip rules on one transaction, send skip_radar_rules true. Stripe must enable skip rules on the account.

ACH transactions

Deprecated for new users. Existing bank-account customers may continue until March 5, 2026, after which this feature is deprecated for them as well.

Stripe requires a bank account to be stored and verified before a purchase. A direct bank purchase or authorize is not supported. Store the bank account, read customer_id and bank_account_id from the gateway specific response fields, then verify the two micro-deposits with Stripe's API. After verification, use the payment method token for purchases.

Store

Store a card or bank account with the store API. Optional fields: customer_id, account_id, validate, and make_default. make_default still posts default_card. Stripe accepts it on 2020-08-27 and 2026-09-30.endive and writes default_source.

Additional resources

If you need support with this gateway please contact Support at [email protected].


Did this page help you?