### Run Spring Boot Application using Gradle (Shell) Source: https://developer.bitpay.com/reference/java-spring-boot-kiosk-demo This command executes the Gradle wrapper to clean the project and then run the Spring Boot application. It's the primary method for starting the kiosk demo after setup. Ensure you have Gradle installed or are using the provided wrapper. ```shell ./gradlew clean bootRun ``` -------------------------------- ### Install, Migrate, and Run Application (npm) Source: https://developer.bitpay.com/reference/nextjs-typescript-kiosk-demo This command sequence installs project dependencies, runs database migrations using npm, and starts the development server for the Next.js application. Ensure Node.js is installed and a BitPay test token is configured. ```shell npm install npm run migrate npm run dev ``` -------------------------------- ### Run BitPay SDK Setup Script Source: https://developer.bitpay.com/reference/node-full-sdk-getting-started Executes the BitPay SDK setup script to generate a private key and a JSON configuration file. This script guides the user through the process and is essential for using the merchant and payout facades. ```shell npx bitpay-sdk setup ``` -------------------------------- ### Run Docker Compose for PHP Kiosk Demo Source: https://developer.bitpay.com/reference/php-symfony-kiosk-demo This command starts the Docker containers necessary to run the PHP Symfony Kiosk Demo application. It assumes Docker is installed and configured, and the application's Docker Compose file is set up correctly. ```shell docker-compose up ``` -------------------------------- ### Get Settlements with PHP Source: https://developer.bitpay.com/reference/php-full-sdk-get-settlements Retrieves settlements using the BitPay SDK in PHP. This example fetches settlements for USD within the last year. Ensure the BitPay SDK is installed and configured. ```php $date = new \\DateTime(); $today = $date->format("Y-m-d"); $dateBefore = $date->modify('-365 day'); $oneMonthAgo = $dateBefore->format("Y-m-d"); $settlements = $bitpay->getSettlements(Currency::USD, $oneMonthAgo, $today); ``` -------------------------------- ### Initialize BitPay Client with Environment File (PHP) Source: https://developer.bitpay.com/reference/php-full-sdk-version-800 Initializes the BitPay client by providing the full path to a previously generated environment file (JSON or YML). This method is suitable for securely storing configuration details. ```php $bitpay = BitPaySDK\Client::create()->withFile([FULL_PATH_TO_THE_CONFIG_FILE]); ``` -------------------------------- ### Get Refund Requests by GUID Source: https://developer.bitpay.com/reference/python-sdk-get-all-refund-requests-on-an-invoice Retrieves all refund requests for a given invoice GUID. ```APIDOC ## GET /invoices/{invoiceId}/refunds ### Description Retrieves all refund requests associated with a specific invoice, identified by its GUID. ### Method GET ### Endpoint /invoices/{invoiceId}/refunds ### Parameters #### Path Parameters - **invoiceId** (string) - Required - The unique identifier (GUID) of the invoice for which to retrieve refund requests. ### Request Example ``` # Assuming 'bitpay' is an initialized BitPay client object refunds = bitpay.get_refund_by_guid('someGuid') ``` ### Response #### Success Response (200) - **refunds** (array) - A list of refund request objects associated with the invoice. - **id** (string) - The unique identifier of the refund request. - **invoiceId** (string) - The ID of the invoice this refund is associated with. - **amount** (number) - The amount to be refunded. - **currency** (string) - The currency of the refund amount. - **status** (string) - The current status of the refund request (e.g., "complete", "pending", "failed"). - **requestDate** (string) - The date and time the refund was requested. #### Response Example ```json { "refunds": [ { "id": "refund_abc123", "invoiceId": "someGuid", "amount": 100.50, "currency": "USD", "status": "complete", "requestDate": "2023-10-27T10:00:00Z" } ] } ``` ``` -------------------------------- ### Get Refund Request by GUID (Python) Source: https://developer.bitpay.com/reference/python-sdk-get-all-refund-requests-on-an-invoice Retrieves all refund requests for a given invoice using its unique GUID. This function requires an initialized BitPay client and the invoice's GUID as input. ```python bitpay.get_refund_by_guid('someGuid') ``` -------------------------------- ### Initialize BitPay Client with Separate Variables (C#) Source: https://developer.bitpay.com/reference/c-full-sdk-version-500 Initializes the BitPay client using individual parameters for environment, private key (as path or plain text), and API tokens. This offers flexibility for direct initialization without a configuration file. ```csharp // Initialize with separate variables. The Private Key can be passed as plain text or as full path string to the Key File. BitPay bitpay = new BitPay( Env.Test, "[PATH_TO_THE_PRIVATE_KEY_OR_PLAIN_TEXT_KEY]", new Env.Tokens(){ Merchant = "CE2WRSEExNFA4YdQyyDJmgVAot9FgXvXbo752TGA7eUj", Payout = "9pJ7fzW1GGeucVMcDrs7HDQfj32aNATCDnyY6YAaHUNo" } ); ``` -------------------------------- ### Get Refund by GUID Source: https://developer.bitpay.com/reference/nodejs-full-sdk-get-refund-by-guid Retrieves an existing refund request using its unique GUID. This is useful for checking the status or details of a previously initiated refund. ```APIDOC ## GET /rest/refunds/{guid} ### Description Retrieves an existing refund request using its unique GUID. ### Method GET ### Endpoint `/rest/refunds/{guid}` ### Parameters #### Path Parameters - **guid** (string) - Required - The BitPay refund ID. ### Request Example ```typescript // Assuming 'client' is an initialized BitPay client object const refundGuid = 'someRefundGuid'; const refund = await client.getRefund(refundGuid); console.log(refund); ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the refund. - **guid** (string) - The GUID of the refund. - **orderId** (string) - The ID of the associated order. - **amount** (number) - The refund amount. - **currency** (string) - The currency of the refund amount. - **status** (string) - The current status of the refund (e.g., 'complete', 'pending', 'failed'). - **created_at** (string) - The timestamp when the refund was created. - **updated_at** (string) - The timestamp when the refund was last updated. #### Response Example ```json { "id": "rf_12345abcde", "guid": "someRefundGuid", "orderId": "ord_abcdef12345", "amount": 100.50, "currency": "USD", "status": "complete", "created_at": "2023-10-27T10:00:00Z", "updated_at": "2023-10-27T10:05:00Z" } ``` ``` -------------------------------- ### Get Bills by Status in PHP Source: https://developer.bitpay.com/reference/php-full-sdk-retrieve-bills-by-status Retrieves a list of BitPay bills filtered by their status. This example uses the `getBills` method with a predefined `BillStatus` enum. Ensure the BitPay SDK is installed and configured. ```php $retrievedBill = $bitpay->getBills(BillStatus::Complete); ``` -------------------------------- ### Initialize BitPay Client with Environment File (JavaScript) Source: https://developer.bitpay.com/reference/node-sdk-500 Initializes the BitPay client by providing the full path to a previously generated environment file. This method simplifies setup by loading all necessary configuration from a single file. It requires the 'bitpay-sdk' package. ```javascript const {Client, Env, Currency, Models, Tokens} = require('bitpay-sdk'); let client = new Client(configFilePath); ``` -------------------------------- ### Initialize BitPay Client with Config File Path (C#) Source: https://developer.bitpay.com/reference/c-full-sdk-version-500 Initializes the BitPay client by providing the full path to a securely stored JSON configuration file. This method is suitable when the configuration is managed externally. ```csharp // Provide the full path to the env file which you have previously stored securely. BitPay bitpay = new BitPay("BitPay.config.json"); ``` -------------------------------- ### Get Refund by GUID using TypeScript Source: https://developer.bitpay.com/reference/nodejs-full-sdk-get-refund-by-guid Retrieves an existing refund request using its unique GUID. This function is part of the merchant facade and requires a client instance configured for BitPay API access. It takes the refund GUID as input and returns the refund object. ```typescript const refund = await client.getRefund('someRefundGuid'); ``` -------------------------------- ### Initialize BitPay Client with Data and HEX Private Key (PHP) Source: https://developer.bitpay.com/reference/php-full-sdk-version-800 Initializes the BitPay client using separate variables for environment, private key as a HEX string, and tokens. This method is useful when the private key is available as a HEX string. ```php $bitpay = BitPaySDK\Client::create()->withData( BitPaySDK\Env.Test, "[PRIVATE_KEY_AS_HEX_STRING]", new BitPaySDK\Tokens( "7UeQtMcsHamehE4gDZojUQbNRbSuSdggbH17sawtobGJ", //merchant "5j48K7pUrX5k59DLhRVYkCupgw2CtoEt8DBFrHo2vW47" //payroll ) ); ``` -------------------------------- ### GET /refunds//guid/{guid} Source: https://developer.bitpay.com/reference/retrieve-a-refund-by-guid-request Retrieve a Refund by GUID. This endpoint allows merchants to fetch refund details using a unique GUID. It supports both public and merchant facades, with specific header requirements for authentication. ```APIDOC ## GET /refunds//guid/{guid} ### Description Retrieve a Refund by GUID. This endpoint allows merchants to fetch refund details using a unique GUID. It supports both public and merchant facades, with specific header requirements for authentication. ### Method GET ### Endpoint https://test.bitpay.com/refunds//guid/{guid} ### Parameters #### Path Parameters - **guid** (string) - Required - A variable provided by the merchant and designed to be used by the merchant to correlate the refund with a refund ID in their system. #### Query Parameters - **token** (string) - Required - When fetching a refund via the `merchant` facade, pass the API token as a URL parameter - the same token used to create the invoice in the first place. #### Header Parameters - **Content-Type** (string) - Required - Must be set to `application/json` for requests to the BitPay API. - **X-Accept-Version** (string) - Required - Must be set to `2.0.0` for requests to the BitPay API. - **X-Identity** (string) - Optional/Required - The hexadecimal public key generated from the client private key. This header is optional for this endpoint when using the public facade, and required when using a `merchant` facade token. - **X-Signature** (string) - Optional/Required - The ECDSA signature of the full request URL concatenated with the request body, signed with your private key. This header is optional for this endpoint when using the public facade, and required when using a `merchant` facade token. ### Request Example ```json { "example": "Request details for retrieving a refund by GUID" } ``` ### Response #### Success Response (200) - **data** (object) - Contains the refund details. - **id** (string) - The unique identifier for the refund. - **invoice** (string) - The ID of the invoice associated with the refund. - **reference** (string) - A reference identifier for the refund. - **status** (string) - The current status of the refund (e.g., 'created'). - **amount** (integer) - The refund amount. - **transactionCurrency** (string) - The currency of the transaction. - **transactionAmount** (number) - The amount of the transaction. - **transactionRefundFee** (number) - The fee for the transaction refund. - **currency** (string) - The currency for the refund amount. - **lastRefundNotification** (string) - The timestamp of the last refund notification. - **refundFee** (number) - The refund fee. - **immediate** (boolean) - Indicates if the refund is immediate. - **buyerPaysRefundFee** (boolean) - Indicates if the buyer pays the refund fee. - **requestDate** (string) - The date the refund was requested. #### Response Example ```json { "data": { "id": "WoE46gSLkJQS48RJEiNw3L", "invoice": "Hpqc63wvE1ZjzeeH4kEycF", "reference": "Test refund", "status": "created", "amount": 10, "transactionCurrency": "BTC", "transactionAmount": 0.000594, "transactionRefundFee": 0.000002, "currency": "USD", "lastRefundNotification": "2021-08-29T20:45:35.368Z", "refundFee": 0.04, "immediate": false, "buyerPaysRefundFee": false, "requestDate": "2021-08-29T20:45:34.000Z" } } ``` ``` -------------------------------- ### Initialize BitPay Client with IConfiguration (C#) Source: https://developer.bitpay.com/reference/c-full-sdk-version-500 Initializes the BitPay client using an IConfiguration interface, typically built from a JSON configuration file. This approach integrates well with .NET Core's configuration system. ```csharp // Provide a IConfiguration Interface containing the same structure as in the json file. var configuration = new ConfigurationBuilder() .AddJsonFile("BitPay.config.json", false, false) .Build(); BitPay bitpay = new BitPay(configuration); ``` -------------------------------- ### BitPay Client Initialization with Config File (Java) Source: https://developer.bitpay.com/reference/java-full-sdk-version-900 Initializes the BitPay client using the full path to a configuration file. This method is suitable when all BitPay configuration details, including API tokens and private key information, are stored in a single JSON file. ```Java Client bitpay = new Client("[FULL_PATH_TO_THE_CONFIG_FILE]", null); ``` -------------------------------- ### Get Invoice by GUID (Java) Source: https://developer.bitpay.com/reference/java-full-sdk-retrieve-an-invoice-by-guid Retrieves a specific BitPay invoice using its GUID. Requires the invoice GUID, the facade (e.g., Facade.Merchant), and a boolean to indicate if the request should be signed. This method is part of the BitPay SDK. ```java Invoice getInvoice = bitpay.getInvoiceByGuid("f20d79e8-1687-40df-b732-0cbad78a0eb1", Facade.Merchant, true); ``` -------------------------------- ### Run PHP SDK Setup Script Source: https://developer.bitpay.com/reference/php-full-sdk-getting-started Executes the setup script provided with the BitPay PHP SDK to generate a private key and a JSON configuration file. This is a required step for using the merchant and payout facades. ```shell composer run setup ``` -------------------------------- ### GET /rest/v1/refunds/{guid} Source: https://developer.bitpay.com/reference/retrieve-a-refund-by-guid Retrieves an existing refund request by its globally unique identifier (GUID). This endpoint is useful for merchants to correlate refund requests with their internal refund IDs. ```APIDOC ## GET /rest/v1/refunds/{guid} ### Description Retrieves an existing refund request by its globally unique identifier (GUID). This endpoint is useful for merchants to correlate refund requests with their internal refund IDs. ### Method GET ### Endpoint /rest/v1/refunds/{guid} ### Parameters #### Path Parameters - **guid** (string) - Required - A variable provided by the merchant and designed to be used by the merchant to correlate the refund with a refund ID in their system. ### Request Example ```java Refund retieveRefund = bitpay.getRefundByGuid("f281d1d1-5c35-4e28-89bc-031e771c787c"); ``` ### Response #### Success Response (200) - **refund** (object) - The refund object containing details of the refund request. - **guid** (string) - The globally unique identifier for the refund. - **refundId** (string) - The merchant's internal refund ID. - **amount** (number) - The amount of the refund. - **currency** (string) - The currency of the refund. - **status** (string) - The current status of the refund (e.g., "pending", "completed", "failed"). #### Response Example ```json { "guid": "f281d1d1-5c35-4e28-89bc-031e771c787c", "refundId": "MERCHANT_REFUND_ID_123", "amount": 100.50, "currency": "USD", "status": "completed" } ``` ``` -------------------------------- ### Install Python SDK Dependencies Source: https://developer.bitpay.com/reference/python-sdk Installs the necessary dependencies for the Python BitPay SDK using pipenv. This is a prerequisite for running the setup script. ```shell pipenv install ``` -------------------------------- ### Initialize BitPay Client with Data and File Private Key (PHP) Source: https://developer.bitpay.com/reference/php-full-sdk-version-800 Initializes the BitPay client using separate variables for environment, private key file path, tokens, and master password. The private key is decrypted using the master password if it's encrypted. ```php $bitpay = BitPaySDK\Client::create()->withData( BitPaySDK\Env.Test, "[FULL_PATH_TO_THE_PRIVATE_KEY]", new BitPaySDK\Tokens( "7UeQtMcsHamehE4gDZojUQbNRbSuSdggbH17sawtobGJ", //merchant "5j48K7pUrX5k59DLhRVYkCupgw2CtoEt8DBFrHo2vW47" //payroll ), "YourMasterPassword" //used to decrypt your private key, if encrypted ); ``` -------------------------------- ### Update Refund by GUID Source: https://developer.bitpay.com/reference/nodejs-full-sdk-update-refund-by-guid Updates the status of a refund request from 'preview' to 'created'. This action confirms the refund request and starts the process of sending it to the shopper. ```APIDOC ## POST /rest/v1/refunds/{guid}/status ### Description Updates the status of a refund request from `preview` to `created`. This action confirms the refund request and starts the process of sending it to the shopper. ### Method POST ### Endpoint /rest/v1/refunds/{guid}/status ### Parameters #### Path Parameters - **guid** (string) - Required - The refund ID to update. #### Query Parameters - **status** (string) - Required - The new status for the refund to be updated. Set to `created` in order to confirm the refund request and initiate the flow to send it to shopper. ### Request Example ```typescript // Assuming 'client' is an initialized BitPay client object const refundGuid = 'myRefundId'; const newStatus = 'created'; const updatedRefund = await client.updateRefundByGuid(refundGuid, newStatus); ``` ### Response #### Success Response (200) - **status** (string) - The updated status of the refund. - **guid** (string) - The GUID of the refund. #### Response Example ```json { "status": "created", "guid": "myRefundId" } ``` ``` -------------------------------- ### GET /invoices/guid/{guid} Source: https://developer.bitpay.com/reference/retrieve-an-invoice-by-guid Retrieves an invoice using its unique GUID. This endpoint supports different facades and requires specific headers and query parameters for authentication and authorization. ```APIDOC ## GET /invoices/guid/{guid} ### Description Retrieves an Invoice by GUID. This endpoint is used to fetch invoice details using its globally unique identifier. ### Method GET ### Endpoint https://test.bitpay.com/invoices/guid/{guid} ### Parameters #### Path Parameters - **guid** (string) - Required - The guid of the invoice being retrieved #### Query Parameters - **token** (string) - Required - When fetching an invoice via the merchant or the pos facade, pass the API token as a URL parameter - the same token used to create the invoice in the first place. #### Header Parameters - **Content-Type** (string) - Required - Must be set to `application/json` for requests to the BitPay API - **X-Accept-Version** (string) - Required - Must be set to `2.0.0` for requests to the BitPay API - **X-Identity** (string) - Required - The hexadecimal public key generated from the client private key. This header is optional for this endpoint when using the public facade, and required when using a `merchant` facade token. - **X-Signature** (string) - Required - The ECDSA signature of the full request URL concatenated with the request body, signed with your private key. This header is optional for this endpoint when using the public facade, and required when using a `merchant` facade token. ### Request Example ```json { "example": "Request details for retrieving an invoice" } ``` ### Response #### Success Response (200) - **invoice** (object) - Details of the retrieved invoice #### Response Example ```json { "example": "Invoice details returned for a successful request" } ``` ``` -------------------------------- ### Run BitPay Java SDK Setup Script Source: https://developer.bitpay.com/reference/java-full-sdk-getting-started Executes the Maven command to run the setup script for the BitPay Java SDK. This script is used to generate the private key and a JSON configuration file required for the Merchant and Payout facades. ```shell mvn compile exec:java@setup ``` -------------------------------- ### Run Python SDK Setup Script Source: https://developer.bitpay.com/reference/python-sdk Executes the BitPay setup script to generate a private key and a JSON configuration file. This script is essential for using the Merchant and Payout facades. ```shell pipenv run python src/bitpay/bitpay_setup.py ``` -------------------------------- ### Get Refund Requests for Invoice API Response Source: https://developer.bitpay.com/reference/c-full-sdk-get-all-refund-requests-on-invoice Example JSON response structure for the GET /refunds endpoint, detailing the fields for each refund request associated with an invoice. Includes refund ID, invoice ID, status, amount, currency, and dates. ```json [ { "id":"H9DpXzrNLxSzpKcVKPDqD1", "invoice":"8g6B3UsQ9QWvjqFrrYBssm", "status":"canceled", "amount":1, "currency":"USD", "lastRefundNotification":"2021-12-21T14:34:14.695Z", "refundFee":0.09, "immediate":false, "buyerPaysRefundFee":false, "requestDate":"2021-12-21T14:34:14.000Z" }, { "id":"AtgkAGnW9RpAwqWs22mTF8", "invoice":"8g6B3UsQ9QWvjqFrrYBssm", "status":"canceled", "amount":1, "currency":"USD", "refundFee":0.09, "immediate":false, "buyerPaysRefundFee":false, "requestDate":"2021-12-21T14:34:21.000Z" }, { "id":"TPxL75VtRRuoNexUaNQ8da", "invoice":"8g6B3UsQ9QWvjqFrrYBssm", "status":"canceled", "amount":1, "currency":"USD", "refundFee":0.09, "immediate":false, "buyerPaysRefundFee":false, "requestDate":"2021-12-21T14:42:58.000Z" }, ... ] ``` -------------------------------- ### GET /payouts Source: https://developer.bitpay.com/reference/python-sdk-get-payouts Fetches a list of payouts. You can filter the results by specifying a start date, end date, status, reference, and control the number of results returned using limit and offset. ```APIDOC ## GET /payouts ### Description Retrieves a list of payouts filtered by query parameters such as date range, status, and reference. Supports pagination using limit and offset. ### Method GET ### Endpoint /payouts ### Parameters #### Query Parameters - **start_date** (string) - Required - The start date for the query (YYYY-MM-DD). - **end_date** (string) - Required - The end date for the query (YYYY-MM-DD). - **status** (string) - Optional - The status to filter payouts (e.g., 'complete', 'failed'). - **reference** (string) - Optional - The optional reference specified at payout request creation. - **limit** (integer) - Optional - Maximum number of results to return. Useful for paging. - **offset** (integer) - Optional - Offset for paging results. ### Request Example ``` GET /payouts?start_date=2023-08-14&end_date=2023-08-22&status=complete ``` ### Response #### Success Response (200) - **payouts** (array) - A list of payout objects. - **id** (string) - The unique identifier for the payout. - **amount** (number) - The amount of the payout. - **currency** (string) - The currency of the payout. - **status** (string) - The current status of the payout. - **reference** (string) - The reference provided during payout creation. - **created_at** (string) - The timestamp when the payout was created. #### Response Example ```json { "payouts": [ { "id": "payout_id_1", "amount": 100.50, "currency": "USD", "status": "complete", "reference": "ref123", "created_at": "2023-08-21T10:00:00Z" } ] } ``` ```