{"openapi":"3.1.0","info":{"title":"Forward Requests","version":"1.0.0","description":"This resource is used for forward request actions","contact":{"name":"Rainforest","email":"support@rainforestpay.com","url":"https://rainforestpay.com"}},"servers":[{"url":"https://api.sandbox.rainforestpay.com","description":"Sandbox server"},{"url":"https://api.rainforestpay.com","description":"Production server"}],"paths":{"/v1/payment_methods/{payment_method_id}/forward":{"post":{"operationId":"forward_payment_method","summary":"Forward payment method","description":"Forward payment method details to an approved 3rd party. This endpoint requires Rainforest approval.","parameters":[{"in":"header","name":"Rainforest-Api-Version","schema":{"type":"string","default":"2024-10-16","enum":["2024-10-16","2023-12-01"]}},{"in":"path","required":true,"name":"payment_method_id","schema":{"type":"string"},"description":"The unique payment method identifier. \n\nPrefix is \"mtd\" in production and \"sbx_mtd\" in sandbox.","examples":{"production":{"value":"mtd_2DrDRpyAdp5MPUJnrJmoZcMmtfF"},"sandbox":{"value":"mtd_2DrDRpyAdp5MPUJnrJmoZcMmtfF"}}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"description":"The 3rd party URL to forward the payment method details to. The platform must be approved to forward the request to the URL.","type":"string","example":"https://api.rainforestpay.com/v1/payment_methods","required":true},"http_method":{"description":"The HTTP Method to use to forward the request to the 3rd party.","type":"string","example":"POST","required":true},"headers":{"description":"HTTP Headers to include while forwarding the request to the 3rd party.","type":"object","required":true,"example":{"Authorization":"Bearer MY_API_KEY"}},"body":{"description":"The body template to use while forwarding the request to the 3rd party.","type":"string","required":true,"example":"{\"card_number\": \"{{ .card_number }}\"}"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"status":{"description":"Status of the request.\n\nIf the request status code is 2XX, then the `status` will be `SUCCESS`. If the request status code is 4XX or 5XX, then the `status` will be `ERROR`.","type":"string","enum":["SUCCESS","ERROR"],"example":"SUCCESS"},"data":{"description":"Response to Forward Request","type":"object","properties":{"forward_request_id":{"required":true,"description":"The unique Forward Request identifier. \n\nPrefix is \"fwd\" in production and \"sbx_fwd\" in sandbox.","type":"string","example":"fwd_2uaPg40kFgzQOiAd9un9p3yUkpq"},"url":{"type":"string","description":"The 3rd party URL the request was forwarded to.","required":true},"http_method":{"type":"string","description":"The HTTP Method used to forward the request.","required":true},"type":{"type":"string","description":"The type of forward request.","required":true,"oneOf":[{"const":"PAYMENT_METHOD","description":"Payment Method"}]},"payment_method_id":{"required":false,"description":"The unique payment method identifier. \n\nPrefix is \"mtd\" in production and \"sbx_mtd\" in sandbox.","type":"string","example":"mtd_2DrDRpyAdp5MPUJnrJmoZcMmtfF"},"merchant_id":{"required":false,"description":"The unique merchant identifier. \n\nPrefix is \"mid\" in production and \"sbx_mid\" in sandbox.","type":"string","example":"mid_2DrDFJPutxE5AIbJSopAnqniEbr"},"request_details":{"type":"object","properties":{"headers":{"description":"The HTTP request headers forwarded to the 3rd party.","type":"object","required":true,"additionalProperties":{"type":"array","items":{"type":"string"}}},"body":{"description":"The body template used to forward to the 3rd party.","type":"string","required":true}}},"response_details":{"type":"object","properties":{"headers":{"description":"The HTTP response headers returned from the 3rd party.","type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"description":"The HTTP response status code returned from the 3rd party.","type":"number","example":200},"body":{"description":"The HTTP response body returned from the 3rd party.","type":"string"}}}}},"errors":{"description":"List of errors, if applicable.","type":"array","items":{"type":"object","description":"Details of the error.","properties":{"field":{"description":"The field in the request that had an error, if applicable.","type":"string"},"code":{"description":"The code describing the error.","type":"string"},"message":{"description":"The description of the error related to the field.","type":"string"}}},"example":null}}}}}},"400":{"description":"Bad request, check for validation errors.","content":{"application/json":{"schema":{"description":"Default response object.","type":"object","properties":{"status":{"$ref":"#/paths/~1v1~1payment_methods~1{payment_method_id}~1forward/post/responses/200/content/application~1json/schema/properties/status"},"data":{"description":"Generic data object specified per resource, null if there are request errors.","type":"object","example":null,"nullable":true,"readOnly":true},"errors":{"$ref":"#/paths/~1v1~1payment_methods~1{payment_method_id}~1forward/post/responses/200/content/application~1json/schema/properties/errors"}}},"example":{"status":"ERROR","data":null,"errors":[{"field":"string","code":"RequestBody","message":"Invalid request payload"}]}}}},"401":{"description":"Authorization missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/paths/~1v1~1payment_methods~1{payment_method_id}~1forward/post/responses/400/content/application~1json/schema"},"example":{"status":"ERROR","data":null,"errors":[{"field":"string","code":"AuthUnauthorized","message":"Unauthorized"}]}}}},"403":{"description":"Authorization insufficient for requested action.","content":{"application/json":{"schema":{"$ref":"#/paths/~1v1~1payment_methods~1{payment_method_id}~1forward/post/responses/400/content/application~1json/schema"},"example":{"status":"ERROR","data":null,"errors":[{"field":"string","code":"AuthForbidden","message":"Forbidden"}]}}}},"404":{"description":"Resource not found.","content":{"application/json":{"schema":{"$ref":"#/paths/~1v1~1payment_methods~1{payment_method_id}~1forward/post/responses/400/content/application~1json/schema"},"example":{"status":"ERROR","data":null,"errors":[{"field":"string","code":"EntityNotFound","message":"Resource not found"}]}}}},"5XX":{"description":"Unexpected error.","content":{"application/json":{"schema":{"$ref":"#/paths/~1v1~1payment_methods~1{payment_method_id}~1forward/post/responses/400/content/application~1json/schema"},"example":{"status":"ERROR","data":null,"errors":[{"field":"string","code":"string","message":"Internal Server Error"}]}}}}},"tags":["Forward Requests"]}}},"tags":[{"name":"Forward Requests","description":"Resources for forwarding sensitive data to 3rd parties."}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"APIKey"}}},"security":[{"BearerAuth":[]}]}