### Go SDK Example for Get Subscription Lifecycle Settings Source: https://docs.paymentkit.com/api-reference/api-reference/accounts/get-subscription-lifecycle-settings.md Go example using the net/http package to call the Get Subscription Lifecycle Settings endpoint. Replace account_id and with your actual values. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://app.paymentkit.com/api/accounts/account_id/subscription-lifecycle-settings" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### List Packages Go Example Source: https://docs.paymentkit.com/api-reference/api-reference/packages/list-packages.md Go example using net/http to send a GET request with Bearer token and JSON body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://app.paymentkit.com/api/account_id/packages/" payload := strings.NewReader("{}") req, _ := http.NewRequest("GET", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Ruby SDK Example for Get Subscription Lifecycle Settings Source: https://docs.paymentkit.com/api-reference/api-reference/accounts/get-subscription-lifecycle-settings.md Ruby example using Net::HTTP to call the Get Subscription Lifecycle Settings endpoint. Replace account_id and with your actual values. ```ruby require 'uri' require 'net/http' url = URI("https://app.paymentkit.com/api/accounts/account_id/subscription-lifecycle-settings") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` -------------------------------- ### Java SDK Example for Get Subscription Lifecycle Settings Source: https://docs.paymentkit.com/api-reference/api-reference/accounts/get-subscription-lifecycle-settings.md Java example using Unirest to call the Get Subscription Lifecycle Settings endpoint. Replace account_id and with your actual values. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://app.paymentkit.com/api/accounts/account_id/subscription-lifecycle-settings") .header("Authorization", "Bearer ") .asString(); ``` -------------------------------- ### List Packages Ruby Example Source: https://docs.paymentkit.com/api-reference/api-reference/packages/list-packages.md Ruby example using net/http to send a GET request with Bearer token and JSON body. ```ruby require 'uri' require 'net/http' url = URI("https://app.paymentkit.com/api/account_id/packages/") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{}" response = http.request(request) puts response.read_body ``` -------------------------------- ### List Packages JavaScript Example Source: https://docs.paymentkit.com/api-reference/api-reference/packages/list-packages.md JavaScript example using fetch to GET the packages endpoint with Bearer token authentication. ```javascript const url = 'https://app.paymentkit.com/api/account_id/packages/'; const options = { method: 'GET', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### List Packages Java Example Source: https://docs.paymentkit.com/api-reference/api-reference/packages/list-packages.md Java example using Unirest to send a GET request with Bearer token and JSON body. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://app.paymentkit.com/api/account_id/packages/") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{}") .asString(); ``` -------------------------------- ### JavaScript SDK Example for Get Subscription Lifecycle Settings Source: https://docs.paymentkit.com/api-reference/api-reference/accounts/get-subscription-lifecycle-settings.md JavaScript example using fetch to call the Get Subscription Lifecycle Settings endpoint. Replace account_id and with your actual values. ```javascript const url = 'https://app.paymentkit.com/api/accounts/account_id/subscription-lifecycle-settings'; const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Python SDK Example for Get Subscription Lifecycle Settings Source: https://docs.paymentkit.com/api-reference/api-reference/accounts/get-subscription-lifecycle-settings.md Python example using the requests library to call the Get Subscription Lifecycle Settings endpoint. Replace account_id and with your actual values. ```python import requests url = "https://app.paymentkit.com/api/accounts/account_id/subscription-lifecycle-settings" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.json()) ``` -------------------------------- ### Get Processor Attempt with PHP Source: https://docs.paymentkit.com/api-reference/api-reference/payments-processor-attempts/get-processor-attempt.md PHP example using GuzzleHttp to send a GET request. Requires Guzzle installed via Composer. ```php request('GET', 'https://app.paymentkit.com/api/account_id/payments/processor_attempts/external_id', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` -------------------------------- ### PHP Guzzle Example Source: https://docs.paymentkit.com/api-reference/api-reference/accounts/get-fraud-settings.md Uses GuzzleHttp\Client to send a GET request. Requires the Guzzle library installed via Composer. ```php request('GET', 'https://app.paymentkit.com/api/accounts/account_id/fraud-settings', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` -------------------------------- ### Go SDK Example Source: https://docs.paymentkit.com/api-reference/api-reference/accounts/reset-dunning-settings.md Go example using net/http to delete dunning settings. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://app.paymentkit.com/api/accounts/account_id/dunning-settings" req, _ := http.NewRequest("DELETE", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### PHP GET MIT Settings Source: https://docs.paymentkit.com/api-reference/api-reference/accounts/get-mit-settings.md PHP example using GuzzleHttp client. Requires Guzzle installed via Composer. ```php request('GET', 'https://app.paymentkit.com/api/accounts/account_id/mit-settings', [ 'body' => '{}', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` -------------------------------- ### Get Payment Method - PHP Source: https://docs.paymentkit.com/api-reference/api-reference/payment-methods/get-payment-method.md PHP example using GuzzleHttp to GET a payment method. Requires Guzzle installed via Composer, sets Authorization header, and echoes the response body. ```php request('GET', 'https://app.paymentkit.com/api/account_id/payments/payment_methods/payment_method_id', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` -------------------------------- ### Go SDK Example Source: https://docs.paymentkit.com/api-reference/api-reference/accounts/update-subscription-lifecycle-settings.md Go example using net/http to send a PATCH request to update subscription lifecycle settings. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://app.paymentkit.com/api/accounts/account_id/subscription-lifecycle-settings" payload := strings.NewReader("{}") req, _ := http.NewRequest("PATCH", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Get 3Ds Settings - Response Example Source: https://docs.paymentkit.com/api-reference/api-reference/accounts/get-3-ds-settings.md Example response body for a successful 200 request to the Get 3Ds Settings endpoint. ```json { "merchant_category_code": "5999", "merchant_country_code": "USA", "merchant_website_url": "https://example.com" } ``` -------------------------------- ### Response Example Source: https://docs.paymentkit.com/api-reference/api-reference/upgrade-paths/list-transitions-from-product.md Example response containing a list of upgrade transitions from a source product, including target product details and transition rank. ```json { "source_product_id": "prod_9f8b7c6d5e4a3b2c1d0e", "transitions": [ { "path_id": "path_123abc456def789ghi", "target_product_id": "prod_1a2b3c4d5e6f7g8h9i0j", "target_product_name": "Premium Plus Plan", "transition_type": "upgrade", "rank": 1 }, { "path_id": "path_987zyx654wvu321tsr", "target_product_id": "prod_0j9i8h7g6f5e4d3c2b1a", "target_product_name": "Enterprise Plan", "transition_type": "upgrade", "rank": 2 } ] } ``` -------------------------------- ### C# SDK Example for Get Billing Status Source: https://docs.paymentkit.com/api-reference/api-reference/merchant-billing/get-billing-status.md C# example using RestSharp to make a GET request to the billing-status endpoint. Sets the Authorization header and executes the request. ```csharp using RestSharp; var client = new RestClient("https://app.paymentkit.com/api/account_id/billing-status"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Go SDK Example Source: https://docs.paymentkit.com/api-reference/api-reference/meters/reactivate-meter.md Uses the net/http package to create and send a POST request. Reads the response body and prints the status and body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://app.paymentkit.com/api/account_id/meters/meter_id/reactivate" payload := strings.NewReader("{}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Get Accounts Response Example Source: https://docs.paymentkit.com/api-reference/api-reference/accounts/get-accounts.md Example JSON response for the Get Accounts endpoint. Shows the structure of an account object including settings for billing, notifications, and fraud prevention. ```json [ { "id": "acc_dev_x7k9m2n4p8q1", "name": "Production Environment", "description": "Main production environment", "account_type": "production", "organization_id": "string", "settings": { "auto_deploy": true, "notifications": false }, "created_at": "2024-01-15T09:30:00Z", "updated_at": "2024-01-15T09:30:00Z", "is_sandbox": false, "parent_account_id": "acc_dev_abc123", "sandbox_account_count": 1, "is_archived": false, "brand_settings": { "icon": "https://storage.googleapis.com/bucket/icon.png", "icon_dark": "https://storage.googleapis.com/bucket/icon_dark.png", "logo": "https://storage.googleapis.com/bucket/logo.png", "logo_light": "https://storage.googleapis.com/bucket/logo_light.png", "brand_color": "#FF5733", "accent_color": "#3498DB", "custom_domain": "pay.example.com", "privacy_policy_url": "https://example.com/privacy", "terms_of_service_url": "https://example.com/terms", "statement_descriptor_prefix": "ACME" }, "invoice_settings": { "billing_address": { "line1": "123 Main St", "line2": "Suite 100", "line3": "Building A", "city": "San Francisco", "state": "CA", "country": "US", "zip_code": "94105" }, "tax_ids": [ { "value": "PBGPS03456H", "is_default": true } ], "custom_footer": "Thank you for your business!" }, "notification_settings": { "invoice": { "on_finalized": true, "on_paid": true }, "dunning": { "failed_payment": true }, "slack_enabled": true, "slack_webhook_urls": [ "string" ], "slack_payment_succeeded": true, "slack_payment_failed": true, "email_enabled": true, "emails_to_notify": [ "string" ], "email_payment_succeeded": true, "email_payment_failed": true, "email_config": { "from_email": "billing@example.com", "reply_to_email": "support@example.com", "email_signature_name": "John Smith", "email_signature_title": "Billing Department", "cc_recipients": [ "cc1@merchant.com", "cc2@merchant.com" ], "bcc_recipients": [ "bcc1@merchant.com", "bcc2@merchant.com" ], "primary_color": "#FF5733", "background_color": "#E8E8E8", "text_color": "#333333" } }, "billing_portal_settings": { "allow_update_sub": true, "allow_cancel_sub": true, "upgrade_immediate": true, "cancel_immediate": true, "downgrade_immediate": true, "hide_price_ids": [ "price_abc123", "price_def456" ], "support_email": "string" }, "dunning_settings": { "enable_retries": true, "enable_emails": true, "enable_outcome_emails": true, "contact_info": { "from_email": "billing@example.com", "reply_to_email": "support@example.com", "email_signature_title": "Billing Department", "email_signature_name": "John Smith", "cc_recipients": [ "cc1@merchant.com", "cc2@merchant.com" ], "bcc_recipients": [ "bcc1@merchant.com", "bcc2@merchant.com" ] }, "subscription_status_on_failure": "cancel", "invoice_status_on_failure": "mark_uncollectible", "apply_to_product_ids": [ "prod_abc123", "prod_def456" ], "settle_past_due_on_pm_update": true, "update_renewal_on_overdue_paid": true, "enable_incomplete_subscription_dunning": true }, "checkout_settings": { "session_expiration_minutes": 1440, "enable_posthog": true, "posthog_api_key": "phc_abcdef123456", "posthog_init_keys": { "api_host": "https://app.posthog.com", "autocapture": true }, "create_new_customer_per_session": true, "detach_failed_payment_method": true, "enable_promo_code": true, "default_country": "string", "billing_address_country": true, "billing_address_address": true, "billing_address_city_state": true, "billing_address_zip": true, "enable_shipping_address": true, "enable_consent_checkbox": true, "custom_checkbox_text": "string", "custom_footer_text": "string", "allow_duplicate_product_subscriptions": true, "primary_color": "string", "text_color": "string", "background_color": "string" }, "fraud_settings": { "enabled": false, "custom_message": "This payment method is not accepted." }, "mit_settings": { "cascading_enabled": true, "fallback_processor_1_id": "proc_dev_a1b2c3d4e5f6g7h8", "fallback_processor_2_id": "proc_dev_b2c3d4e5f6g7h8i9", "update_default_pm_on_fallback": false } } ] ``` -------------------------------- ### Go SDK Example Source: https://docs.paymentkit.com/api-reference/api-reference/payments-mappings/get-customer-mappings.md Sends a GET request using net/http, sets the Authorization header, and prints the response status and body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://app.paymentkit.com/api/account_id/payments/mappings/customers/customer_id" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Go Example Source: https://docs.paymentkit.com/api-reference/api-reference/accounts/update-billing-portal-settings.md Go example using net/http to send a PATCH request to the billing portal settings endpoint. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://app.paymentkit.com/api/accounts/account_id/billing-portal-settings" payload := strings.NewReader("{}") req, _ := http.NewRequest("PATCH", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Go SDK Example for Get Billing Status Source: https://docs.paymentkit.com/api-reference/api-reference/merchant-billing/get-billing-status.md Go example using the standard net/http library to make a GET request to the billing-status endpoint. Prints the response status and body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://app.paymentkit.com/api/account_id/billing-status" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Swift SDK Example for Get Meter Usage Daily Source: https://docs.paymentkit.com/api-reference/api-reference/meters/get-meter-usage-daily.md Swift example using URLSession to call the GET /api/account_id/meters/meter_id/usage-daily endpoint. Requires a valid Bearer token and start_time/end_time query parameters. ```swift import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "https://app.paymentkit.com/api/account_id/meters/meter_id/usage-daily?start_time=start_time&end_time=end_time")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### Go SDK Example Source: https://docs.paymentkit.com/api-reference/api-reference/meter-events/ingest-meter-events-batch.md Go example using net/http to POST meter events to the batch endpoint. It constructs the request with the Authorization header and prints the response body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://app.paymentkit.com/api/account_id/meter-events/batch" payload := strings.NewReader("{\n \"events\": [\n {\n \"event_name\": \"data_usage_reported\",\n \"payload\": {}\n }\n ]\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Go Example Source: https://docs.paymentkit.com/api-reference/api-reference/coupons/get-coupon.md Sends a GET request using the net/http package. Includes authorization header and prints the response. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://app.paymentkit.com/api/account_id/coupons/coupon_id" payload := strings.NewReader("{}") req, _ := http.NewRequest("GET", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### C# SDK Example for Get Meter Usage Daily Source: https://docs.paymentkit.com/api-reference/api-reference/meters/get-meter-usage-daily.md C# example using RestSharp to call the GET /api/account_id/meters/meter_id/usage-daily endpoint. Requires a valid Bearer token and start_time/end_time query parameters. ```csharp using RestSharp; var client = new RestClient("https://app.paymentkit.com/api/account_id/meters/meter_id/usage-daily?start_time=start_time&end_time=end_time"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` -------------------------------- ### PHP SDK Example for Get Meter Usage Daily Source: https://docs.paymentkit.com/api-reference/api-reference/meters/get-meter-usage-daily.md PHP example using GuzzleHttp to call the GET /api/account_id/meters/meter_id/usage-daily endpoint. Requires a valid Bearer token and start_time/end_time query parameters. ```php request('GET', 'https://app.paymentkit.com/api/account_id/meters/meter_id/usage-daily?start_time=start_time&end_time=end_time', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` -------------------------------- ### Go Example Source: https://docs.paymentkit.com/api-reference/api-reference/accounts/get-fraud-settings.md Performs a GET request using the net/http package. Prints the response status and body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://app.paymentkit.com/api/accounts/account_id/fraud-settings" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Java SDK Example for Get Meter Usage Daily Source: https://docs.paymentkit.com/api-reference/api-reference/meters/get-meter-usage-daily.md Java example using Unirest to call the GET /api/account_id/meters/meter_id/usage-daily endpoint. Requires a valid Bearer token and start_time/end_time query parameters. ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://app.paymentkit.com/api/account_id/meters/meter_id/usage-daily?start_time=start_time&end_time=end_time") .header("Authorization", "Bearer ") .asString(); ``` -------------------------------- ### SDK Code (Go) Source: https://docs.paymentkit.com/api-reference/api-reference/lifecycle/get-activation-checkout-url.md Go example using net/http to call the activation checkout URL endpoint. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://app.paymentkit.com/api/account_id/lifecycle/activation-checkout-url" payload := strings.NewReader("{}") req, _ := http.NewRequest("GET", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Go SDK example using net/http Source: https://docs.paymentkit.com/api-reference/api-reference/subscriptions/get-subscription-usage.md Go example using net/http to GET subscription usage. Sends an empty JSON body and prints the response. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://app.paymentkit.com/api/account_id/subscriptions/subscription_id/usage" payload := strings.NewReader("{}") req, _ := http.NewRequest("GET", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Ruby SDK Example for Get Meter Usage Daily Source: https://docs.paymentkit.com/api-reference/api-reference/meters/get-meter-usage-daily.md Ruby example using net/http to call the GET /api/account_id/meters/meter_id/usage-daily endpoint. Requires a valid Bearer token and start_time/end_time query parameters. ```ruby require 'uri' require 'net/http' url = URI("https://app.paymentkit.com/api/account_id/meters/meter_id/usage-daily?start_time=start_time&end_time=end_time") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` -------------------------------- ### Go SDK Example for Get Meter Usage Daily Source: https://docs.paymentkit.com/api-reference/api-reference/meters/get-meter-usage-daily.md Go example using net/http to call the GET /api/account_id/meters/meter_id/usage-daily endpoint. Requires a valid Bearer token and start_time/end_time query parameters. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://app.paymentkit.com/api/account_id/meters/meter_id/usage-daily?start_time=start_time&end_time=end_time" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Create Simulation with Go (net/http) Source: https://docs.paymentkit.com/api-reference/api-reference/simulations/create-simulation.md Go example using the standard net/http library to POST to the simulations endpoint. Includes error handling via ignored returns. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://app.paymentkit.com/api/simulations/" payload := strings.NewReader("{\n \"account_id\": \"acc_9f8b7c6d5e4a3b2c1d0e\",\n \"start_time\": \"2024-01-15T09:30:00Z\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### JavaScript SDK Example for Get Meter Usage Daily Source: https://docs.paymentkit.com/api-reference/api-reference/meters/get-meter-usage-daily.md JavaScript example using fetch to call the GET /api/account_id/meters/meter_id/usage-daily endpoint. Requires a valid Bearer token and start_time/end_time query parameters. ```javascript const url = 'https://app.paymentkit.com/api/account_id/meters/meter_id/usage-daily?start_time=start_time&end_time=end_time'; const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Swift SDK Example for Get Subscription Lifecycle Settings Source: https://docs.paymentkit.com/api-reference/api-reference/accounts/get-subscription-lifecycle-settings.md Swift example using URLSession to call the Get Subscription Lifecycle Settings endpoint. Replace account_id and with your actual values. ```swift import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "https://app.paymentkit.com/api/accounts/account_id/subscription-lifecycle-settings")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` -------------------------------- ### Go SDK Example for Get Meter Usage Summary Source: https://docs.paymentkit.com/api-reference/api-reference/meters/get-meter-usage-summary.md Uses net/http to create a GET request with an Authorization header, executes it, and prints the response status and body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://app.paymentkit.com/api/account_id/meters/meter_id/usage-summary?start_time=start_time&end_time=end_time" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### C# SDK Example for Get Subscription Lifecycle Settings Source: https://docs.paymentkit.com/api-reference/api-reference/accounts/get-subscription-lifecycle-settings.md C# example using RestSharp to call the Get Subscription Lifecycle Settings endpoint. Replace account_id and with your actual values. ```csharp using RestSharp; var client = new RestClient("https://app.paymentkit.com/api/accounts/account_id/subscription-lifecycle-settings"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` -------------------------------- ### PHP SDK Example for Get Subscription Lifecycle Settings Source: https://docs.paymentkit.com/api-reference/api-reference/accounts/get-subscription-lifecycle-settings.md PHP example using GuzzleHttp to call the Get Subscription Lifecycle Settings endpoint. Replace account_id and with your actual values. ```php request('GET', 'https://app.paymentkit.com/api/accounts/account_id/subscription-lifecycle-settings', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` -------------------------------- ### List Products SDK Code - Go Source: https://docs.paymentkit.com/api-reference/api-reference/products/list-products.md Go example using net/http to send a GET request to list products. Includes Authorization and Content-Type headers with an empty JSON body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://app.paymentkit.com/api/account_id/products/" payload := strings.NewReader("{}") req, _ := http.NewRequest("GET", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ```