github.com/stripe/stripe-go/v76@v76.25.0/forwarding_request.go (about)

     1  //
     2  //
     3  // File generated from our OpenAPI spec
     4  //
     5  //
     6  
     7  package stripe
     8  
     9  // The field kinds to be replaced in the forwarded request.
    10  type ForwardingRequestReplacement string
    11  
    12  // List of values that ForwardingRequestReplacement can take
    13  const (
    14  	ForwardingRequestReplacementCardCVC        ForwardingRequestReplacement = "card_cvc"
    15  	ForwardingRequestReplacementCardExpiry     ForwardingRequestReplacement = "card_expiry"
    16  	ForwardingRequestReplacementCardNumber     ForwardingRequestReplacement = "card_number"
    17  	ForwardingRequestReplacementCardholderName ForwardingRequestReplacement = "cardholder_name"
    18  )
    19  
    20  // The HTTP method used to call the destination endpoint.
    21  type ForwardingRequestRequestDetailsHTTPMethod string
    22  
    23  // List of values that ForwardingRequestRequestDetailsHTTPMethod can take
    24  const (
    25  	ForwardingRequestRequestDetailsHTTPMethodPOST ForwardingRequestRequestDetailsHTTPMethod = "POST"
    26  )
    27  
    28  // Lists all ForwardingRequest objects.
    29  type ForwardingRequestListParams struct {
    30  	ListParams `form:"*"`
    31  	// Similar to other List endpoints, filters results based on created timestamp. You can pass gt, gte, lt, and lte timestamp values.
    32  	Created *RangeQueryParams `form:"created"`
    33  	// Specifies which fields in the response should be expanded.
    34  	Expand []*string `form:"expand"`
    35  }
    36  
    37  // AddExpand appends a new field to expand.
    38  func (p *ForwardingRequestListParams) AddExpand(f string) {
    39  	p.Expand = append(p.Expand, &f)
    40  }
    41  
    42  // The headers to include in the forwarded request. Can be omitted if no additional headers (excluding Stripe-generated ones such as the Content-Type header) should be included.
    43  type ForwardingRequestRequestHeaderParams struct {
    44  	// The header name.
    45  	Name *string `form:"name"`
    46  	// The header value.
    47  	Value *string `form:"value"`
    48  }
    49  
    50  // The request body and headers to be sent to the destination endpoint.
    51  type ForwardingRequestRequestParams struct {
    52  	// The body payload to send to the destination endpoint.
    53  	Body *string `form:"body"`
    54  	// The headers to include in the forwarded request. Can be omitted if no additional headers (excluding Stripe-generated ones such as the Content-Type header) should be included.
    55  	Headers []*ForwardingRequestRequestHeaderParams `form:"headers"`
    56  }
    57  
    58  // Creates a ForwardingRequest object.
    59  type ForwardingRequestParams struct {
    60  	Params `form:"*"`
    61  	// The Forwarding Config used when making the forwarded request. The config specifes the HTTP method, merchant credentials, connection settings, and supported destination URLs.
    62  	Config *string `form:"config"`
    63  	// Specifies which fields in the response should be expanded.
    64  	Expand []*string `form:"expand"`
    65  	// The PaymentMethod to insert into the forwarded request. Forwarding previously consumed PaymentMethods is allowed.
    66  	PaymentMethod *string `form:"payment_method"`
    67  	// The field kinds to be replaced in the forwarded request.
    68  	Replacements []*string `form:"replacements"`
    69  	// The request body and headers to be sent to the destination endpoint.
    70  	Request *ForwardingRequestRequestParams `form:"request"`
    71  	// The destination URL for the forwarded request. Must be supported by the config.
    72  	URL *string `form:"url"`
    73  }
    74  
    75  // AddExpand appends a new field to expand.
    76  func (p *ForwardingRequestParams) AddExpand(f string) {
    77  	p.Expand = append(p.Expand, &f)
    78  }
    79  
    80  // Context about the request from Stripe's servers to the destination endpoint.
    81  type ForwardingRequestRequestContext struct {
    82  	// The time it took in milliseconds for the destination endpoint to respond.
    83  	DestinationDuration int64 `json:"destination_duration"`
    84  	// The IP address of the destination.
    85  	DestinationIPAddress string `json:"destination_ip_address"`
    86  }
    87  
    88  // The headers to include in the forwarded request. Can be omitted if no additional headers (excluding Stripe-generated ones such as the Content-Type header) should be included.
    89  type ForwardingRequestRequestDetailsHeader struct {
    90  	// The header name.
    91  	Name string `json:"name"`
    92  	// The header value.
    93  	Value string `json:"value"`
    94  }
    95  
    96  // The request that was sent to the destination endpoint. We redact any sensitive fields.
    97  type ForwardingRequestRequestDetails struct {
    98  	// The body payload to send to the destination endpoint.
    99  	Body string `json:"body"`
   100  	// The headers to include in the forwarded request. Can be omitted if no additional headers (excluding Stripe-generated ones such as the Content-Type header) should be included.
   101  	Headers []*ForwardingRequestRequestDetailsHeader `json:"headers"`
   102  	// The HTTP method used to call the destination endpoint.
   103  	HTTPMethod ForwardingRequestRequestDetailsHTTPMethod `json:"http_method"`
   104  }
   105  
   106  // HTTP headers that the destination endpoint returned.
   107  type ForwardingRequestResponseDetailsHeader struct {
   108  	// The header name.
   109  	Name string `json:"name"`
   110  	// The header value.
   111  	Value string `json:"value"`
   112  }
   113  
   114  // The response that the destination endpoint returned to us. We redact any sensitive fields.
   115  type ForwardingRequestResponseDetails struct {
   116  	// The response body from the destination endpoint to Stripe.
   117  	Body string `json:"body"`
   118  	// HTTP headers that the destination endpoint returned.
   119  	Headers []*ForwardingRequestResponseDetailsHeader `json:"headers"`
   120  	// The HTTP status code that the destination endpoint returned.
   121  	Status int64 `json:"status"`
   122  }
   123  
   124  // Instructs Stripe to make a request on your behalf using the destination URL and HTTP method in the config.
   125  // A config is set up for each destination URL by Stripe at the time of onboarding. Stripe verifies requests with
   126  // your credentials in the config, and injects card details from the payment_method into the request.
   127  //
   128  // Stripe redacts all sensitive fields and headers, including authentication credentials and card numbers,
   129  // before storing the request and response data in the forwarding Request object, which are subject to a
   130  // 30-day retention period.
   131  //
   132  // You can provide a Stripe idempotency key to make sure that requests with the same key result in only one
   133  // outbound request. The Stripe idempotency key provided should be unique and different from any idempotency
   134  // keys provided on the underlying third-party request.
   135  //
   136  // Forwarding Requests are synchronous requests that return a response or time out according to
   137  // Stripe's limits.
   138  //
   139  // Related guide: [Forward card details to third-party API endpoints](https://docs.stripe.com/payments/forwarding).
   140  type ForwardingRequest struct {
   141  	APIResource
   142  	// The Forwarding Config used when making the forwarded request. The config specifes the HTTP method, merchant credentials, connection settings, and supported destination URLs.
   143  	Config string `json:"config"`
   144  	// Time at which the object was created. Measured in seconds since the Unix epoch.
   145  	Created int64 `json:"created"`
   146  	// Unique identifier for the object.
   147  	ID string `json:"id"`
   148  	// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
   149  	Livemode bool `json:"livemode"`
   150  	// String representing the object's type. Objects of the same type share the same value.
   151  	Object string `json:"object"`
   152  	// The PaymentMethod to insert into the forwarded request. Forwarding previously consumed PaymentMethods is allowed.
   153  	PaymentMethod string `json:"payment_method"`
   154  	// The field kinds to be replaced in the forwarded request.
   155  	Replacements []ForwardingRequestReplacement `json:"replacements"`
   156  	// Context about the request from Stripe's servers to the destination endpoint.
   157  	RequestContext *ForwardingRequestRequestContext `json:"request_context"`
   158  	// The request that was sent to the destination endpoint. We redact any sensitive fields.
   159  	RequestDetails *ForwardingRequestRequestDetails `json:"request_details"`
   160  	// The response that the destination endpoint returned to us. We redact any sensitive fields.
   161  	ResponseDetails *ForwardingRequestResponseDetails `json:"response_details"`
   162  	// The destination URL for the forwarded request. Must be supported by the config.
   163  	URL string `json:"url"`
   164  }
   165  
   166  // ForwardingRequestList is a list of Requests as retrieved from a list endpoint.
   167  type ForwardingRequestList struct {
   168  	APIResource
   169  	ListMeta
   170  	Data []*ForwardingRequest `json:"data"`
   171  }