Stripe gateway guide
Quick Start
New to integrating Stripe with Spreedly? Here's your setup guide:
- Retrieve your Stripe credentials:
- Log in to the Stripe Dashboard.
- Open Developers, then API keys.
- Create a restricted API key (
rktest... orrklive...). Spreedly recommends restricted keys. Install Spreedly's RAK application. - 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.
- 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.
- Get familiar with the Spreedly API:
- Review Spreedly API basics.
- Review Gateways, Payment Methods, and Transactions.
- 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 |
|---|
|
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_...orrk_...), or a Stripe Connectaccess_token.
Optional gateway settings
- version_override: Stripe API version sent as
Stripe-Version. Blank uses2026-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
amountis 500. - Spreedly
local_amountis 1000, because Stripe's Chargeamountstays the original authorization. - On
2020-08-27, Stripe also created a Refund for the uncaptured 500 and setamount_refundedto 500. On2025-03-31.basiland2026-09-30.endive, Stripe does not create that remainder Refund, andamount_refundedstays 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 name | Type | Required | Use case | Example |
|---|---|---|---|---|
application_fee | integer | No | Cents charged on top of Stripe fees for Connect authorize, purchase, or capture. | 103 |
application_fee_amount | integer | No | Fee when creating a charge on behalf of a connected account. Do not send with transfer_amount. | 100 |
refund_application_fee | boolean | No | Refund the application fee with the charge. | true |
refund_fee_amount | integer | No | Partial application fee amount to refund. | 50 |
reverse_transfer | boolean | No | Reverse the transfer when refunding or voiding a destination charge. | true |
reason | string | No | Reason sent on refund or void. | requested_by_customer |
statement_description | string | No | Statement text shown to the cardholder. See Stripe statement descriptors. | 5K Race Ticket |
statement_descriptor_suffix | string | No | Suffix appended to the account statement descriptor. | ORDER 10108 |
destination | string | No | Connected account that receives the funds. | acct_123 |
destination_amount | integer | No | Amount, in cents, transferred to destination. | 10 |
transfer_destination | string | No | Destination account for a charge on behalf of a connected account. | acct_123 |
transfer_amount | integer | No | Amount transferred. Mutually exclusive with application_fee_amount. | 400 |
transfer_group | string | No | Group id for related transfers. | xfer-group-1 |
on_behalf_of | string | No | Connected account the charge is made on behalf of. | acct_123 |
stripe_account | string | No | Direct charge on this connected account. | acct_123 |
idempotency_key | string | No | Safe retry key so Stripe does not run the same operation twice. | order-1001 |
metadata | object | No | Custom key-value data stored on the Stripe object. | key: value |
receipt_email | string | No | Email address that receives the Stripe receipt. | [email protected] |
recurring | boolean | No | Marks the transaction recurring or not. Confirm account settings with Stripe before use. | true |
radar_session_id | string | No | Radar session from Spreedly.stripeRadar. Radar Sessions must be enabled by Stripe. | rse_123 |
skip_radar_rules | boolean | No | Skip Radar rules for this transaction. Stripe must enable skip rules. | true |
merchant_reference | string | No | Level 2/3 order id, up to 25 characters. | ORDER1001 |
customer_reference | string | No | Level 2/3 customer reference, up to 17 characters. | CUST1001 |
shipping_address_zip | string | No | Customer U.S. shipping ZIP for Level 2/3. | 27705 |
shipping_from_zip | string | No | Merchant U.S. shipping ZIP for Level 2/3. | 94107 |
shipping_amount | integer | No | Shipping cost in cents. | 200 |
line_items | array | No | Level 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_id | string | No | Stripe account id used when storing. | acct_123 |
customer_id | string | No | Existing Stripe customer to attach a stored payment method to. | cus_123 |
validate | boolean | No | Whether Stripe validates the card on store. | false |
make_default | boolean | No | Make 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 name | Type | Description |
|---|---|---|
authorization_code | string | Issuer authorization code from payment_method_details.card.authorization_code. Present on an approved card charge. Example: 381111. |
electronic_commerce_indicator | string | ECI 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_code | string | From outcome.advice_code, or error.advice_code on a decline. Example: try_again_later. Often absent on an approval. |
network_advice_code | string | From 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_code | string | Same outcome value, kept under the existing name. network_advice_code does not replace it. |
outcome_network_decline_code | string | Network decline code from the Charge outcome. |
outcome_network_status | string | Outcome network status, such as approved_by_network. |
outcome_reason | string | Outcome reason. |
outcome_risk_level | string | Radar risk level, such as normal. |
outcome_seller_message | string | Seller-facing outcome message. |
outcome_type | string | Outcome type, such as authorized. |
decline_code | string | Stripe decline code, such as generic_decline or authentication_required. |
card_funding | string | Funding source, such as credit or debit. |
network_token | object | Whether Stripe used a network token. Shape is { "used": true|false }. Merchant-supplied network tokens are not accepted on Charges. |
receipt_url | string | Stripe receipt URL. |
stripe_source_brand | string | Brand from the Charge source. |
stripe_source_country | string | Country from the Charge source. |
stripe_source_fingerprint | string | Fingerprint from the Charge source. |
stripe_source_funding | string | Funding from the Charge source. |
customer_id | string | Stripe customer id returned when storing a bank account. |
bank_account_id | string | Stripe bank account id returned when storing a bank account. Required to verify ACH micro-deposits. |
webhook_id | string | Webhook 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_secureon both2020-08-27and2026-09-30.endivewith: the source type is no longer available as part of 3D Secure 1 deprecation. Spreedly then charges the card number. There is nocheckout_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.
- Endpoint URL: https://core.spreedly.com/stripe/webhooks
- Events:
source.chargeable,source.canceled,source.failed - Connected accounts need a Connect webhook.
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:
- Include
https://js.stripe.com/v3/on the checkout page. - Call
Spreedly.stripeRadar(publishableKey, callback, options). For Connect, pass{ stripeAccount: 'acct_...' }. - Send the returned id as gateway specific field
radar_session_id. - To skip rules on one transaction, send
skip_radar_rulestrue. 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].
- Stripe documentation:
- Upgrade your integration: https://docs.stripe.com/upgrades
- Charges | Stripe API Reference: https://docs.stripe.com/api/charges
- Authenticate with 3D Secure: https://docs.stripe.com/payments/3d-secure/authentication-flow
- Endpoint: https://api.stripe.com/v1/
Updated 20 days ago

