### List All Schedules using C# Source: https://docs.omise.co/en/schedules-api/international This C# example shows how to get a list of schedules, optionally specifying the order. It retrieves the total number of schedules. ```csharp var schedules = await Client.Schedules.GetList(order: Ordering.ReverseChronological); Console.WriteLine($"total schedules: {schedules.Total}"); ``` -------------------------------- ### Retrieve Account Information using C# Source: https://docs.omise.co/en/account-api/international This C# example demonstrates retrieving account information using the Omise C# client library. It shows how to build the request and get the account object. ```csharp var account = await Client.Account.Get(); Console.WriteLine($"account: {account.Email}"); ``` -------------------------------- ### Create Token with Node.js SDK Source: https://docs.omise.co/en/tokens-api/international This Node.js example demonstrates creating a token using the Omise Node.js SDK. Ensure you have installed the `omise` package and configured your public key. ```javascript const omise = require('omise')({ publicKey: 'pkey_test_no1t4tnemucod0e51mo', }); const token = await omise.tokens.create({ card: { name: 'JOHN DOE', city: 'Bangkok', postal_code: 10320, number: '4242424242424242', expiration_month: 2, expiration_year: 2027, security_code: 123, }, }); console.log(token); ``` -------------------------------- ### Start Omise MCP Server Locally via CLI Source: https://docs.omise.co/en/omise-mcp/international Command to start the Omise MCP server locally. Ensure the OMISE_SECRET_KEY environment variable is set. ```bash cd /path/to/your/omise-mcp npx tsx src/index.ts ``` -------------------------------- ### Installment Source Creation Response Source: https://docs.omise.co/en/installment-white-label-payments/international This is an example of the JSON response received after successfully creating an installment payment source. The 'id' field is the unique source identifier. ```json { "object": "source", "id": "src_test_6275raqws8zz5bm5oba", "livemode": false, "location": "/sources/src_test_6275raqws8zz5bm5oba", "amount": 400000, "barcode": null, "bank": null, "created_at": "2024-12-26T03:16:38Z", "currency": "THB", "email": null, "flow": "redirect", "installment_term": 4, "ip": "35.198.236.178", "absorption_type": "customer", "name": null, "mobile_number": null, "phone_number": null, "platform_type": null, "scannable_code": null, "billing": null, "shipping": null, "items": [], "references": null, "provider_references": null, "store_id": null, "store_name": null, "terminal_id": null, "type": "installment_wlb_ktc", "zero_interest_installments": false, "charge_status": "unknown", "receipt_amount": null, "discounts": [], "promotion_code": null } ``` -------------------------------- ### List All Schedules using Go Source: https://docs.omise.co/en/schedules-api/international This Go example demonstrates listing schedules with custom parameters like limit and from date. It initializes the client and performs the list operation. ```go client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.ScheduleList{} err := client.Do(result, &operations.ListSchedules{ List: operations.List{ Limit: 100, From: time.Now().Add(-1 * time.Hour), }, }) if err != nil { log.Fatalln(err) } log.Println(result) ``` -------------------------------- ### List Customers using Go Source: https://docs.omise.co/en/customers-api/international This Go example demonstrates initializing the Omise client and using the ListCustomers operation to retrieve a list of customers. It includes options for filtering and pagination. ```go client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.CustomerList{} err := client.Do(result, &operations.ListCustomers{ operations.List{ From: time.Now().Add(-1 * time.Hour), Limit: 100, }, }) if err != nil { log.Fatalln(err) } log.Println(result); ``` -------------------------------- ### Team Templates Parameters Source: https://docs.omise.co/en/payment-links-apis/international Example of parameters for team templates, including zero-interest installment options and timestamps. ```json { "zero_interest_installment": false, "created_at": "2024-04-17T08:35:55.390Z", "updated_at": "2024-04-17T08:35:55.390Z" } ] } ``` -------------------------------- ### Create Token with Go SDK Source: https://docs.omise.co/en/tokens-api/international This Go example shows how to create a token using the Omise Go SDK. It requires initializing the client with your public and secret keys and using the `operations.CreateToken` struct. ```go client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.Card{} err := client.Do(result, &operations.CreateToken{ Name: "Somchai Prasert", Number: "4242424242424242", ExpirationMonth: 10, ExpirationYear: 2025, City: "Bangkok", PostalCode: "10320", SecurityCode: "123", }) if err != nil { log.Fatalln(err) } log.Println(result) ``` -------------------------------- ### Retrieve a Schedule using C# Source: https://docs.omise.co/en/schedules-api/international Retrieve a schedule object using the Omise C# SDK. This example shows how to get the total number of occurrences for a schedule. ```csharp var scheduleId = "schd_test_58fmj4fpu2zpp2m8s8c"; var schedule = await Client.Schedules.Get(scheduleId); Console.WriteLine($"charges made on schedule: {schedule.Occurrences.Total}"); ``` -------------------------------- ### List Customers using Ruby Source: https://docs.omise.co/en/customers-api/international This Ruby example shows how to set your API key and then list all customers using the Omise Ruby gem. ```ruby require "omise" Omise.secret_api_key = "skey_test_4xs8breq3htbkj03d2x" customers = Omise::Customer.list ``` -------------------------------- ### List Customers using Java Source: https://docs.omise.co/en/customers-api/international This Java example shows how to build a list request for customers and send it using the Omise Java client. It prints the total number of customers. ```java Request> request = new Customer.ListRequestBuilder().build(); ScopedList customers = client().sendRequest(request); System.out.printf("Total no. of customers: %d", customers.getTotal()); ``` -------------------------------- ### Retrieve a Token using C# Source: https://docs.omise.co/en/tokens-api/international Retrieve a token using the Omise C# SDK. This example assumes you have a Client instance and a method to get the token ID. ```csharp var tokenId = RetrieveTokenId(); var token = await Client.Tokens.Get(tokenId); Console.WriteLine($"token already used? {token.Used}"); ``` -------------------------------- ### List All Charges (Go) Source: https://docs.omise.co/en/charges-api/international Use the Omise Go SDK to list charges. This example demonstrates setting up the client and performing a list operation with custom parameters. ```go client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.ChargeList{} err := client.Do(result, &operations.ListCharges{ operations.List{ Limit: 100, From: time.Now().Add(-1 * time.Hour), }, }) if err != nil { log.Fatalln(err) } log.Println(result) ``` -------------------------------- ### FPX Source Creation Response Source: https://docs.omise.co/en/fpx/international Example JSON response received after successfully creating an FPX source. The 'id' attribute, starting with 'src', is the unique identifier for the source. ```json { "object": "source", "id": "src_test_5xsjiipa6l3cfmfgahy", "livemode": false, "location": "/sources/src_test_5xsjiipa6l3cfmfgahy", "amount": 400000, "barcode": null, "bank": "affin", "created_at": "2023-11-16T14:25:48Z", "currency": "MYR", "email": null, "flow": "redirect", "installment_term": null, "ip": null, "absorption_type": null, "name": null, "mobile_number": null, "phone_number": null, "platform_type": null, "scannable_code": null, "billing": null, "shipping": null, "items": [], "references": null, "provider_references": null, "store_id": null, "store_name": null, "terminal_id": null, "type": "fpx", "zero_interest_installments": null, "charge_status": "unknown", "receipt_amount": null, "discounts": [] } ``` -------------------------------- ### Retrieve a Schedule using Java Source: https://docs.omise.co/en/schedules-api/international Fetch a schedule using the Omise Java client. This example demonstrates building a request to get a schedule by its ID and printing its ID. ```java Request request = new Schedule.GetRequestBuilder("schd_test_57wedy7pc6v9i59xpbx").build(); Schedule schedule = client().sendRequest(request); System.out.printf("Schedule retrieved: %s", schedule.getId()); ``` -------------------------------- ### List Customers using Node.js Source: https://docs.omise.co/en/customers-api/international This Node.js example demonstrates how to list customers using the Omise library. It initializes the client and calls the customers.list method. ```javascript const omise = require('omise')({ secretKey: 'skey_test_no1t4tnemucod0e51mo', }); const customer = await omise.customers.list(); console.log(customer); ``` -------------------------------- ### Retrieve a Recipient using Java Source: https://docs.omise.co/en/recipients-api/international Retrieve a specific recipient's details using the Omise Java client. This example demonstrates how to get the recipient's email. ```java Request request = new Recipient.GetRequestBuilder("recp_test_4z6p7e0m4k40txecj5o").build(); Recipient recipient = client().sendRequest(request); System.out.printf("Recipient's email: %s", recipient.getEmail()); ``` -------------------------------- ### Create and charge a new source Source: https://docs.omise.co/en/charges-api/international This example demonstrates creating a charge by specifying a new source type, such as Alipay. ```APIDOC ## Create and charge a new source ### Description Creates a charge by specifying a new source type and a return URI for redirection. ### Method POST ### Endpoint https://api.omise.co/charges ### Parameters #### Request Body - **amount** (number) - Required - The amount to charge. - **currency** (string) - Required - The currency of the charge (e.g., 'thb'). - **return_uri** (string) - Required - The URI to redirect to after the charge is completed. - **source[type]** (string) - Required - The type of the source (e.g., 'alipay'). ### Request Example ```json { "amount": 100000, "currency": "thb", "return_uri": "https://www.omise.co/example_return_uri", "source[type]": "alipay" } ``` ``` -------------------------------- ### Create Token with C# SDK Source: https://docs.omise.co/en/tokens-api/international This C# example demonstrates creating a token using the Omise C# SDK. It requires initializing the `Client` and using the `Tokens.Create` method. ```csharp var token = await Client.Tokens.Create(new CreateTokenRequest { Name = "John Doe", Number = "4242424242424242", ExpirationMonth = 10, ExpirationYear = 2022, SecurityCode = "123", }); Console.WriteLine($"created token: {token.Id}"); ``` -------------------------------- ### Retrieve a Receipt (Java) Source: https://docs.omise.co/en/receipts-api/international Java code to retrieve a single receipt by its ID. This example shows how to build a get request and print the retrieved receipt's ID. ```java Request request = new Receipt.GetRequestBuilder("rcpt_59lezici7p7gt85hfwr").build(); Receipt receipt = client().sendRequest(request); System.out.printf("Retrieved receipt: %s", receipt.getId()); ``` -------------------------------- ### Retrieve Forex Rate using C# Source: https://docs.omise.co/en/forex-api/international Example of retrieving forex data using the Omise C# SDK. This snippet demonstrates how to get the rate and print it to the console. ```csharp var rate = await Client.Forex.Get("usd"); Console.WriteLine($"conversion from USD to THB: {rate.Rate}"); ``` -------------------------------- ### Destroy a Customer using Go Source: https://docs.omise.co/en/customers-api/international This Go example demonstrates initializing the Omise client and using the DestroyCustomer operation to delete a customer. It includes error handling and logs the result. ```go client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.Deletion{} err := client.Do(result, &operations.DestroyCustomer{ CustomerID: "cust_test_5g0221fe8iwtayocgja", }) if err != nil { log.Fatalln(err) } log.Println(result); ``` -------------------------------- ### Create an Internet Banking Source with Java Source: https://docs.omise.co/en/sources-api/international This Java snippet demonstrates creating an internet banking source using the Omise Java SDK. Ensure the client is initialized with your public key. ```java Client client = new Client("pkey_test_56bywcp7sk1qselsyqb"); Source source = client.sources().create(new Source.Create() .type(SourceType.InternetBankingScb) .amount(10000) .currency("thb")); System.out.println("created source: " + source.getId()); ``` -------------------------------- ### Create a charge and new customer Source: https://docs.omise.co/en/charges-api/international This example demonstrates how to create a charge for a new customer, including card details, metadata, and email. ```APIDOC ## Create a charge and new customer ### Description Creates a charge associated with a new customer, specifying card token, metadata, description, and email. ### Method POST ### Endpoint https://api.omise.co/charges ### Parameters #### Request Body - **amount** (number) - Required - The amount to charge. - **currency** (string) - Required - The currency of the charge (e.g., 'thb'). - **customer[card]** (string) - Required - The token for the card to be used. - **customer[metadata]** (string) - Optional - Metadata associated with the customer. - **customer[description]** (string) - Optional - A description for the customer. - **customer[email]** (string) - Optional - The email address of the customer. ### Request Example ```json { "amount": 100000, "currency": "thb", "customer[card]": "tokn_test_60kw4dxb9redghzf8zs", "customer[metadata]": "ORDER-1234", "customer[description]": "Details about the purchase", "customer[email]": "email@example.com" } ``` ``` -------------------------------- ### Create a recurring charge schedule Source: https://docs.omise.co/en/schedules-api/international This example demonstrates how to create a schedule for a recurring charge. The charge will occur every month on the 1st day, starting from '2025-01-01' and ending on '2025-12-31'. ```APIDOC ## POST /schedules ### Description Creates a new schedule for recurring charges or transfers. ### Method POST ### Endpoint https://api.omise.co/schedules ### Parameters #### Query Parameters - **every** (integer) - Required - The frequency interval for the schedule. - **period** (string) - Required - The period for the schedule (e.g., 'day', 'week', 'month'). - **on[days_of_month][]** (integer) - Optional - For monthly schedules, specifies the day(s) of the month. - **start_date** (string) - Required - The start date for the schedule in YYYY-MM-DD format. - **end_date** (string) - Required - The end date for the schedule in YYYY-MM-DD format. #### Request Body - **charge** (object) - Required - Details for the charge to be scheduled. - **customer** (string) - Required - The ID of the customer for the charge. - **amount** (integer) - Required - The amount for the charge. - **description** (string) - Optional - A description for the charge. ### Request Example ```json { "every": 3, "period": "month", "on": { "days_of_month": [1] }, "start_date": "2025-01-01", "end_date": "2025-12-31", "charge": { "customer": "cust_test_5g0221fe8iwtayocgja", "amount": 100000, "description": "Membership fee" } } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the created schedule. - **every** (integer) - The frequency interval. - **period** (string) - The period of the schedule. - **start_date** (string) - The start date. - **end_date** (string) - The end date. - **charge** (object) - Details of the scheduled charge. #### Response Example ```json { "id": "schd_test_no1t4tnemucod0e51mo", "object": "schedule", "created": "2024-01-01T10:00:00Z", "every": 3, "period": "month", "on": { "days_of_month": [1] }, "start_date": "2025-01-01", "end_date": "2025-12-31", "next_trigger_date": "2025-01-01", "charge": { "id": "chrg_test_no1t4tnemucod0e51mo", "object": "charge", "amount": 100000, "currency": "thb", "description": "Membership fee", "customer": "cust_test_5g0221fe8iwtayocgja" } } ``` ``` -------------------------------- ### List Recipient Transfer Schedules (C#) Source: https://docs.omise.co/en/schedules-api/international Retrieve a list of transfer schedules for a recipient in C#. This example shows using the Client object to get the list, ordering by reverse chronological. ```csharp var recipientId = "recp_test_58fkcajowtvy3pax0ak"; var schedules = await Client .Recipient(recipientId) .Schedules .GetList(order: Ordering.ReverseChronological); Console.WriteLine($"transfer schedule for recipients: {schedules.Total}"); ``` -------------------------------- ### List all disputes using Go Source: https://docs.omise.co/en/disputes-api/international Use the Omise Go client to list all disputes. This example shows client initialization and performing a general list operation. ```go client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.Dispute{} er := client.Do(result, &operations.ListDisputes{}) if err != nil { log.Fatalln(err) } log.Println(result) ``` -------------------------------- ### List All Receipts (Go) Source: https://docs.omise.co/en/receipts-api/international Go code to list receipts. This example shows how to initialize the client and perform a list operation, including error handling. ```go client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.Recipient{} list := &operations.List{Offset: 100, Limit: 20} err := client.Do(result, &operations.ListReceipts{List: *list}) if err != nil { log.Fatalln(err) } log.Println(result) ``` -------------------------------- ### List Customer Charge Schedules (C#) Source: https://docs.omise.co/en/schedules-api/international Retrieve a list of charge schedules for a customer in C#. This example demonstrates using the Client object to get the list, ordering by reverse chronological. ```csharp var customerId = "cust_test_59gbtlbjldnc8651pmp"; var schedules = await Client .Customer(customerId) .Schedules .GetList(order: Ordering.ReverseChronological); Console.WriteLine($"total schedule for customer: {schedules.Total}"); ``` -------------------------------- ### List Customer Charge Schedules (Go) Source: https://docs.omise.co/en/schedules-api/international List charge schedules for a customer using the Omise Go client. This example shows how to initialize the client and specify query parameters like Limit and From. ```go client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.ScheduleList{} err := client.Do(result, &operations.ListCustomerChargeSchedules{ CustomerID: "cust_test_no1t4tnemucod0e51mo", List: operations.List{ Limit: 100, From: time.Now().Add(-1 * time.Hour), } if err != nil { log.Fatalln(err) } log.Println(result) ``` -------------------------------- ### List Transfer Schedules (C#) Source: https://docs.omise.co/en/transfer-schedules-api/international Get a list of transfer schedules using the Omise C# SDK. The example shows how to retrieve schedules in reverse chronological order and print the total count. ```csharp var schedules = await Client .Transfers .Schedules .GetList(order: Ordering.ReverseChronological); Console.WriteLine($"total transfer schedules: {schedules.Total}"); ``` -------------------------------- ### Example Event Verification Workflow Source: https://docs.omise.co/en/api-webhooks/international This workflow demonstrates how to verify event data by performing an independent GET request after receiving a webhook. It's an alternative to signature verification when direct verification is not feasible. ```text 1. Receive `charge.complete` webhook 2. Extract Charge ID from the webhook payload 3. Perform GET request to `/charges/{CHARGE_ID}` 4. Verify the charge status independently ``` -------------------------------- ### List All Charges (C#) Source: https://docs.omise.co/en/charges-api/international Use the Omise C# SDK to list charges. This example demonstrates fetching charges with chronological ordering. ```csharp var charges = await Client.Charges.GetList(order: Ordering.Chronological); Console.WriteLine($"total charges: {charges.Total}"); ``` -------------------------------- ### Search using query and filters (PHP) Source: https://docs.omise.co/en/search-api/international PHP example demonstrating how to search for charges with specific filters like 'captured' and 'created'. Requires the Omise PHP library. ```php filter(array( 'captured' => true, 'created' => "today", )); print_r($search['data']); ``` -------------------------------- ### List Transfers (Go) Source: https://docs.omise.co/en/transfers-api/international This Go example demonstrates how to list transfers using the Omise Go SDK, with options to filter by time and limit. It logs the results or any errors. ```go client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.TransferList{} err := client.Do(result, &operations.ListTransfers{ operations.List{ Limit: 100, From: time.Now().Add(-1 * time.Hour), }, }) if err != nil { log.Fatalln(err) } log.Println(result) ``` -------------------------------- ### Install Omise Magento Plugin Source: https://docs.omise.co/en/magento-plugin/international Use composer to install the Omise Magento plugin. Run this command in your Magento installation directory. ```bash composer require omise/omise-magento ``` -------------------------------- ### Create an Installment Payment Charge (cURL) Source: https://docs.omise.co/en/charges-api/international Use this cURL command to create an installment payment charge. Specify the installment term for the source. ```bash curl https://api.omise.co/charges \ -u $OMISE_SECRET_KEY: \ -d "description=Charge with source" \ -d "amount=500000" \ -d "currency=THB" \ -d "return_uri=https://www.omise.co/example_return_uri" \ -d "source[type]=installment_kbank" \ -d "source[installment_term]=4" ``` -------------------------------- ### Create a Refund in Go Source: https://docs.omise.co/en/refunds-api/international This Go example shows how to create a refund for a charge using the Omise Go client. ```go client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.Recipient{} err := client.Do(result, &operations.CreateRefund{ ChargeID: "chrg_test_5g5idked981unmzjzhl", Amount: 2000, // THB 1,000.00 or JPY 100,000 }) if err != nil { log.Fatalln(err) } log.Println(result) ``` -------------------------------- ### Create PayPay Source with cURL Source: https://docs.omise.co/en/paypay/international This example shows how to create a PayPay source using a cURL request. Replace `$OMISE_PUBLIC_KEY` with your actual test public key. ```bash curl https://api.omise.co/sources \ -u $OMISE_PUBLIC_KEY: \ -d "amount=1000" \ -d "currency=JPY" \ -d "type=paypay" \ -d "items[0][name]=water bottle" \ -d "items[0][quantity]=2" \ -d "items[0][amount]=500" ``` -------------------------------- ### JSON Response Example Source: https://docs.omise.co/en/documents-api/international This is an example of a JSON response when retrieving document details. ```json { "object": "document", "livemode": false, "id": "docu_test_no1t4tnemucod0e51mo", "deleted": false, "filename": "this_is_fine.png", "location": "/disputes/dspt_test_no1t4tnemucod0e51mo/documents/docu_test_no1t4tnemucod0e51mo", "kind": "details_of_purchase", "download_uri": null, "created_at": "2019-12-31T12:59:59Z" } ``` -------------------------------- ### JSON Response Example Source: https://docs.omise.co/en/forex-api/international This is an example of the JSON response structure when retrieving forex data. ```json { "object": "forex", "location": "/forex/usd", "livemode": false, "base": "USD", "quote": "THB", "rate": 30.4847017 } ``` -------------------------------- ### JSON Response Example Source: https://docs.omise.co/en/balance-api/international This is an example of the JSON response structure when retrieving account balances. ```json { "object": "balance", "livemode": false, "location": "/balance", "currency": "THB", "total": 0, "transferable": 0, "reserve": 0, "created_at": "2019-12-31T12:59:59Z" } ``` -------------------------------- ### Create Customer with Card (Go) Source: https://docs.omise.co/en/customers-api/international Create a customer and attach a card using the Omise Go library. This snippet shows how to initialize the client and perform the create operation. ```go client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.Customer{} err := client.Do(result, &operations.CreateCustomer{ Email: "john.doe@example.com", Description: "John Doe (id: 30)", Card: "tokn_test_no1t4tnemucod0e51mo", }) if err != nil { log.Fatalln(err) } log.Println(result) ``` -------------------------------- ### JSON Response Example Source: https://docs.omise.co/en/search-api/international An example of a JSON response from a search query, detailing a 'transfer' object. ```json { "object": "search", "export": null, "data": [ { "object": "transfer", "id": "trsf_test_no1t4tnemucod0e51mo", "livemode": false, "location": "/transfers/trsf_test_no1t4tnemucod0e51mo", "fail_fast": false, "paid": false, "sent": false, "sendable": true, "currency": "thb", "amount": 47448, "fee": 3000, "metadata": {}, "recipient": "recp_test_no1t4tnemucod0e51mo", "transaction": null, "schedule": null, "bank_account": { "object": "bank_account", "account_type": null, "bank_code": null, "branch_code": null, "brand": "test", "created": "2019-12-31T12:59:59Z", "last_digits": "6789", "name": "DEFAULT BANK ACCOUNT" }, "failure_code": null, "failure_message": null, "created": "2019-12-31T12:59:59Z", "paid_at": null, "sent_at": null } ], "page": 1, "per_page": 1, "total": 2, "total_pages": 2, "filters": {}, "location": "/search", "order": "reverse_chronological", "query": "", "scope": "transfer" } ``` -------------------------------- ### Link Retrieval Example Call Source: https://docs.omise.co/en/payment-links-apis/international Example using cURL to retrieve details for a specific payment link by its ID. ```curl curl 'https://linksplus-api.omise.co/external/links/12838' \ -X GET \ -h 'Authorization: {{key}}' ``` -------------------------------- ### Create Charge with Token (Go) Source: https://docs.omise.co/en/charges-api/international Create a charge using a token with the Go SDK. Initialize the client with your public and secret keys. ```go client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.Charge{} err := client.Do(result, &operations.CreateCharge{ Amount: 204842, // THB 2,048.42 Currency: "thb", Card: "tokn_test_no1t4tnemucod0e51mo", }) if err != nil { log.Fatalln(err) } log.Println(result) ``` -------------------------------- ### Create an Installment Payment charge Source: https://docs.omise.co/en/charges-api/international This section demonstrates how to create a charge using installment payments, specifically with a KBank option. ```APIDOC ## Create an Installment Payment charge ### Description Creates a charge using an installment payment method, such as from KBank. ### Method POST ### Endpoint https://api.omise.co/charges ### Parameters #### Query Parameters - **description** (string) - Optional - A description for the charge. - **amount** (integer) - Required - The amount to charge. - **currency** (string) - Required - The currency of the charge (e.g., 'THB'). - **return_uri** (string) - Required - The URI to redirect the user to after payment. - **source[type]** (string) - Required - The type of the payment source, set to 'installment_kbank' for KBank installments. - **source[installment_term]** (integer) - Required - The number of installments. ### Request Example ```json { "description": "Charge with source", "amount": 500000, "currency": "THB", "return_uri": "https://www.omise.co/example_return_uri", "source": { "type": "installment_kbank", "installment_term": 4 } } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the charge. - **status** (string) - The current status of the charge. - **amount** (integer) - The charged amount. - **currency** (string) - The currency of the charge. - **return_uri** (string) - The return URI. - **source** (object) - Details about the payment source. - **type** (string) - The type of the source ('installment_kbank'). - **installment_term** (integer) - The number of installments. #### Response Example ```json { "id": "chrg_test_67890", "status": "pending", "amount": 500000, "currency": "THB", "return_uri": "https://www.omise.co/example_return_uri", "source": { "type": "installment_kbank", "installment_term": 4 } } ``` ``` -------------------------------- ### Create Token Request Example Source: https://docs.omise.co/en/tokens-api/international This example demonstrates how to create a new token using the Token API. It requires essential card details and recommends including billing address information for improved authorization rates. ```http POST https://vault.omise.co/tokens card[expiration_month]=12 card[expiration_year]=2024 card[name]=Somchai Prasert card[number]=4242 card[postal_code]=10320 card[city]=Bangkok card[country]=th card[street1]=1448/4 Praditmanutham Road card[email]=somchai.prasert@example.com card[phone_number]=+66811234567 card[security_code]=123 ``` -------------------------------- ### List All Charges (Java) Source: https://docs.omise.co/en/charges-api/international Use the Omise Java SDK to list charges. This example shows how to build a request and retrieve the total number of charges. ```java Request> request = new Charge.ListRequestBuilder().build(); ScopedList charges = client().sendRequest(request); System.out.printf("Total no. of charges: %d", charges.getTotal()); ``` -------------------------------- ### Card JSON Response Example Source: https://docs.omise.co/en/cards-api/international This is an example of a JSON response when retrieving card details. It includes all attributes associated with a card. ```json { "object": "card", "id": "card_test_no1t4tnemucod0e51mo", "livemode": false, "location": "/customers/cust_test_no1t4tnemucod0e51mo/cards/card_test_no1t4tnemucod0e51mo", "deleted": false, "street1": "1448/4 Praditmanutham Road", "street2": null, "city": "Bangkok", "state": null, "phone_number": "0123456789", "postal_code": "10320", "country": "th", "financing": "credit", "bank": "Bank of the Unbanked", "brand": "Visa", "fingerprint": "XjOdjaoHRvUGRfmZacMPcJtm0U3SEIIfkA7534dQeVw=", "first_digits": null, "last_digits": "4242", "name": "Somchai Prasert", "expiration_month": 12, "expiration_year": 2024, "security_code_check": true, "tokenization_method": null, "created_at": "2019-12-31T12:59:59Z" } ``` -------------------------------- ### Team Links Example Call Source: https://docs.omise.co/en/payment-links-apis/international Example using cURL to retrieve a list of all payment links associated with a specific team ID. ```curl curl 'https://linksplus-api.omise.co/external/3388/links' \ -X GET \ -h 'Authorization: {{key}}' ``` -------------------------------- ### Create a Charge (Go) Source: https://docs.omise.co/en/charges-api/international This Go snippet demonstrates creating a charge using the Omise client. It requires initializing the client with public and secret keys and then performing the create operation with charge details. ```go client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.Charge{} err := client.Do(result, &operations.CreateCharge{ Amount: 204842, // THB 2,048.42 Currency: "thb", ReturnURI: "http://www.example.com", Source: "src_test_no1t4tnemucod0e51mo", }) if err != nil { log.Fatalln(err) } log.Println(result) ``` -------------------------------- ### Token JSON Response Example Source: https://docs.omise.co/en/tokens-api/international This is an example of a JSON response when a token is successfully created. It includes details about the token and the associated card. ```json { "object": "token", "id": "tokn_test_no1t4tnemucod0e51mo", "livemode": false, "location": "https://vault.omise.co/tokens/tokn_test_no1t4tnemucod0e51mo", "used": false, "charge_status": "unknown", "card": { "object": "card", "id": "card_test_no1t4tnemucod0e51mo", "livemode": false, "location": null, "deleted": false, "street1": "1448/4 Praditmanutham Road", "street2": null, "city": "Bangkok", "state": null, "phone_number": "0123456789", "postal_code": "10320", "country": "th", "financing": "credit", "bank": "Bank of the Unbanked", "brand": "Visa", "fingerprint": "XjOdjaoHRvUGRfmZacMPcJtm0U3SEIIfkA7534dQeVw=", "first_digits": null, "last_digits": "4242", "name": "Somchai Prasert", "expiration_month": 12, "expiration_year": 2024, "security_code_check": true, "tokenization_method": null, "created_at": "2019-12-31T12:59:59Z" }, "created_at": "2019-12-31T12:59:59Z" } ```