### UnixTimestamp Example Source: https://docs.chip-in.asia/chip-collect/api-reference/clients/create Provides an example of a Unix timestamp, representing seconds since the Unix epoch. This format is commonly used for date and time representation in systems. ```json { "type": "integer", "format": "Unix timestamp (seconds)", "example": 1619740800 } ``` -------------------------------- ### POST /purchases/ - Purchase Creation with Callback Source: https://docs.chip-in.asia/chip-collect/api-reference/clients/delete-recurring-tokens Creates a purchase and defines a target URL for success callbacks. ```APIDOC ## POST /purchases/ ### Description Creates a purchase and defines a target URL for success callbacks. The system will generate a callback when the purchase is successfully paid, captured, or paid using a recurring token. ### Method POST ### Endpoint `/purchases/` ### Parameters #### Request Body - **success_callback** (string) - Optional - The URL to receive purchase success callbacks. - **skip_capture** (boolean) - Optional - If `true`, capture is skipped upon creation. ### Request Example ```json { "amount": 100.00, "currency": "USD", "success_callback": "https://your.callback.url/purchase-success" } ``` ### Response #### Success Response (200) - **purchase_id** (string) - The ID of the created purchase. - **status** (string) - The current status of the purchase. #### Response Example ```json { "purchase_id": "pur_abc", "status": "created" } ``` ``` -------------------------------- ### GET Available Payment Methods API Request Source: https://docs.chip-in.asia/chip-collect/api-reference/payment-methods/list This example shows a GET request to the /api/v1/payment_methods/ endpoint. It requires `brand_id` and `currency` as query parameters. The same API key used for purchase creation should be used here to ensure the correct `test_mode` is applied. The response includes a list of payment method names. ```HTTP GET /api/v1/payment_methods/?brand_id=75a76529-91c7-4d98-90a9-8a641d70ee52¤cy=EUR ``` ```HTTP GET /api/v1/payment_methods/?brand_id=75a76529-91c7-4d98-90a9-8a641d70ee52¤cy=MYR ``` -------------------------------- ### Retrieve Webhook Public Key Source: https://docs.chip-in.asia/chip-collect/api-reference/clients/delete Obtain the public key for webhook authentication. This key is essential for verifying the authenticity of incoming callback payloads. It can be accessed via `Webhook.public_key` or through the GET /public_key/ endpoint. ```javascript const publicKey = Webhook.public_key; // or // fetch('/public_key/') followed by parsing the response. ``` -------------------------------- ### POST /clients/ Source: https://docs.chip-in.asia/chip-collect/api-reference/clients/create This endpoint is used to create a new client. Clients can be used to store card details for future purchases, enabling single-click payments. ```APIDOC ## POST /clients/ ### Description Creates a new client to store card details for future purchases. ### Method POST ### Endpoint /clients/ ### Parameters #### Request Body - **brand_id** (string) - Required - The ID of the brand associated with the client. - **api_key** (string) - Required - Your API key for authentication. ### Request Example ```json { "brand_id": "YOUR_BRAND_ID", "api_key": "YOUR_API_KEY" } ``` ### Response #### Success Response (201 Created) - **client_id** (string) - The unique identifier for the newly created client. #### Response Example ```json { "client_id": "clnt_abc123xyz789" } ``` ``` -------------------------------- ### Purchase Creation Parameters Source: https://docs.chip-in.asia/chip-collect/api-reference/purchases/create This section outlines the available parameters for creating a purchase, including redirection URLs, payment method whitelists, and origin information. ```APIDOC ## Purchase Object Details ### Description Provides details and configuration options for a purchase, including redirection URLs, payment method restrictions, and source information. ### Parameters #### Request Body Parameters - **minItems** (integer) - Optional - Minimum number of items (context unclear without full schema). - **payment_methods_whitelist** (array[string]) - Optional - A whitelist of payment methods available for this purchase. Use this to restrict payers to specific methods. Be aware that using this with certain purchase capabilities might result in no available payment methods, causing a validation error. - **items** (string) - Required - Payment method name as returned by `GET /payment_methods/`. - **success_redirect** (URL) - Optional - The URL to redirect the customer to upon successful payment. - **failure_redirect** (URL) - Optional - The URL to redirect the customer to upon payment failure. - **cancel_redirect** (URL) - Optional - The URL to redirect the customer to if they choose to cancel payment. This does not cancel the payment itself. Cannot contain `<>'"` symbols. - **success_callback** (URL) - Optional - The URL that will receive a POST request with the purchase data upon successful payment. - **creator_agent** (string) - Optional - Identification of the software used to create this purchase (max 32 characters). - **platform** (string) - Optional - The platform on which the purchase was created. Enum: `web`, `api`, `ios`, `android`, `macos`, `windows`. - **product** (string) - Optional - Defines the gateway product used for this purchase. Enum: `purchases`, `billing_invoices`, `billing_subscriptions`, `billing_subscriptions_invoice`. - **created_from_ip** (string) - Optional - The IP address from which the purchase was created. - **invoice_url** (URL) - Read-only - The URL where the invoice for this purchase can be accessed (if applicable). - **checkout_url** (URL) - Read-only - The URL to access the checkout for this purchase. Redirect customers here after creation. Can include a `preferred` query parameter to force a specific payment method checkout (`?preferred={payment_method}`). - **direct_post_url** (URL) - Read-only - The URL for Direct Post integration. Activated individually per merchant account. Will be null if payment is not possible or client details are required. ### Notes - Consult with your account manager for Direct Post integration or if you encounter issues with payment method availability. ``` -------------------------------- ### Visa Endpoint (Example) Source: https://docs.chip-in.asia/chip-collect/api-reference/payment-methods/list This section outlines the structure for a visa-related endpoint, including request and response examples and error handling. ```APIDOC ## POST /websites/chip-in_asia_chip-collect/visa ### Description This endpoint is designed to process visa-related information for the Chip-Collect project. It handles the submission of necessary data and returns a status indicating success or failure. ### Method POST ### Endpoint /websites/chip-in_asia_chip-collect/visa ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **visa_details** (object) - Required - Contains detailed information for the visa application. - **country** (string) - Required - The target country for the visa. - **application_id** (string) - Required - Unique identifier for the visa application. - **applicant_info** (object) - Required - Information about the applicant. - **name** (string) - Required - Full name of the applicant. - **dob** (string) - Required - Date of birth (YYYY-MM-DD). ### Request Example ```json { "visa_details": { "country": "SG", "application_id": "APP12345", "applicant_info": { "name": "John Doe", "dob": "1990-01-01" } } } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation (e.g., "processed"). - **message** (string) - A confirmation message. #### Response Example ```json { "status": "processed", "message": "Visa information submitted successfully." } ``` #### Error Response (400) - **__all__** (object) - Contains general error details. - **message** (string) - A descriptive error message explaining the issue. - **code** (string) - An error code for programmatic handling. #### Error Response Example ```json { "__all__": { "message": "Invalid visa details provided.", "code": "INVALID_INPUT" } } ``` ``` -------------------------------- ### Purchase Creation Parameters Source: https://docs.chip-in.asia/chip-collect/api-reference/purchases/charge This section details the parameters available when creating a purchase, including optional fields for currency conversion, payment method whitelisting, redirect URLs, and creation-specific information. ```APIDOC ## Purchase Object Details ### Description Details about the purchase object, including information about automatic currency conversion, payment method whitelisting, redirect URLs, and creation metadata. ### Parameters #### Request Body Fields - **automatic_conversion** (object) - Optional - Details about automatic currency conversion if it occurred. - **original_currency** (string) - Currency this purchase was initially created with. - **original_amount** (integer) - Amount this purchase was initially created with. - **exchange_rate** (number) - Exchanged rate that was used for currency conversion. Original amount was multiplied by this number to calculate the new purchase amount. - **payment_method_whitelist** (array of strings) - Optional - An optional whitelist of payment methods available for this purchase. Use this field if you want to restrict your payer to pay using only one or several specific methods. - **success_redirect** (URL) - Optional - When Purchase is paid for successfully, your customer will be taken to this link. Otherwise a standard screen will be displayed. - **failure_redirect** (URL) - Optional - If there's a payment failure for this Purchase, your customer will be taken to this link. Otherwise a standard screen will be displayed. - **cancel_redirect** (URL) - Optional - If you provide this link, customer will have an option to go to it instead of making payment (a button with 'Return to seller' text will be displayed). - **success_callback** (URL) - Optional - When Purchase is paid for successfully, the `success_callback` URL will receive a POST request with the Purchase object's data in body. - **creator_agent** (string) - Optional - Identification of software (e.g. an ecommerce module and version) used to create this purchase, if any. - **platform** (string) - Optional - Platform this Purchase was created on. Enum: `web`, `api`, `ios`, `android`, `macos`, `windows`. - **product** (string) - Optional - Defines which gateway product was used to create this Purchase. Enum: `purchases`, `billing_invoices`, `billing_subscriptions`, `billing_subscriptions_invoice`. - **created_from_ip** (string) - Optional - IP the Purchase was created from. - **invoice_url** (URL) - Optional - URL you will be able to access invoice for this Purchase at, if applicable. - **checkout_url** (URL) - Optional - URL you will be able to access the checkout for this Purchase at, if payment for it is possible. When building integrations, redirect the customer to this URL once purchase is created. ### Response Example (Success) ```json { "id": "pur_abc123", "amount": 1000, "currency": "USD", "status": "pending", "checkout_url": "https://chip-in.asia/checkout/pur_abc123" } ``` ``` -------------------------------- ### GET /company_statements/ Source: https://docs.chip-in.asia/chip-collect/api-reference/company-statements/list Retrieves a list of company statements. ```APIDOC ## GET /company_statements/ ### Description Retrieves a list of company statements. This endpoint may require specific authentication or authorization. ### Method GET ### Endpoint `/company_statements/` ### Parameters #### Query Parameters - **brand_id** (string) - Required - The ID of your brand. - **api_key** (string) - Required - Your API key for authentication. ### Request Example (No request body is typically needed for GET requests, parameters are usually in query string or headers) ### Response #### Success Response (200 OK) - **statements** (array) - A list of company statement objects. - **statement_id** (string) - The unique identifier for the statement. - **date** (string) - The date of the statement. - **url** (string) - A URL to access the statement document. #### Response Example ```json { "statements": [ { "statement_id": "stmt_001", "date": "2023-10-26", "url": "https://chip-in.asia/statements/stmt_001.pdf" }, { "statement_id": "stmt_002", "date": "2023-09-25", "url": "https://chip-in.asia/statements/stmt_002.pdf" } ] } ``` ``` -------------------------------- ### POST /webhooks/ Source: https://docs.chip-in.asia/chip-collect/api-reference/webhooks/create Creates a new webhook subscription. This allows your server to receive callback notifications when specific events occur on the Chip-in Asia platform. ```APIDOC ## POST /webhooks/ ### Description Create a webhook using the values provided in the parameters. The webhook enables the recipient to receive notifications via callback URL when selected events occur. ### Method POST ### Endpoint /webhooks/ ### Parameters #### Request Body - **title** (string) - Required - Arbitrary title of webhook (max 100 characters). - **all_events** (boolean) - Optional - Specifies this webhook should trigger on all event types. Either this or `events` is required. Defaults to false. - **events** (array of string) - Required - List of events to trigger webhook callbacks for. Either this or `all_events` is required. Minimum 1 item. - **callback** (string) - Required - The URL to receive webhook callback POST requests. ### Request Example ```json { "title": "My Purchase Webhook", "events": [ "purchase.created", "purchase.paid" ], "callback": "https://example.com/my-webhook-receiver" } ``` ### Response #### Success Response (201) - **id** (string) - Unique identifier for the webhook. - **title** (string) - The title of the webhook. - **all_events** (boolean) - Whether the webhook triggers on all events. - **events** (array of string) - The list of events the webhook listens for. - **callback** (string) - The callback URL. - **public_key** (string) - The public key for webhook signature verification. - **created_at** (string) - Timestamp when the webhook was created. - **updated_at** (string) - Timestamp when the webhook was last updated. #### Response Example ```json { "id": "whk_12345abcde", "title": "My Purchase Webhook", "all_events": false, "events": [ "purchase.created", "purchase.paid" ], "callback": "https://example.com/my-webhook-receiver", "public_key": "-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----", "created_at": "2023-10-27T10:00:00Z", "updated_at": "2023-10-27T10:00:00Z" } ``` #### Error Response (400) - **code** (string) - Error code. - **message** (string) - Error message. #### Error Response Example ```json { "code": "INVALID_PARAMETER", "message": "Callback URL is invalid." } ``` ``` -------------------------------- ### API Client Response Example (200 OK) Source: https://docs.chip-in.asia/chip-collect/api-reference/clients/create Represents a successful response when retrieving client data. The schema for the response content is a reference to the 'Client' schema defined elsewhere in the documentation. ```json { "schema": { "$ref": "#/components/schemas/Client" } } ``` -------------------------------- ### Get Balance by Currency Source: https://docs.chip-in.asia/chip-collect/api-reference/account/balance Retrieves the company balance for each currency. ```APIDOC ## GET /websites/chip-in_asia_chip-collect/balance ### Description Retrieves the company balance, mapped by currency. ### Method GET ### Endpoint /websites/chip-in_asia_chip-collect/balance ### Parameters None ### Response #### Success Response (200) - **BalanceByCurrency** (object) - A map where keys are currency codes and values are Balance objects. #### Response Example ```json { "EUR": { "balance": 93408, "fee_sell": 0, "reserved": 0, "gross_balance": 93408, "pending_outgoing": 0, "available_balance": 93408 }, "RUB": { "balance": 1111840, "fee_sell": 360, "reserved": 0, "gross_balance": 1112200, "pending_outgoing": 0, "available_balance": 1111840 }, "USD": { "balance": -35420, "fee_sell": 1880, "reserved": 0, "gross_balance": -33540, "pending_outgoing": 0, "available_balance": -35420 } } ``` ``` -------------------------------- ### POST /clients/ Source: https://docs.chip-in.asia/chip-collect/api-reference/clients/create Creates a new client record. Clients represent individual customers and are essential for issuing invoices and subscriptions. ```APIDOC ## POST /clients/ ### Description Creates a new client record. Clients represent individual customers and are essential for issuing invoices and subscriptions. ### Method POST ### Endpoint /clients/ ### Parameters #### Request Body - **email** (string) - Required - Client's email address. - **phone** (string) - Optional - Client's phone number. - **full_name** (string) - Optional - The full name of the client. Maximum length is 128 characters. - **personal_code** (string) - Optional - Personal identification code of the client. Maximum length is 32 characters. - **street_address** (object) - Optional - Client's street address details. - **country** (object) - Optional - Client's country. - **city** (object) - Optional - Client's city. - **zip_code** (object) - Optional - Client's zip code. - **state** (object) - Optional - Client's state. - **shipping_street_address** (object) - Optional - Client's shipping street address details. - **shipping_country** (object) - Optional - Client's shipping country. - **shipping_city** (object) - Optional - Client's shipping city. ### Request Example ```json { "email": "client@example.com", "full_name": "John Doe", "phone": "123-456-7890", "street_address": { "line1": "123 Main St" }, "country": { "code": "US" }, "city": { "name": "Anytown" }, "zip_code": { "code": "12345" } } ``` ### Response #### Success Response (201) - **id** (string) - Unique identifier for the client. - **email** (string) - Client's email address. - **phone** (string) - Client's phone number. - **full_name** (string) - The full name of the client. - **personal_code** (string) - Personal identification code of the client. - **street_address** (object) - Client's street address details. - **country** (object) - Client's country. - **city** (object) - Client's city. - **zip_code** (object) - Client's zip code. - **state** (object) - Client's state. - **shipping_street_address** (object) - Client's shipping street address details. - **shipping_country** (object) - Client's shipping country. - **shipping_city** (object) - Client's shipping city. #### Response Example ```json { "id": "cl_abc123xyz", "email": "client@example.com", "full_name": "John Doe", "phone": "123-456-7890", "street_address": { "line1": "123 Main St" }, "country": { "code": "US" }, "city": { "name": "Anytown" }, "zip_code": { "code": "12345" }, "created_at": "2023-10-27T10:00:00Z", "updated_at": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### Get Client Recurring Token OpenAPI Specification Source: https://docs.chip-in.asia/chip-collect/api-reference/clients/retrieve-recurring-tokens This OpenAPI specification defines the GET endpoint for retrieving recurring tokens associated with a client's purchase. It requires client_id and purchase_id as path parameters. The specification is written in YAML. ```yaml openapi: 3.1.0 info: title: Public REST API version: v1 description: > All the endpoints below have a prefix of `https://gate.chip-in.asia/api/v1` (e.g. `POST https://gate.chip-in.asia/api/v1/purchases`). You will need your API key that you can obtain in the Developers section in your account. Please use this key as a bearer token in the Authorization header included in every request: `Authorization: Bearer `. You can generate and manage your API keys here :
https://portal.chip-in.asia/collect/developers/api-keys Your Brand ID is required for certain endpoints. You can find it here :
https://portal.chip-in.asia/collect/developers/brands Before starting the development, we recommend checking out the list of ready-to-go connectors to the popular platforms we’ve already built for you. It might save you some precious time if you use one of these to develop your project. Plugins: [WooCommerce](https://gate.chip-in.asia/apis/plugins/WooCommerce%20v3.5+), [Gravity Forms](https://gate.chip-in.asia/apis/plugins/Gravity%20Forms), [OpenCart](https://gate.chip-in.asia/apis/plugins/OpenCart%20v3.0+), [Magento](https://gate.chip-in.asia/apis/plugins/Magento%20v2.0+), [PrestaShop](https://gate.chip-in.asia/apis/plugins/PrestaShop%20v1.7+) Libraries: [PHP](https://gate.chip-in.asia/apis/libraries/PHP), [Java](https://gate.chip-in.asia/apis/libraries/Java), [C#](https://gate.chip-in.asia/apis/libraries/C%23), [Node.js](https://gate.chip-in.asia/apis/libraries/Node.js) SDKs: [iOS](https://gate.chip-in.asia/apis/sdks/iOS), [Android](https://gate.chip-in.asia/apis/sdks/Android) *** # Online Purchases ## Prebuilt payment flow — Redirect Redirect integration allows running payments using the prebuilt payment flow. To accept payments in your application or website via redirect, use `POST /purchases/` request to create the `Purchase` and receive the `checkout_url`. Redirect the customer to the `checkout_url` to enter their card details for processing. After the payment is processed, the system will redirect the customer back to your website (take note of `success_redirect`, `failure_redirect`). *You have three options to check payment status:* 1. Use `success_callback` parameter of the `Purchase` object. 2. Use `GET /purchases//` request. 3. Set up a Webhook using the Developers section of your account or use Webhook API to listen to `purchase.paid`, or `purchase.payment_failure` event on your server. Setting the `skip_capture` flag to `true` allows you to separate the authentication and payment execution steps, allowing you to reserve funds on the customer's card account for some time. This flag can also enable preauthorization capability, allowing you to save the card without a financial transaction, if possible. If the customer agrees to store his card for future purchases, there will be an option to pay with a single click next time. To enable this, create a `Client` object for each of your clients and provide `client_id` parameter value in your Purchase creation requests. To create a Purchase or a BillingTemplate, you must specify the `Brand ID` and `API key`. You can find both in the Developers section of your account. ## Custom payment flow — Direct Post Direct post integration allows running payments through the custom payment flow. To accept payments in your application or website, use `POST /purchases/` request to create a `Purchase`. To capture customers card details use an HTML `
` hosted on your website with `method="POST"` and `action` pointing to the `direct_post_url` of the transaction. You will also need to fill the form with ``'s for the fields with card details. As a result, when a customer submits their card details, it will be posted straight to our system, allowing you to customize the checkout as you wish. At the same time, your PCI DSS requirement is only raised to Self-Assessment Questionnaire (SAQ A-EP), as your system doesn't receive or process card data. For more details, see the documentation on Purchase's `direct_post_url` field. ### Tokenization & recurring payments You can store card tokens and charge the respective cards without user interaction if the payment channel supports tokenization. When you pass `remember_card=on` to `direct_post_url`, the respective `Purchase`'s ID will serve as a card token. This initial `Purchase` will have the `is_recurring_token` field set to `true`. To charge the tokenized card once again, create a new Purchase and then call ``` -------------------------------- ### Webhook - POST /webhooks/ Source: https://docs.chip-in.asia/chip-collect/api-reference/webhooks/create This endpoint is used for setting up webhooks to receive notifications about payment events. It requires an API key for authentication. ```APIDOC ## POST /webhooks/ ### Description This endpoint is used to configure webhooks for receiving real-time notifications about payment events such as successful payments or payment failures. ### Method POST ### Endpoint /webhooks/ ### Parameters #### Request Body - **brand_id** (string) - Required - Your Brand ID, found in the Developers section. - **webhook_url** (string) - Required - The URL where the webhook events will be sent. - **event_types** (array of strings) - Optional - A list of event types to subscribe to (e.g., `["purchase.paid", "purchase.payment_failure"]`). ### Request Example ```json { "brand_id": "YOUR_BRAND_ID", "webhook_url": "https://your-app.com/webhook-handler", "event_types": [ "purchase.paid", "purchase.payment_failure" ] } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating the webhook has been set up. #### Response Example ```json { "message": "Webhook configured successfully." } ``` ``` -------------------------------- ### GET /public_key/ Source: https://docs.chip-in.asia/chip-collect/api-reference/clients/list Retrieves the public key used for signing callbacks. ```APIDOC ## GET /public_key/ ### Description Retrieves the public key used for signing callbacks. ### Method GET ### Endpoint /public_key/ ### Parameters None ### Request Example (No request body) ### Response #### Success Response (200) - **public_key** (string) - The public key for callback verification. #### Response Example { "public_key": "-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----" } ``` -------------------------------- ### POST /purchases/ Source: https://docs.chip-in.asia/chip-collect/api-reference/clients/retrieve Creates a purchase for processing payments. You can choose between a redirect flow (receiving a checkout URL) or a direct post flow (receiving a direct_post_url to submit card details). The endpoint requires a Brand ID and API key. Optional parameters include success/failure redirects, callbacks, and client IDs for recurring payments. ```APIDOC ## POST /purchases/ ### Description Creates a purchase for processing payments. Supports both redirect and direct post integration flows. Requires Brand ID and API key. Can handle callbacks, redirects, and client association for recurring payments. ### Method POST ### Endpoint /purchases/ ### Parameters #### Query Parameters - **brand_id** (string) - Required - Your Brand ID. - **api_key** (string) - Required - Your API key. #### Request Body - **amount** (integer) - Required - The amount to charge in the smallest currency unit (e.g., cents). - **currency** (string) - Required - The currency code (e.g., 'EUR', 'USD'). - **success_redirect** (string) - Optional - URL to redirect the customer to upon successful payment. - **failure_redirect** (string) - Optional - URL to redirect the customer to upon payment failure. - **success_callback** (string) - Optional - URL to receive payment status notifications. - **client_id** (string) - Optional - ID of the client for recurring payments or card storage. - **skip_capture** (boolean) - Optional - If true, separates authentication and payment execution (preauthorization). - **remember_card** (boolean) - Optional - If true, stores the card for future use (tokenization). - **locale** (string) - Optional - The locale for the payment page (e.g., 'en', 'fr'). - **description** (string) - Optional - A description for the purchase. - **metadata** (object) - Optional - Custom key-value pairs. ### Request Example ```json { "amount": 1000, "currency": "EUR", "success_redirect": "https://yourwebsite.com/success", "failure_redirect": "https://yourwebsite.com/failure", "client_id": "cl_12345", "remember_card": true, "description": "Example purchase" } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the purchase. - **checkout_url** (string) - The URL to redirect the customer to for payment (for redirect flow). - **direct_post_url** (string) - The URL to post form data to for direct post integration. - **status** (string) - The current status of the purchase (e.g., 'pending', 'paid'). - **amount** (integer) - The charged amount. - **currency** (string) - The currency code. - **created_at** (string) - Timestamp of purchase creation. #### Response Example ```json { "id": "pur_abcdef123456", "checkout_url": "https://gate.chip-in.asia/checkout/abcdef123456", "direct_post_url": null, "status": "pending", "amount": 1000, "currency": "EUR", "created_at": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### Get Account Balance Source: https://docs.chip-in.asia/chip-collect/api-reference/account/balance Retrieves the current account balance in JSON format. ```APIDOC ## GET /account/json/balance/ ### Description Retrieves the current account balance in JSON format. ### Method GET ### Endpoint /account/json/balance/ ### Parameters #### Query Parameters - **api_key** (string) - Required - Your API key for authentication. ### Request Example ``` GET /account/json/balance/?api_key=YOUR_API_KEY ``` ### Response #### Success Response (200) - **balance** (number) - The current account balance. - **currency** (string) - The currency of the balance. #### Response Example ```json { "balance": 1500.75, "currency": "USD" } ``` ``` -------------------------------- ### Create Purchase via Redirect (OpenAPI) Source: https://docs.chip-in.asia/chip-collect/api-reference/purchases/charge This snippet outlines the OpenAPI definition for creating a purchase using the redirect payment flow. It requires brand ID and API key for authentication and returns a checkout URL for customer redirection. The documentation also details methods for checking payment status and options for preauthorization and one-click payments. ```yaml openapi: 3.1.0 info: title: Public REST API version: v1 description: > All the endpoints below have a prefix of `https://gate.chip-in.asia/api/v1` (e.g. `POST https://gate.chip-in.asia/api/v1/purchases`). You will need your API key that you can obtain in the Developers section in your account. Please use this key as a bearer token in the Authorization header included in every request: `Authorization: Bearer `. You can generate and manage your API keys here :
https://portal.chip-in.asia/collect/developers/api-keys Your Brand ID is required for certain endpoints. You can find it here :
https://portal.chip-in.asia/collect/developers/brands *** # Online Purchases ## Prebuilt payment flow — Redirect Redirect integration allows running payments using the prebuilt payment flow. To accept payments in your application or website via redirect, use `POST /purchases/` request to create the `Purchase` and receive the `checkout_url`. Redirect the customer to the `checkout_url` to enter their card details for processing. After the payment is processed, the system will redirect the customer back to your website (take note of `success_redirect`, `failure_redirect`). *You have three options to check payment status:* 1. Use `success_callback` parameter of the `Purchase` object. 2. Use `GET /purchases//` request. 3. Set up a Webhook using the Developers section of your account or use Webhook API to listen to `purchase.paid`, or `purchase.payment_failure` event on your server. Setting the `skip_capture` flag to `true` allows you to separate the authentication and payment execution steps, allowing you to reserve funds on the customer's card account for some time. This flag can also enable preauthorization capability, allowing you to save the card without a financial transaction, if possible. If the customer agrees to store his card for future purchases, there will be an option to pay with a single click next time. To enable this, create a `Client` object for each of your clients and provide `client_id` parameter value in your Purchase creation requests. To create a Purchase or a BillingTemplate, you must specify the `Brand ID` and `API key`. You can find both in the Developers section of your account. ``` -------------------------------- ### GET /public_key/ Source: https://docs.chip-in.asia/chip-collect/api-reference/clients/partial-update Retrieves the public key used for signing purchase callbacks. ```APIDOC ## GET /public_key/ ### Description Retrieves the public key used for signing asynchronous callbacks related to purchases. This public key can be used to verify the signature of callback payloads. ### Method GET ### Endpoint `/public_key/` ### Response #### Success Response (200) - **public_key** (string) - The public key in PEM format. #### Response Example ```json { "public_key": "-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----" } ``` ``` -------------------------------- ### Purchase Creation Details Source: https://docs.chip-in.asia/chip-collect/api-reference/purchases/mark-as-paid This section outlines the various fields that can be used when creating a purchase, including amounts, redirection URLs, callbacks, and platform information. ```APIDOC ## Purchase Object Fields ### Description Details about the fields available for a purchase object. ### Method N/A (Describes object fields, not a specific endpoint) ### Endpoint N/A ### Parameters #### Request Body Fields - **original_amount** (integer) - Amount this purchase was initially created with. - **exchange_rate** (number) - Exchanged rate that was used for currency conversion. Original amount was multiplied by this number to calculate the new purchase amount. - **payment_method_whitelist** (array) - An optional whitelist of payment methods available for this purchase. Use this field if you want to restrict your payer to pay using only one or several specific methods. - **items** (string) - Payment method name as returned by `GET /payment_methods/`. - **success_redirect** (URL) - When Purchase is paid for successfully, your customer will be taken to this link. Otherwise a standard screen will be displayed. - **failure_redirect** (URL) - If there's a payment failure for this Purchase, your customer will be taken to this link. Otherwise a standard screen will be displayed. - **cancel_redirect** (URL) - If you provide this link, customer will have an option to go to it instead of making payment (a button with 'Return to seller' text will be displayed). Can't contain any of the following symbols: `<>'"`. - **success_callback** (URL) - When Purchase is paid for successfully, the `success_callback` URL will receive a POST request with the Purchase object's data in body. - **creator_agent** (string) - Identification of software (e.g. an ecommerce module and version) used to create this purchase, if any. (maxLength: 32) - **platform** (string) - Platform this Purchase was created on. (enum: web, api, ios, android, macos, windows) - **product** (string) - Defines which gateway product was used to create this Purchase. (enum: purchases, billing_invoices, billing_subscriptions, billing_subscriptions_invoice) - **created_from_ip** (string) - IP the Purchase was created from. (format: IP) - **invoice_url** (URL) - URL you will be able to access invoice for this Purchase at, if applicable (nullable). - **checkout_url** (URL) - URL you will be able to access the checkout for this Purchase at, if payment for it is possible. When building integrations, redirect the customer to this URL once purchase is created. ``` -------------------------------- ### GET /purchases/{purchase_id}/ Source: https://docs.chip-in.asia/chip-collect/api-reference/account/turnover Retrieves the status of a specific purchase using its ID. ```APIDOC ## GET /purchases/{purchase_id}/ ### Description Retrieves the status and details of a specific purchase transaction using its unique identifier. ### Method GET ### Endpoint /purchases/{purchase_id}/ ### Parameters #### Path Parameters - **purchase_id** (string) - Required - The unique identifier of the purchase. #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **purchase_id** (string) - The unique identifier for the purchase. - **status** (string) - The current status of the purchase (e.g., 'pending', 'paid', 'failed'). - **amount** (number) - The purchase amount. - **currency** (string) - The currency of the purchase. #### Response Example ```json { "purchase_id": "PURCHASE_ABCDEF", "status": "paid", "amount": 50.00, "currency": "USD" } ``` ``` -------------------------------- ### Get Purchase Status Source: https://docs.chip-in.asia/chip-collect/api-reference/purchases/create Retrieves the status of a specific purchase using its unique identifier. ```APIDOC ## GET /purchases/{purchase_id}/ ### Description Retrieves the details and current status of a specific purchase. ### Method GET ### Endpoint /purchases/{purchase_id}/ ### Parameters #### Path Parameters - **purchase_id** (string) - Required - The unique identifier of the purchase. ### Response #### Success Response (200) - **purchase_id** (string) - The unique identifier for the purchase. - **status** (string) - The current status of the purchase (e.g., 'pending', 'paid', 'failed'). - **price** (integer) - The price of the purchase in the smallest currency unit. - **currency** (string) - The currency code for the purchase. - **items** (array) - A list of items included in the purchase. - **created_at** (string) - The timestamp when the purchase was created. #### Response Example ```json { "purchase_id": "pur_abc123xyz789", "status": "paid", "price": 10000, "currency": "RM", "items": [ { "name": "Example Product", "price": 10000, "quantity": 1 } ], "created_at": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### Create Purchase via Redirect Flow (POST /purchases/) Source: https://docs.chip-in.asia/chip-collect/api-reference/company-statements/schedule Initiates a payment transaction using the redirect flow. This endpoint returns a `checkout_url` that the customer is redirected to for payment processing. It supports options for success and failure redirects, callback URLs, and the `skip_capture` flag for preauthorization. Requires Brand ID and API Key. ```text POST /purchases/ ``` -------------------------------- ### Create Billing Template for Subscription Source: https://docs.chip-in.asia/chip-collect/api-reference/clients/update Create a billing template that can be used for subscriptions. Requires setting `is_subscription` to true and providing subscription-related fields. ```APIDOC ## POST /billing_templates/ ### Description Creates a billing template. When `is_subscription` is set to true, it configures a template for recurring subscription billing. ### Method POST ### Endpoint /billing_templates/ ### Parameters #### Request Body - **name** (string) - Required - The name of the billing template. - **is_subscription** (boolean) - Required - Set to `true` to create a subscription template. - **subscription_interval** (string) - Optional - The interval for subscription payments (e.g., "monthly", "yearly"). - **subscription_charge_period_end** (boolean) - Optional - If true, charges occur at the end of the billing cycle. - **subscription_trial_periods** (integer) - Optional - The number of free trial periods. ### Request Example ```json { "name": "Premium Subscription", "is_subscription": true, "subscription_interval": "monthly", "subscription_trial_periods": 1 } ``` ### Response #### Success Response (200) - **billing_template** (object) - The created billing template object. #### Response Example ```json { "billing_template_id": "bt_123", "name": "Premium Subscription", "is_subscription": true, "subscription_interval": "monthly", "subscription_charge_period_end": false, "subscription_trial_periods": 1 } ``` ``` -------------------------------- ### GET /purchases/{id}/ Source: https://docs.chip-in.asia/chip-collect/api-reference/purchases/charge Retrieves the details of a specific purchase using its unique identifier. ```APIDOC ## GET /purchases/{id}/ ### Description Retrieves the details of a specific purchase. This endpoint is useful for checking the status and details of a purchase after it has been created or processed. ### Method GET ### Endpoint /purchases/{id}/ ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the purchase to retrieve. #### Query Parameters None specified. #### Request Body None. ### Request Example ```json { "example": "No request body for GET request." } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier of the purchase. - **amount** (number) - The amount of the purchase. - **currency** (string) - The currency of the purchase. - **status** (string) - The current status of the purchase (e.g., 'paid', 'pending', 'failed'). - **created_at** (string) - Timestamp when the purchase was created. - **updated_at** (string) - Timestamp when the purchase was last updated. #### Response Example ```json { "id": "purchase_abc123", "amount": 100.00, "currency": "USD", "status": "paid", "created_at": "2023-10-27T10:00:00Z", "updated_at": "2023-10-27T10:05:00Z" } ``` ``` -------------------------------- ### GET /public_key/ Source: https://docs.chip-in.asia/chip-collect/api-reference/clients/delete-recurring-tokens Retrieves the public key used for signing purchase success callbacks. ```APIDOC ## GET /public_key/ ### Description Retrieves the public key used for signing purchase success callbacks. This public key can be used to verify the signature of incoming callback payloads. ### Method GET ### Endpoint `/public_key/` ### Response #### Success Response (200) - **public_key** (string) - The public key in PEM format. #### Response Example ```json { "public_key": "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA...\n-----END PUBLIC KEY-----" } ``` ```