### C# HttpClient Example Source: https://dev-docs.streampay.sa/api/v2-subscriptions-freezes-list Example of how to make a GET request to list subscription freezes using HttpClient in C#. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://dev-app-service.streampay.sa/api/v2/subscriptions/:subscription_id/freeze"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Bearer "); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### C# HttpClient Example for Get Invoice Batch Source: https://dev-docs.streampay.sa/api/get-invoice-batch-example-csv-api-v-2-invoice-batches-example-get This C# example demonstrates how to make a GET request to the invoice batch example endpoint using HttpClient. It includes setting the Accept and Authorization headers. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://dev-app-service.streampay.sa/api/v2/invoice-batches/example"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Bearer "); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### C# HttpClient Example Source: https://dev-docs.streampay.sa/api/get-by-id-api-v-2-accounts-account-id-get Example of how to make a GET request to the account endpoint using C# HttpClient. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://dev-app-service.streampay.sa/api/v2/accounts/:account_id"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Bearer "); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### HttpClient Example in C# Source: https://dev-docs.streampay.sa/api/organization-revenue-api-v-2-analytics-revenue-get Example of how to make a GET request to the organization revenue API using HttpClient in C#. Ensure to replace `` with a valid JWT. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://dev-app-service.streampay.sa/api/v2/analytics/revenue"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Bearer "); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### C# HttpClient Example Source: https://dev-docs.streampay.sa/api/list-product-switch-groups-api-v-2-product-switch-groups-get Example of how to make a GET request to the product switch groups API using C# HttpClient. Ensure to replace `` with your actual JWT bearer token. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://dev-app-service.streampay.sa/api/v2/product-switch-groups"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Bearer "); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### C# HttpClient Example Source: https://dev-docs.streampay.sa/api/list-installment-rules-api-v-2-organization-settings-installment-rules-get This C# code snippet demonstrates how to make a GET request to the List Installment Rules API using HttpClient. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://dev-app-service.streampay.sa/api/v2/organization-settings/installment-rules"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Bearer "); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### C# Example: List Switchable Subscription Products Source: https://dev-docs.streampay.sa/api/list-switchable-subscription-products-api-v-2-consumer-portal-profile-subscription-subscription-id-switchable-products-get Demonstrates how to use HttpClient in C# to fetch switchable subscription products. Ensure you replace `` with a valid JWT. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://dev-app-service.streampay.sa/api/v2/consumer_portal/profile/subscription/:subscription_id/switchable-products"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Bearer "); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Get Short URL by ID - C# Example Source: https://dev-docs.streampay.sa/api/get-api-v-2-short-url-short-url-id-get Example using HttpClient in C# to make a GET request to the short URL API. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://dev-app-service.streampay.sa/api/v2/short-url/:short_url_id"); request.Headers.Add("Accept", "application/json"); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### List Products Request (C#) Source: https://dev-docs.streampay.sa/api/v2-products-list This C# example demonstrates how to make a GET request to the products endpoint using HttpClient. Ensure you replace `` with your actual JWT bearer token. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://dev-app-service.streampay.sa/api/v2/products"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Bearer "); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### C# Example for Creating a Pricing Table Source: https://dev-docs.streampay.sa/api/create-pricing-table-api-v-2-pricing-tables-post Demonstrates how to create a pricing table using HttpClient in C#. Ensure you replace `` with your actual JWT bearer token. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Post, "https://dev-app-service.streampay.sa/api/v2/pricing_tables"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Bearer "); var content = new StringContent("{\n \"name\": \"string\",\n \"default_currency\": \"SAR\",\n \"default_language\": \"ar\",\n \"display_settings\": {\n \"accent_color\": \"string\",\n \"accent_contrast_color\": \"string\",\n \"button_label\": \"string\",\n \"layout\": \"string\",\n \"font_family\": \"string\",\n \"headline\": \"string\",\n \"description\": \"string\"\n },\n \"payment_settings\": {\n \"collect_email\": true,\n \"collect_name\": true,\n \"collect_phone\": false,\n \"confirmation_message\": \"string\",\n \"success_redirect_url\": \"string\",\n \"failure_redirect_url\": \"string\"\n },\n \"custom_cta\": {\n \"pricing_table_price_id\": \"string\",\n \"label\": \"string\",\n \"url\": \"string\"\n },\n \"subscription_collision_policy\": \"BLOCK_WITH_MANAGE_URL\",\n \"prices\": [\n {\n \"product_id\": \"string\",\n \"product_price_id\": \"string\",\n \"display_order\": 0,\n \"is_highlighted\": false,\n \"marketing_features\": [\n {\n \"name\": \"string\"\n }\n ],\n \"trial_period_days\": 0\n }\n ]\n}", null, "application/json"); request.Content = content; var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### GET Request Example Source: https://dev-docs.streampay.sa/api/organization-s-outstanding-amount-in-time-range-api-v-2-analytics-outstanding-amount-get Demonstrates how to make a GET request to the outstanding amount API endpoint. ```http GET ## https://dev-app-service.streampay.sa/api/v2/analytics/outstanding-amount ``` -------------------------------- ### C# HttpClient Example Source: https://dev-docs.streampay.sa/api/switch-branch-api-v-2-authentication-switch-branch-post Demonstrates how to switch branches using C# HttpClient, including setting headers and sending the request. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Post, "https://dev-app-service.streampay.sa/api/v2/authentication/switch-branch"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Bearer "); var content = new StringContent("{\n \"branch_id\": \"3fa85f64-5717-4562-b3fc-2c963f66afa6\"\n}", null, "application/json"); request.Content = content; var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### C# HttpClient Example Source: https://dev-docs.streampay.sa/api/get-product-switch-group-api-v-2-product-switch-groups-group-id-get This C# code demonstrates how to make a GET request to fetch a product switch group using HttpClient. It includes setting the request URL, headers for Accept and Authorization, and handling the response. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://dev-app-service.streampay.sa/api/v2/product-switch-groups/:group_id"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Bearer "); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Successful Response Example Source: https://dev-docs.streampay.sa/api/list-installment-rules-api-v-2-organization-settings-installment-rules-get This example demonstrates the structure of a successful JSON response when retrieving installment rules. ```json [ { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "rule_type": "GLOBAL", "currency": "SAR", "minimum_amount": "string", "maximum_amount": "string", "installment_context_type": "INVOICE", "is_enabled": true, "options": [ { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "option_type": "PERCENTAGE", "installment_recurrence": "MONTHLY", "installment_weights": [ 0 ], "installment_split_amount": "string" } ] } ] ``` -------------------------------- ### C# HttpClient Example Source: https://dev-docs.streampay.sa/api/v2-me-get Example of how to make a GET request to the /api/v2/me endpoint using HttpClient in C#. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://dev-app-service.streampay.sa/api/v2/me"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Bearer "); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### C# HttpClient Example for Creating Organization Source: https://dev-docs.streampay.sa/api/create-organization-api-v-2-organization-post Demonstrates how to use C# HttpClient to send a POST request to create an organization. Ensure you replace `` with your actual Bearer token. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Post, "https://dev-docs.streampay.sa/api/v2/organization"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Bearer "); var content = new StringContent(string.Empty); content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); request.Content = content; var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### C# HttpClient Example for Activating Subscription Source: https://dev-docs.streampay.sa/api/activate-subscription-with-payment-api-v-2-consumer-portal-profile-subscription-subscription-id-activate-post This C# code snippet shows how to use HttpClient to send a POST request to activate a subscription, including setting the necessary headers for authorization and content. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Post, "https://dev-docs.streampay.sa/api/v2/consumer_portal/profile/subscription/:subscription_id/activate"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Bearer "); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Example API Request with Filters Source: https://dev-docs.streampay.sa/api/get-top-used-products-api-v-2-products-top-used-get Demonstrates how to use query parameters to filter products by the number of results, active status, and external metadata. This example requests 5 active products associated with the 'pro' plan. ```http /api/v2/products/top-used?n=5&active=true&external_metadata.plan=pro ``` -------------------------------- ### C# HttpClient Example Source: https://dev-docs.streampay.sa/api/get-zendesk-token-api-v-2-zendesk-token-get Example of how to make a GET request to the Zendesk token API using HttpClient in C#. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://dev-app-service.streampay.sa/api/v2/zendesk/token"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Bearer "); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Example API Request with Filters and Pagination Source: https://dev-docs.streampay.sa/api/v2-consumers-list Demonstrates how to use query parameters to search for consumers by name, filter by external metadata, and specify pagination. ```HTTP /api/v2/consumers?search_term=Acme&external_metadata.segment=enterprise&page=1&limit=20 ``` -------------------------------- ### C# HttpClient Example Source: https://dev-docs.streampay.sa/api/invoice-is-subscription-cancellable-api-v-2-invoices-invoice-id-subscription-cancellable-get Example of how to make a GET request to check subscription cancellability using HttpClient in C#. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://dev-app-service.streampay.sa/api/v2/invoices/:invoice_id/subscription/cancellable"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Bearer "); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### C# HttpClient Example Source: https://dev-docs.streampay.sa/api/v2-coupons-list Demonstrates how to make a GET request to the list coupons endpoint using C# HttpClient, including setting headers for authorization and content type. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://dev-app-service.streampay.sa/api/v2/coupons"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Bearer "); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### C# HttpClient Example Source: https://dev-docs.streampay.sa/api/get-consumer-me-api-v-2-consumer-portal-profile-consumer-me-get Demonstrates how to make a GET request to the Consumer Me API using HttpClient in C#. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://dev-app-service.streampay.sa/api/v2/consumer_portal/profile/consumer/me"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Bearer "); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### C# HttpClient Example Source: https://dev-docs.streampay.sa/api/get-conversion-rates-api-v-2-consumer-portal-conversion-rates-get Example of how to make a GET request to the conversion rates API using HttpClient in C#. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://dev-app-service.streampay.sa/api/v2/consumer_portal/conversion-rates"); request.Headers.Add("Accept", "application/json"); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### C# HttpClient Example Source: https://dev-docs.streampay.sa/api/get-consumer-card-list-api-v-2-consumer-portal-profile-cards-get Example of how to make a GET request to the consumer card list API using C# HttpClient. ```C# var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Get, "https://dev-app-service.streampay.sa/api/v2/consumer_portal/profile/cards"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Bearer "); var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Login Request Example (C# HttpClient) Source: https://dev-docs.streampay.sa/api/login-for-access-token-api-v-2-authentication-login-post Example of how to authenticate a user using C# HttpClient and retrieve access tokens. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Post, "https://dev-app-service.streampay.sa/api/v2/authentication/login"); request.Headers.Add("Accept", "application/json"); var content = new StringContent("{\n \"email\": \"user@example.com\",\n \"password\": \"string\",\n \"delivery_method\": \"SMS\"\n}", null, "application/json"); request.Content = content; var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Get Installment Rule by ID Source: https://dev-docs.streampay.sa/api/get-installment-rule-api-v-2-organization-settings-installment-rules-rule-id-get Fetches a specific installment rule using its unique identifier. Requires authentication with a Bearer token. ```APIDOC ## GET https://dev-app-service.streampay.sa/api/v2/organization-settings/installment-rules/:rule_id ### Description Retrieves the details of a specific installment rule. ### Method GET ### Endpoint /api/v2/organization-settings/installment-rules/:rule_id ### Parameters #### Path Parameters - **rule_id** (uuid) - Required - The unique identifier of the installment rule. ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier of the rule. - **rule_type** (InstallmentRuleType) - The type of the rule (`GLOBAL` or `CUSTOM`). - **currency** (CurrencyCode) - The ISO 4217 currency code. - **minimum_amount** (string) - The minimum amount for the rule to apply (nullable). - **maximum_amount** (string) - The maximum amount for the rule to apply (nullable). - **installment_context_type** (InstallmentRuleContextType) - The context in which the rule applies (`INVOICE` or `PAYMENT_LINKS`). - **is_enabled** (boolean) - Indicates if the rule is enabled. - **options** (object[]) - An array of installment options. - **id** (string) - The unique identifier of the option. - **option_type** (InstallmentOptionType) - The type of the option (`PERCENTAGE` or `AMOUNT`). - **installment_recurrence** (InstallmentSplitPeriodOption) - The recurrence period for the installment. - **installment_weights** (integer[]) - An array of installment weights (nullable). - **installment_split_amount** (string) - The split amount for the installment (nullable). #### Response Example (200 OK) ```json { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "rule_type": "GLOBAL", "currency": "SAR", "minimum_amount": "string", "maximum_amount": "string", "installment_context_type": "INVOICE", "is_enabled": true, "options": [ { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "option_type": "PERCENTAGE", "installment_recurrence": "MONTHLY", "installment_weights": [ 0 ], "installment_split_amount": "string" } ] } ``` #### Validation Error Response (422 Unprocessable Entity) - **detail** (object[]) - An array of validation error details. - **loc** (object[]) - The location of the validation error. - **msg** (string) - The error message. - **type** (string) - The error type. - **input** (any) - The input that caused the error. - **ctx** (object) - Additional context for the error. #### Response Example (422 Unprocessable Entity) ```json { "detail": [ { "loc": [ "string", 0 ], "msg": "string", "type": "string", "ctx": {} } ] } ``` #### Authorization - **name**: JWTBearer - **type**: http - **scheme**: bearer ``` -------------------------------- ### C# HttpClient Example Source: https://dev-docs.streampay.sa/api/update-consumer-profile-settings-api-v-2-organization-settings-consumer-profile-put Example of how to update consumer profile settings using C# HttpClient. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Put, "https://dev-app-service.streampay.sa/api/v2/organization-settings/consumer-profile"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Bearer "); var content = new StringContent("{\n \"product_switch\": true,\n \"add_remove_add_ons\": true,\n \"quantity_change\": true,\n \"subscription_cancelation\": true\n}", null, "application/json"); request.Content = content; var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Get Invoice Batch Example CSV Source: https://dev-docs.streampay.sa/api/get-invoice-batch-example-csv-api-v-2-invoice-batches-example-get Retrieves an example CSV file for invoice batches. Requires JWT Bearer token authentication. ```APIDOC ## GET /api/v2/invoice-batches/example ### Description Retrieves an example CSV of invoice batches. ### Method GET ### Endpoint https://dev-app-service.streampay.sa/api/v2/invoice-batches/example ### Authorization JWTBearer (Bearer Token) ### Responses #### Success Response (200) Returns an example CSV file. #### Response Example ``` [CSV content would be here] ``` ``` -------------------------------- ### C# HttpClient Example Source: https://dev-docs.streampay.sa/api/v2-products-prices-update Example of how to update a product price using HttpClient in C#. Ensure you replace `` with your actual JWT bearer token. ```csharp var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Put, "https://dev-app-service.streampay.sa/api/v2/products/:product_id/prices/:price_id"); request.Headers.Add("Accept", "application/json"); request.Headers.Add("Authorization", "Bearer "); var content = new StringContent("{\n \"amount\": 0,\n \"is_price_inclusive_of_vat\": true,\n \"is_price_exempt_from_vat\": true\n}", null, "application/json"); request.Content = content; var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync()); ``` -------------------------------- ### Example Request Body Source: https://dev-docs.streampay.sa/api/update-installment-settings-api-v-2-organization-settings-installment-put This example shows how to set a minimum installment amount and define custom split options. The `split_options` array replaces any existing configurations. ```json { "min_installment_amount": 100, "split_options": [ { "num_of_installments": 3, "split_period": "MONTHLY" }, { "num_of_installments": 6, "split_period": "QUARTERLY" } ] } ``` -------------------------------- ### Create Product Request Body Example (API Reference) Source: https://dev-docs.streampay.sa/api/v2-products-create This is a sample request body for creating a product, as shown in the API reference. It includes fields for product details, pricing, and recurrence. ```json { "name": "string", "description": "string", "price": 0, "prices": [ { "currency": "SAR", "amount": 0, "is_price_inclusive_of_vat": true, "is_price_exempt_from_vat": false } ], "is_one_time": false, "type": "RECURRING", "recurring_interval": "WEEK", "recurring_interval_count": 1, "is_price_exempt_from_vat": true, "is_price_inclusive_of_vat": true, "external_metadata": {} } ```