Relay - Create

Create a Relay request to perform actions (for example, refunds) on a connector resource.

Example — cURL

curl --request POST \
  --url https://sandbox.hyperswitch.io/relay \
  --header 'Content-Type: application/json' \
  --header 'X-Idempotency-Key: <x-idempotency-key>' \
  --header 'X-Profile-Id: <x-profile-id>' \
  --header 'api-key: <api-key>' \
  --data '
{
  "connector_id": "mca_5apGeP94tMts6rg3U3kR",
  "connector_resource_id": "7256228702616471803954",
  "data": {
    "refund": {
      "amount": 6540,
      "currency": "USD"
    }
  },
  "type": "refund"
}
'

Successful response (200):


HTTP request

POST /

relay

Authorizations

  • Name: api-key

    • in: header

    • type: string

    • required: yes

Use the API key created under your merchant account from the HyperSwitch dashboard. API key is used to authenticate API requests from your merchant server only. Don't expose this key on a website or embed it in a mobile application.

Headers

  • X-Profile-Id (string) — required Profile ID for authentication

  • X-Idempotency-Key (string) — required Idempotency Key for relay request

  • Content-Type: application/json

Body (application/json)

  • connector_resource_id (string) — required The identifier that is associated to a resource at the connector reference to which the relay request is being made Example: "7256228702616471803954"

  • connector_id (string) — required Identifier of the connector (merchant connector account) which was chosen to make the payment Example: "mca_5apGeP94tMts6rg3U3kR"

  • type (enum) — required Available options: refund

  • data (object) — showchild attributes

Response (200 — application/json)

Relay request object with these fields:

  • id (string) — required The unique identifier for the Relay. Example: "relay_mbabizu24mvu3mela5njyhpit4"

  • status (enum) — required Available options: created, pending, success, failure

  • connector_resource_id (string) — required The identifier that is associated to a resource at the connector reference to which the relay request is being made Example: "pi_3MKEivSFNglxLpam0ZaL98q9"

  • connector_id (string) — required Identifier of the connector (merchant connector account) which was chosen to make the payment Example: "mca_5apGeP94tMts6rg3U3kR"

  • profile_id (string) — required The business profile that is associated with this relay request. Example: "pro_abcdefghijklmnopqrstuvwxyz"

  • type (enum) — required Available options: refund

  • error (object) — showchild attributes

  • connector_reference_id (string | null) The identifier that is associated to a resource at the connector to which the relay request is being made Example: "re_3QY4TnEOqOywnAIx1Mm1p7GQ"

  • data (object) — showchild attributes


Was this page helpful? Yes / No

Suggest edits: https://github.com/juspay/hyperswitch/edit/main/api-reference/v1/relay/relay.mdx Raise issue: https://github.com/juspay/hyperswitch/issues/new?title=Issue%20on%20docs&body=Path:%20/v1/relay/relay

Related:

  • https://api-reference.hyperswitch.io/v1/routing/routing--rule-evaluate

  • https://api-reference.hyperswitch.io/v1/relay/relay--retrieve