Forwarding RequestPreview feature

Instructs Stripe to make a request on your behalf using the destination URL and HTTP method in the config. A config is set up for each destination URL by Stripe at the time of onboarding. Stripe verifies requests with your credentials in the config, and injects card details from the payment_method into the request.

Stripe redacts all sensitive fields and headers, including authentication credentials and card numbers, before storing the request and response data in the forwarding Request object, which are subject to a 30-day retention period.

You can provide a Stripe idempotency key to make sure that requests with the same key result in only one outbound request. The Stripe idempotency key provided should be unique and different from any idempotency keys provided on the underlying third-party request.

Forwarding Requests are synchronous requests that return a response or time out according to Stripe’s limits.

Related guide: Forward card details to third-party API endpoints.

The ForwardingRequest objectPreview feature

Attributes

  • idstring

    Unique identifier for the object.

  • objectstring

    String representing the object’s type. Objects of the same type share the same value.

  • configstring

    The Forwarding Config used when making the forwarded request. The config specifes the HTTP method, merchant credentials, connection settings, and supported destination URLs.

  • createdtimestamp

    Time at which the object was created. Measured in seconds since the Unix epoch.

  • livemodeboolean

    Has the value true if the object exists in live mode or the value false if the object exists in test mode.

  • payment_methodstring

    The PaymentMethod to insert into the forwarded request. Forwarding previously consumed PaymentMethods is allowed.

  • replacementsarray of enums

    The field kinds to be replaced in the forwarded request.

    Possible enum values
    card_cvc

    Replace the card cvc field

    card_expiry

    Replace the card expiry fields like month and year

    card_number

    Replace the card number field

    cardholder_name

    Replace the cardholder name field

  • request_contextnullable object

    Context about the request from Stripe’s servers to the destination endpoint.

  • request_detailsnullable object

    The request that was sent to the destination endpoint. We redact any sensitive fields.

  • response_detailsnullable object

    The response that the destination endpoint returned to us. We redact any sensitive fields.

  • urlnullable string

    The destination URL for the forwarded request. Must be supported by the config.

The ForwardingRequest object
{
"id": "fwdreq_123",
"object": "forwarding.request",
"config": "fwdcfg_acct_TESTCONFIG_demo_payments",
"created": 1234567890,
"livemode": false,
"payment_method": "pm_456",
"request_details": {
"body": "{\"amount\":{\"value\":1000,\"currency\":\"usd\"},\"card\":{\"number\":\"424242******4242\",\"exp_month\":\"03\",\"exp_year\":\"2030\",\"cvc\":\"***\",\"name\":\"First Last\"},\"reference\":\"Your order number\"}",
"headers": [
{
"name": "Authorization",
"value": "Bearer *******************************************************************************************"
},
{
"name": "Content-Type",
"value": "application/json"
}
],
"http_method": "POST"
},
"request_context": {
"destination_ip_address": "35.190.113.80",
"destination_duration": 234
},
"response_details": {
"body": "'{\"transactionId\":\"example1234\"}'",
"headers": [
{
"name": "Content-Type",
"value": "application/json;charset=UTF-8"
}
],
"status": 200
},
"url": "https://forwarding-api-demo.stripedemos.com/payments",
"replacements": [
"card_number",
"card_expiry",
"card_cvc",
"cardholder_name"
]
}

Create a ForwardingRequest

Creates a ForwardingRequest object.

Parameters

  • configstringRequired

    The Forwarding Config used when making the forwarded request. The config specifes the HTTP method, merchant credentials, connection settings, and supported destination URLs.

  • payment_methodstringRequired

    The PaymentMethod to insert into the forwarded request. Forwarding previously consumed PaymentMethods is allowed.

  • replacementsarray of enumsRequired

    The field kinds to be replaced in the forwarded request.

    Possible enum values
    card_cvc

    Replace the card cvc field

    card_expiry

    Replace the card expiry fields like month and year

    card_number

    Replace the card number field

    cardholder_name

    Replace the cardholder name field

  • requestobjectRequired

    The request body and headers to be sent to the destination endpoint.

  • urlstringRequired

    The destination URL for the forwarded request. Must be supported by the config.

Returns

Returns a ForwardingRequest object.

POST /v1/forwarding/requests
curl https://api.stripe.com/v1/forwarding/requests \
-u "sk_test_4eC39Hq...arjtT1zdp7dcsk_test_4eC39HqLyjWDarjtT1zdp7dc:" \
-d config=fwdcfg_acct_TESTCONFIG_demo_payments \
--data-urlencode url="https://forwarding-api-demo.stripedemos.com/payments" \
-d payment_method=pm_card_visa \
-d "replacements[0]"=card_number \
-d "replacements[1]"=card_expiry \
-d "replacements[2]"=card_cvc \
-d "replacements[3]"=cardholder_name \
--data-urlencode "request[body]"="{\"amount\":{\"value\":1000,\"currency\":\"usd\"},\"card\":{\"number\":\"\",\"exp_month\":\"\",\"exp_year\":\"\",\"cvc\":\"\",\"name\":\"\"},\"reference\":\"Your order number\"}" \
-d "request[headers][0][name]"=Authorization \
-d "request[headers][0][value]"="Bearer eyJhbGciOiJIUzI1NiJ9.Zm9yd2FyZGluZy1hcGktZGVtbw.2qoK37CNBmMjMDRERSYUSE-YrjsTgGhHnxMeqOxjrAg"
Response
{
"id": "fwdreq_123",
"object": "forwarding.request",
"config": "fwdcfg_acct_TESTCONFIG_demo_payments",
"created": 1234567890,
"livemode": false,
"payment_method": "pm_456",
"request_details": {
"body": "{\"amount\":{\"value\":1000,\"currency\":\"usd\"},\"card\":{\"number\":\"424242******4242\",\"exp_month\":\"03\",\"exp_year\":\"2030\",\"cvc\":\"***\",\"name\":\"First Last\"},\"reference\":\"Your order number\"}",
"headers": [
{
"name": "Authorization",
"value": "Bearer *******************************************************************************************"
},
{
"name": "Content-Type",
"value": "application/json"
}
],
"http_method": "POST"
},
"request_context": {
"destination_ip_address": "35.190.113.80",
"destination_duration": 234
},
"response_details": {
"body": "'{\"transactionId\":\"example1234\"}'",
"headers": [
{
"name": "Content-Type",
"value": "application/json;charset=UTF-8"
}
],
"status": 200
},
"url": "https://forwarding-api-demo.stripedemos.com/payments",
"replacements": [
"card_number",
"card_expiry",
"card_cvc",
"cardholder_name"
]
}

Retrieve a ForwardingRequest

Retrieves a ForwardingRequest object.

Parameters

No parameters.

Returns

Returns a ForwardingRequest object.

GET /v1/forwarding/requests/:id
curl https://api.stripe.com/v1/forwarding/requests/fwdreq_123 \
-u "sk_test_4eC39Hq...arjtT1zdp7dcsk_test_4eC39HqLyjWDarjtT1zdp7dc:"
Response
{
"id": "fwdreq_123",
"object": "forwarding.request",
"config": "fwdcfg_acct_TESTCONFIG_demo_payments",
"created": 1234567890,
"livemode": false,
"payment_method": "pm_456",
"request_details": {
"body": "{\"amount\":{\"value\":1000,\"currency\":\"usd\"},\"card\":{\"number\":\"424242******4242\",\"exp_month\":\"03\",\"exp_year\":\"2030\",\"cvc\":\"***\",\"name\":\"First Last\"},\"reference\":\"Your order number\"}",
"headers": [
{
"name": "Authorization",
"value": "Bearer *******************************************************************************************"
},
{
"name": "Content-Type",
"value": "application/json"
}
],
"http_method": "POST"
},
"request_context": {
"destination_ip_address": "35.190.113.80",
"destination_duration": 234
},
"response_details": {
"body": "'{\"transactionId\":\"example1234\"}'",
"headers": [
{
"name": "Content-Type",
"value": "application/json;charset=UTF-8"
}
],
"status": 200
},
"url": "https://forwarding-api-demo.stripedemos.com/payments",
"replacements": [
"card_number",
"card_expiry",
"card_cvc",
"cardholder_name"
]
}

List all ForwardingRequests

Lists all ForwardingRequest objects.

Parameters

  • createdobject

    Similar to other List endpoints, filters results based on created timestamp. You can pass gt, gte, lt, and lte timestamp values.

  • ending_beforestring

    A pagination cursor to fetch the previous page of the list. The value must be a ForwardingRequest ID.

  • limitinteger

    A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.

  • starting_afterstring

    A pagination cursor to fetch the next page of the list. The value must be a ForwardingRequest ID.

Returns

Returns a list of ForwardingRequest objects.

GET /v1/forwarding/requests
curl -G https://api.stripe.com/v1/forwarding/requests \
-u "sk_test_4eC39Hq...arjtT1zdp7dcsk_test_4eC39HqLyjWDarjtT1zdp7dc:" \
-d limit=3
Response
{
"object": "list",
"url": "/v1/forwarding/requests",
"has_more": false,
"data": [
{
"id": "fwdreq_123",
"object": "forwarding.request",
"config": "fwdcfg_acct_TESTCONFIG_demo_payments",
"created": 1234567890,
"livemode": false,
"payment_method": "pm_456",
"request_details": {
"body": "{\"amount\":{\"value\":1000,\"currency\":\"usd\"},\"card\":{\"number\":\"424242******4242\",\"exp_month\":\"03\",\"exp_year\":\"2030\",\"cvc\":\"***\",\"name\":\"First Last\"},\"reference\":\"Your order number\"}",
"headers": [
{
"name": "Authorization",
"value": "Bearer *******************************************************************************************"
},
{
"name": "Content-Type",
"value": "application/json"
}
],
"http_method": "POST"
},
"request_context": {
"destination_ip_address": "35.190.113.80",
"destination_duration": 234
},
"response_details": {
"body": "'{\"transactionId\":\"example1234\"}'",
"headers": [
{
"name": "Content-Type",
"value": "application/json;charset=UTF-8"
}
],
"status": 200
},
"url": "https://forwarding-api-demo.stripedemos.com/payments",
"replacements": [
"card_number",
"card_expiry",
"card_cvc",
"cardholder_name"
]
}
{...}
{...}
],
}
Stripe Shell
Test mode
Welcome to the Stripe Shell! Stripe Shell is a browser-based shell with the Stripe CLI pre-installed. Log in to your Stripe account and press Control + Backtick (`) on your keyboard to start managing your Stripe resources in test mode. - View supported Stripe commands: - Find webhook events: - Listen for webhook events: - Call Stripe APIs: stripe [api resource] [operation] (e.g., )
The Stripe Shell is best experienced on desktop.
$