### Version Update Prompt Output Source: https://github.com/nickyvault/nicky-woocommerce-plugin/blob/main/BUILD.md Example of the interactive menu displayed when running the build script without arguments. ```text Current version: 1.0.1 Version Update Options: 1) Auto-increment patch version (recommended) 2) Enter custom version 3) Keep current version (1.0.1) Choose option [1-3]: ``` -------------------------------- ### Update Changelog Manually Source: https://github.com/nickyvault/nicky-woocommerce-plugin/blob/main/RELEASE.md This is an example of the changelog format to be updated manually in `readme.txt` for each release. ```text == Changelog == = 1.0.2 = * Fixed: Issue description * Improved: Enhancement description * Updated: Compatibility information ``` -------------------------------- ### Process WooCommerce Payments Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt Example flow for initiating a payment request and the expected response structure. ```php $gateway = new Nicky_WC_Gateway_Nicky(); $result = $gateway->process_payment($order_id); // Successful response structure: $result = array( 'result' => 'success', 'redirect' => 'https://pay.nicky.me/home?paymentId=ABC123', 'nicky_payment_url' => 'https://pay.nicky.me/home?paymentId=ABC123', 'open_in_new_tab' => true ); ``` -------------------------------- ### Get Accepted Assets Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt Lists all blockchain assets supported by the merchant account. ```bash curl -X GET "https://api-public.pay.nicky.me/AcceptedAsset/get-for-user" \ -H "Accept: text/plain" \ -H "x-api-key: YOUR_API_KEY" ``` -------------------------------- ### Test Built ZIP Locally Source: https://github.com/nickyvault/nicky-woocommerce-plugin/blob/main/RELEASE.md Instructions for testing the generated plugin ZIP file locally before uploading to WordPress.org. This involves extracting the ZIP and installing it in a local WordPress environment for verification. ```bash # Extract and test locally unzip nicky-me.zip -d test/ # Install in local WordPress environment # Verify all features work ``` -------------------------------- ### Get Conversion Quote Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt Calculates the cryptocurrency amount for a given fiat amount based on real-time exchange rates. ```php $body = array( 'amount' => 99.99, 'fromBlockchainId' => 'USD.USD', // Shop currency 'toBlockchainId' => 'BTC.BTC' // Target cryptocurrency ); ``` ```bash curl -X POST "https://api-public.pay.nicky.me/api/public/ConversionRate/get-quote" \ -H "Content-Type: application/json" \ -H "x-api-key: YOUR_API_KEY" \ -d '{ "amount": 99.99, "fromBlockchainId": "USD.USD", "toBlockchainId": "BTC.BTC" }' ``` -------------------------------- ### GET /api/public/WebHookApi/list Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt Retrieves a list of all registered webhooks for verification. ```APIDOC ## GET /api/public/WebHookApi/list ### Description Lists all registered webhooks for verification. ### Method GET ### Endpoint https://api-public.pay.nicky.me/api/public/WebHookApi/list ### Response #### Success Response (200) - **id** (string) - Unique identifier for the webhook - **webHookType** (string) - The type of event the webhook triggers on - **url** (string) - The callback URL for the webhook #### Response Example [ { "id": "webhook-uuid", "webHookType": "PaymentRequest_StatusChanged", "url": "https://yourstore.com/?wc-api=wc_gateway_nicky" } ] ``` -------------------------------- ### GET /api/public/PaymentRequestPublicApi/get-by-id and GET /api/public/PaymentRequestPublicApi/get-by-short-id Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt Retrieves the details of a payment request using its unique ID or its short ID. Useful for checking payment status. ```APIDOC ## GET /api/public/PaymentRequestPublicApi/get-by-id and GET /api/public/PaymentRequestPublicApi/get-by-short-id ### Description Retrieves payment request details by ID or shortId. ### Method GET ### Endpoint - `https://api-public.pay.nicky.me/api/public/PaymentRequestPublicApi/get-by-id?id=UUID` - `https://api-public.pay.nicky.me/api/public/PaymentRequestPublicApi/get-by-short-id?shortId=ABC123` ### Parameters #### Query Parameters - **id** (string) - Optional - The full unique identifier of the payment request. - **shortId** (string) - Optional - The short, shareable identifier of the payment request. ### Response #### Success Response (200) - **id** (string) - The unique identifier for the payment request. - **status** (string) - The current status of the payment request (e.g., 'Finished'). - **openAmountNative** (number) - The remaining amount to be paid in the native cryptocurrency. - **bill** (object) - Bill details. - **shortId** (string) - The short ID of the bill. - **blockchainAssetId** (string) - The ID of the blockchain asset used for the payment. ``` -------------------------------- ### GET /AcceptedAsset/get-for-user Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt Retrieves a list of all blockchain assets that are available for the merchant account. This includes details like asset name, ticker, and chain. ```APIDOC ## GET /AcceptedAsset/get-for-user ### Description Retrieves available blockchain assets for the merchant account. ### Method GET ### Endpoint https://api-public.pay.nicky.me/AcceptedAsset/get-for-user ### Response #### Success Response (200) - Returns an array of asset objects, each containing: - **id** (string) - The unique ID of the asset (e.g., 'BTC.BTC'). - **assetName** (string) - The full name of the asset (e.g., 'Bitcoin'). - **assetTicker** (string) - The ticker symbol of the asset (e.g., 'BTC'). - **assetChain** (string) - The blockchain chain the asset belongs to (e.g., 'BTC'). - **isFiat** (boolean) - Indicates if the asset is a fiat currency. - **decimalPrecisionUI** (integer) - The number of decimal places for UI display. ``` -------------------------------- ### Get Payment Status Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt Retrieves the current status of a payment request using its unique identifier or short ID. ```bash curl -X GET "https://api-public.pay.nicky.me/api/public/PaymentRequestPublicApi/get-by-short-id?shortId=ABC123" \ -H "Accept: application/json" \ -H "x-api-key: YOUR_API_KEY" ``` -------------------------------- ### GET /poll_order_by_short_id Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt Polls the Nicky API to check the payment status of an order using its short ID. Used for manual checks and AJAX updates. ```APIDOC ## GET /poll_order_by_short_id ### Description Polls the Nicky API to retrieve the current payment status for a given order using its short ID. This is useful for manual status checks and for providing real-time updates via AJAX on the frontend. ### Method GET ### Endpoint Internal gateway method. ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example ```php // Check payment status by Nicky shortId $gateway = new Nicky_WC_Gateway_Nicky(); $result = $gateway->poll_order_by_short_id('ABC123'); ``` ### Response #### Success Response (200) Returns an object containing the payment status details. - **status** (string) - The current payment status from Nicky (e.g., 'Finished'). - **is_paid** (boolean) - Indicates if the WooCommerce order is considered paid. - **open_amount** (float) - The remaining amount to be paid, if any. #### Response Example ```json { "status": "Finished", "is_paid": true, "open_amount": 0.0 } ``` ### AJAX Endpoint for Frontend Polling - **Action**: `nickym_check_nicky_payment_status` - **Required**: `order_id`, `nonce` (using `nicky_payment_nonce`) **JavaScript Usage Example (on thank-you page):** ```javascript jQuery.ajax({ url: nicky_payment_params.ajax_url, type: 'POST', data: { action: 'nickym_check_nicky_payment_status', order_id: 123, nonce: nicky_payment_params.nonce }, success: function(response) { if (response.success) { console.log('Payment status:', response.data.nicky_status); console.log('Order status:', response.data.order_status); console.log('Is paid:', response.data.is_paid); } } }); ``` ``` -------------------------------- ### Quick Commands Reference Source: https://github.com/nickyvault/nicky-woocommerce-plugin/blob/main/RELEASE.md A collection of useful bash commands for managing the plugin build and verification process, including interactive builds, specific version builds, checking current version, and verifying ZIP contents. ```bash # Interactive build (recommended) ./build-production.sh # Build specific version ./build-production.sh 1.0.2 # Build without version change ./build-production.sh --no-version # Check current version grep "Version:" Nicky/nicky-me.php | head -1 # Verify ZIP contents unzip -l nicky-me.zip | grep -E "\.php$|readme\.txt" # Check for debug files (should return nothing) unzip -l nicky-me.zip | grep debug ``` -------------------------------- ### Build Production ZIP via CLI Source: https://github.com/nickyvault/nicky-woocommerce-plugin/blob/main/BUILD.md Commands to trigger the production build process with different versioning strategies. ```bash ./build-production.sh ``` ```bash ./build-production.sh 1.0.2 ``` ```bash ./build-production.sh --no-version ``` -------------------------------- ### GitHub Actions Workflow for Building Plugin Source: https://github.com/nickyvault/nicky-woocommerce-plugin/blob/main/BUILD.md This workflow automates the build process for the Nicky WooCommerce plugin. It checks out the code, builds a production ZIP, and uploads it as an artifact. Ensure the build-production.sh script is executable. ```yaml name: Build Plugin on: [push] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Build Production ZIP run: ./build-production.sh - name: Upload Artifact uses: actions/upload-artifact@v2 with: name: plugin-zip path: nicky-me.zip ``` -------------------------------- ### Initialize German Translation PO File Source: https://github.com/nickyvault/nicky-woocommerce-plugin/blob/main/Nicky/languages/README.md Create a new Portable Object (PO) file for a specific language (e.g., German - de_DE) using the generated POT file. This file will contain the translatable strings. ```bash msginit -l de_DE -o languages/nicky-me-de_DE.po -i languages/nicky-me.pot ``` -------------------------------- ### Generate POT file for Translations Source: https://github.com/nickyvault/nicky-woocommerce-plugin/blob/main/Nicky/languages/README.md Use this command to generate a Portable Object Template (POT) file, which serves as the base for all translations. Ensure you are in the plugin's root directory. ```bash wp i18n make-pot . languages/nicky-me.pot ``` -------------------------------- ### Verify Clean Build Source: https://github.com/nickyvault/nicky-woocommerce-plugin/blob/main/RELEASE.md Commands to ensure the build ZIP does not contain unwanted debug or temporary files and that version information is consistent across key files. ```bash # Should show NO results unzip -l nicky-me.zip | grep -E "debug|docker-compose|README-v1" # Should show version X.X.X throughout unzip -p nicky-me.zip Nicky/nicky-me.php | grep "Version:" unzip -p nicky-me.zip Nicky/readme.txt | grep "Stable tag:" ``` -------------------------------- ### Build Production Script Source: https://github.com/nickyvault/nicky-woocommerce-plugin/blob/main/README.md Use this script to build the production version of the plugin. It supports interactive builds, specific version builds, and builds without version updates. ```bash # Interactive build with version management ./build-production.sh # Build specific version ./build-production.sh 1.0.2 # Build without version update ./build-production.sh --no-version ``` -------------------------------- ### Make Build Script Executable Source: https://github.com/nickyvault/nicky-woocommerce-plugin/blob/main/BUILD.md If the build script fails with a 'Permission denied' error, use this command to make the script executable. This is often necessary after checking out code in a CI/CD environment. ```bash chmod +x build-production.sh ``` -------------------------------- ### Verify Production Build Source: https://github.com/nickyvault/nicky-woocommerce-plugin/blob/main/BUILD.md Commands to extract and verify that development files are correctly excluded from the generated ZIP. ```bash # Run the build script ./build-production.sh # This creates nicky-me.zip without debug files # Upload nicky-me.zip to WordPress.org ``` ```bash # Extract and test the production ZIP locally unzip -q nicky-me.zip -d test_build/ # Check that debug files are not present ls test_build/Nicky/includes/debug*.php # Should show: No such file or directory ``` -------------------------------- ### Configure Nicky Plugin Settings Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt Default settings array used for plugin initialization and database configuration. ```php $default_settings = array( 'enabled' => 'yes', 'title' => 'Nicky Payment', 'description' => 'Pay securely with crypto via Nicky.', 'api_key' => '', // Required: Get from nicky.me dashboard 'blockchain_asset_id' => '', // Required: Settlement currency (e.g., 'BTC.BTC', 'ETH.ETH') 'custom_logo' => '' // Optional: Custom logo URL ); ``` -------------------------------- ### Create Webhook Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt Registers a new webhook URL to receive status updates for payment requests. ```bash curl -X POST "https://api-public.pay.nicky.me/api/public/WebHookApi/create" \ -H "Content-Type: application/json" \ -H "x-api-key: YOUR_API_KEY" \ -d '{ "webHookType": "PaymentRequest_StatusChanged", "url": "https://yourstore.com/?wc-api=wc_gateway_nicky" }' ``` -------------------------------- ### Perform Feature Release Source: https://github.com/nickyvault/nicky-woocommerce-plugin/blob/main/RELEASE.md Execute this command to build a new minor version of the plugin. Complete feature development, update the readme.txt with new features and changelog, test thoroughly, commit, tag, and upload. ```bash ./build-production.sh 1.1.0 ``` -------------------------------- ### Copy Plugin Files Source: https://github.com/nickyvault/nicky-woocommerce-plugin/blob/main/Nicky/README.md Use this command to copy the plugin files to your WordPress plugins directory. ```bash cp -r nicky-woocommerce-plugin/ /path/to/wordpress/wp-content/plugins/nicky-me/ ``` -------------------------------- ### Update Changelog in readme.txt Source: https://github.com/nickyvault/nicky-woocommerce-plugin/blob/main/BUILD.md Format for manually updating the changelog section in the plugin's readme file. ```text == Changelog == = 1.0.2 = * Updated: WordPress 6.8 compatibility ``` -------------------------------- ### Rollback Procedure Source: https://github.com/nickyvault/nicky-woocommerce-plugin/blob/main/RELEASE.md Steps to rollback a release. This involves checking out the previous version, building without a version update, uploading the ZIP, returning to the main branch, and then fixing issues for a proper release. ```bash # 1. Checkout previous version git checkout v1.0.1 # 2. Build without version update ./build-production.sh --no-version # 3. Upload to WordPress.org # 4. Return to main branch git checkout main # 5. Fix issues and release properly ``` -------------------------------- ### Nicky Payment Gateway Configuration Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt Default settings and database table structure for the Nicky payment gateway plugin. ```APIDOC ## Nicky Payment Gateway Configuration ### Description Configuration details for the Nicky payment gateway, including default settings and the database table created for transaction tracking. ### Method N/A (Configuration) ### Endpoint N/A (Configuration) ### Parameters N/A ### Request Body N/A ### Response N/A ### Configuration Details **Default Settings (Applied on Activation):** ```php $default_settings = array( 'enabled' => 'yes', 'title' => 'Nicky Payment', 'description' => 'Pay securely with crypto via Nicky.', 'api_key' => '', // Required: Get from nicky.me dashboard 'blockchain_asset_id' => '', // Required: Settlement currency (e.g., 'BTC.BTC', 'ETH.ETH') 'custom_logo' => '' // Optional: Custom logo URL ); ``` **Database Table:** `wp_nicky_payment_transactions` - `order_id` - `transaction_id` - `payment_status` - `amount` - `currency` - `gateway_response` ``` -------------------------------- ### Rebuild Without Version Change Source: https://github.com/nickyvault/nicky-woocommerce-plugin/blob/main/RELEASE.md Use this command when you need to rebuild the plugin ZIP without incrementing the version number, typically after forgetting to update the changelog. ```bash ./build-production.sh --no-version ``` -------------------------------- ### List Webhooks via cURL Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt Retrieves all registered webhooks. Requires a valid API key in the header. ```bash curl -X GET "https://api-public.pay.nicky.me/api/public/WebHookApi/list" \ -H "Accept: application/json" \ -H "x-api-key: YOUR_API_KEY" ``` -------------------------------- ### POST /webhook Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt Handles webhook requests from Nicky servers to update WooCommerce order statuses based on payment events. ```APIDOC ## POST /webhook ### Description This endpoint receives payment status updates from Nicky servers via webhooks. It automatically updates the corresponding WooCommerce order status based on the received payment events. ### Method POST ### Endpoint `/?wc-api=wc_gateway_nicky` ### Parameters #### Path Parameters N/A #### Query Parameters - **wc-api** (string) - Must be set to `wc_gateway_nicky`. #### Request Body **Webhook Payload Structure:** - **WebHookType** (string) - Type of webhook event (e.g., 'PaymentRequest_StatusChanged'). - **ItemId** (string) - Identifier for the payment request. - **Data** (object) - Contains details about the status change. - **PreviousStatus** (string) - The status before the change. - **NewStatus** (string) - The new status of the payment. ### Request Example ```php // Webhook payload structure: $webhook_data = array( 'WebHookType' => 'PaymentRequest_StatusChanged', 'ItemId' => 'payment-request-uuid', 'Data' => array( 'PreviousStatus' => 'PaymentPending', 'NewStatus' => 'Finished' ) ); ``` ### Response N/A (Typically returns a 200 OK status to acknowledge receipt) ### Status Mapping to WooCommerce Order Status - **'Finished'**: `payment_complete()` (order marked as paid) - **'Canceled'**: Order status set to `'cancelled'` - **'PaymentValidationRequired'**: Order status set to `'on-hold'` (requires manual validation) - **'PaymentPending' or 'None'**: Order status set to `'pending'` ### Webhook URL Registration Example ```php $webhook_url = add_query_arg('wc-api', 'wc_gateway_nicky', home_url('/')); // Result: https://yourstore.com/?wc-api=wc_gateway_nicky ``` ### Allowed IP Addresses Nicky servers sending webhooks originate from IP: `20.76.240.81` ``` -------------------------------- ### POST /api/public/WebHookApi/create Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt Registers a webhook to receive real-time notifications for events, such as payment status changes. This is typically set up automatically when the API key is configured. ```APIDOC ## POST /api/public/WebHookApi/create ### Description Automatically registers a webhook when API key is configured. ### Method POST ### Endpoint https://api-public.pay.nicky.me/api/public/WebHookApi/create ### Parameters #### Request Body - **webHookType** (string) - Required - The type of webhook event (e.g., 'PaymentRequest_StatusChanged'). - **url** (string) - Required - The URL to send webhook notifications to. ### Request Example ```json { "webHookType": "PaymentRequest_StatusChanged", "url": "https://yourstore.com/?wc-api=wc_gateway_nicky" } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the created webhook. ``` -------------------------------- ### Perform Major Release Source: https://github.com/nickyvault/nicky-woocommerce-plugin/blob/main/RELEASE.md Use this command for major releases involving breaking changes. Ensure all documentation is updated, run the build script with the new version, test extensively, commit, tag, and upload. ```bash ./build-production.sh 2.0.0 ``` -------------------------------- ### Handle Webhook Notifications Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt Payload structure for incoming webhook data and URL generation for registration. ```php $webhook_data = array( 'WebHookType' => 'PaymentRequest_StatusChanged', 'ItemId' => 'payment-request-uuid', 'Data' => array( 'PreviousStatus' => 'PaymentPending', 'NewStatus' => 'Finished' ) ); // Example webhook URL for registration: $webhook_url = add_query_arg('wc-api', 'wc_gateway_nicky', home_url('/')); ``` -------------------------------- ### Verify ZIP File Contents Source: https://github.com/nickyvault/nicky-woocommerce-plugin/blob/main/BUILD.md Use this command to inspect the contents of the generated ZIP file. This is crucial for ensuring that no unwanted debug files are included before submitting to WordPress.org. It's recommended to grep for 'debug' and ensure no results are returned. ```bash unzip -l nicky-me.zip | grep debug ``` -------------------------------- ### Customize Build Script Source: https://github.com/nickyvault/nicky-woocommerce-plugin/blob/main/BUILD.md Modifications to the build script to exclude specific files or change the output filename. ```bash # In build-production.sh, add: rm -f "$BUILD_DIR/$PLUGIN_DIR/your-file-to-exclude.php" ``` ```bash OUTPUT_ZIP="custom-name.zip" # Default in script is nicky-me.zip ``` -------------------------------- ### Compile MO file from PO file Source: https://github.com/nickyvault/nicky-woocommerce-plugin/blob/main/Nicky/languages/README.md Convert the translated PO file into a Machine Object (MO) file, which is used by WordPress for loading translations. This command compiles the German PO file. ```bash msgfmt languages/nicky-me-de_DE.po -o languages/nicky-me-de_DE.mo ``` -------------------------------- ### POST /process_payment Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt Processes a WooCommerce order payment by creating a payment request with the Nicky API and returning a redirect URL for the customer. ```APIDOC ## POST /process_payment ### Description This method is called by WooCommerce during checkout to process a payment. It creates a payment request with the Nicky API, handles currency conversion, and returns a redirect URL for the customer to complete the payment. ### Method POST ### Endpoint Internal gateway method called by WooCommerce. ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example ```php // Internal gateway method called by WooCommerce during checkout // Creates payment request and redirects customer to Nicky payment page // Example flow when customer places order: $gateway = new Nicky_WC_Gateway_Nicky(); $result = $gateway->process_payment($order_id); ``` ### Response #### Success Response (200) Returns an array containing the payment processing result and redirect URL. - **result** (string) - Indicates the success status of the operation ('success'). - **redirect** (string) - The URL where the customer will be redirected to complete the payment. - **nicky_payment_url** (string) - The direct URL to the Nicky payment page. - **open_in_new_tab** (boolean) - Whether the payment URL should open in a new tab. #### Response Example ```json { "result": "success", "redirect": "https://pay.nicky.me/home?paymentId=ABC123", "nicky_payment_url": "https://pay.nicky.me/home?paymentId=ABC123", "open_in_new_tab": true } ``` ### Order Metadata Stored - `_nicky_short_id` - `_nicky_payment_request_id` - `_nicky_blockchain_asset_id` - `_nicky_conversion_quote_id` - `_nicky_amount_shop_currency` - `_nicky_amount_crypto` ``` -------------------------------- ### POST /api/public/ConversionRate/get-quote Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt Converts an amount from one currency to another using real-time exchange rates. Useful for displaying cryptocurrency equivalents of shop prices. ```APIDOC ## POST /api/public/ConversionRate/get-quote ### Description Converts shop currency amount to cryptocurrency amount using real-time exchange rates. ### Method POST ### Endpoint https://api-public.pay.nicky.me/api/public/ConversionRate/get-quote ### Parameters #### Request Body - **amount** (number) - Required - The amount to convert. - **fromBlockchainId** (string) - Required - The ID of the source blockchain asset (e.g., 'USD.USD'). - **toBlockchainId** (string) - Required - The ID of the target blockchain asset (e.g., 'BTC.BTC'). ### Request Example ```json { "amount": 99.99, "fromBlockchainId": "USD.USD", "toBlockchainId": "BTC.BTC" } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the quote. - **price** (number) - The calculated amount in the target cryptocurrency. - **rate** (number) - The real-time exchange rate. ``` -------------------------------- ### Create Payment Request Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt Creates a new cryptocurrency payment request. Requires a valid API key and specific blockchain asset details. ```php $body = array( 'blockchainAssetId' => 'BTC.BTC', // Format: Chain.Ticker 'amountExpectedNative' => 0.00123, // Amount in cryptocurrency 'billDetails' => array( 'invoiceReference' => '1001', // WooCommerce order number 'description' => 'Order #1001 from My Store' ), 'requester' => array( 'email' => 'customer@example.com', 'name' => 'John Doe' ), 'sendNotification' => false, 'successUrl' => 'https://yourstore.com/checkout/order-received/1001/', 'cancelUrl' => 'https://yourstore.com/checkout/' ); ``` ```bash curl -X POST "https://api-public.pay.nicky.me/api/public/PaymentRequestPublicApi/create" \ -H "Content-Type: application/json" \ -H "x-api-key: YOUR_API_KEY" \ -d '{ "blockchainAssetId": "BTC.BTC", "amountExpectedNative": 0.00123, "billDetails": { "invoiceReference": "1001", "description": "Order #1001 from My Store" }, "requester": { "email": "customer@example.com", "name": "John Doe" }, "successUrl": "https://yourstore.com/checkout/order-received/1001/", "cancelUrl": "https://yourstore.com/checkout/" }' ``` -------------------------------- ### Order Meta Fields Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt The Nicky WooCommerce plugin stores various metadata on orders to facilitate cryptocurrency payment tracking and processing. These fields provide essential information for managing transactions, conversions, and order statuses. ```APIDOC ## Order Meta Fields The Nicky plugin stores the following metadata on WooCommerce orders: ### Payment Identifiers - `_nicky_short_id`: Nicky payment short identifier. - `_nicky_payment_request_id`: Full payment request UUID. ### Payment Details - `_nicky_blockchain_asset_id`: Blockchain asset identifier (e.g., 'BTC.BTC'). - `_nicky_conversion_quote_id`: Conversion quote UUID. - `_nicky_amount_shop_currency`: Original order amount in the shop's currency (e.g., 99.99). - `_nicky_amount_crypto`: Amount in cryptocurrency (e.g., 0.00152). - `_nicky_shop_currency`: The shop's currency code (e.g., 'USD'). ### Status Flags - `_nicky_requires_validation`: Indicates if manual validation is needed ('yes' or empty). ### Checkout Tracking - `_nicky_payment_initiated_at`: Timestamp when the payment process was initiated. - `_nicky_payment_customer_ip`: The IP address of the customer initiating the payment. - `_nicky_payment_user_agent`: The user agent string of the customer's browser. ``` -------------------------------- ### Render Payment Status Shortcode Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt Displays the payment status for a specific order ID using the plugin shortcode. ```php echo do_shortcode('[nicky_payment_status order_id="' . $order_id . '"]'); ``` -------------------------------- ### POST /api/public/PaymentRequestPublicApi/create Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt Creates a new payment request for processing cryptocurrency payments. This is typically called internally during the checkout process. ```APIDOC ## POST /api/public/PaymentRequestPublicApi/create ### Description Creates a new payment request through Nicky API for processing cryptocurrency payments. ### Method POST ### Endpoint https://api-public.pay.nicky.me/api/public/PaymentRequestPublicApi/create ### Parameters #### Request Body - **blockchainAssetId** (string) - Required - The ID of the blockchain asset (e.g., 'BTC.BTC'). - **amountExpectedNative** (number) - Required - The amount expected in the native cryptocurrency. - **billDetails** (object) - Required - Details about the bill. - **invoiceReference** (string) - Required - The invoice or order reference number. - **description** (string) - Optional - A description for the payment. - **requester** (object) - Required - Information about the requester. - **email** (string) - Required - The email address of the requester. - **name** (string) - Optional - The name of the requester. - **sendNotification** (boolean) - Optional - Whether to send a notification. - **successUrl** (string) - Required - The URL to redirect to upon successful payment. - **cancelUrl** (string) - Required - The URL to redirect to if the payment is cancelled. ### Request Example ```json { "blockchainAssetId": "BTC.BTC", "amountExpectedNative": 0.00123, "billDetails": { "invoiceReference": "1001", "description": "Order #1001 from My Store" }, "requester": { "email": "customer@example.com", "name": "John Doe" }, "sendNotification": false, "successUrl": "https://yourstore.com/checkout/order-received/1001/", "cancelUrl": "https://yourstore.com/checkout/" } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the payment request. - **bill** (object) - Bill details. - **shortId** (string) - A short, shareable ID for the bill. - **status** (string) - The current status of the payment request (e.g., 'PaymentPending'). ``` -------------------------------- ### Manage Dashboard Widget via AJAX Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt Handles order payment status updates and widget visibility toggling via WordPress AJAX. ```javascript jQuery.ajax({ url: ajaxurl, type: 'POST', data: { action: 'nicky_mark_order_paid', order_id: 123, nonce: 'nicky_dashboard_nonce' }, success: function(response) { if (response.success) { // Order marked as paid, row removed from widget console.log(response.data.message); } } }); // Hide/Show widget per user: jQuery.ajax({ url: ajaxurl, type: 'POST', data: { action: 'nicky_validation_widget_visibility', nonce: 'nicky_dashboard_nonce', hide: '1' // or '0' to show } }); ``` -------------------------------- ### Retrieve Nicky Order Meta Fields Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt Use these methods to retrieve specific payment tracking and processing details stored on a WooCommerce order by the Nicky plugin. Ensure the order object is available in your context. ```php $order->get_meta('_nicky_short_id'); // Nicky payment shortId ``` ```php $order->get_meta('_nicky_payment_request_id'); // Full payment request UUID ``` ```php $order->get_meta('_nicky_blockchain_asset_id'); // e.g., 'BTC.BTC' ``` ```php $order->get_meta('_nicky_conversion_quote_id'); // Conversion quote UUID ``` ```php $order->get_meta('_nicky_amount_shop_currency'); // Original amount (e.g., 99.99) ``` ```php $order->get_meta('_nicky_amount_crypto'); // Crypto amount (e.g., 0.00152) ``` ```php $order->get_meta('_nicky_shop_currency'); // Shop currency (e.g., 'USD') ``` ```php $order->get_meta('_nicky_requires_validation'); // 'yes' if manual validation needed ``` ```php $order->get_meta('_nicky_payment_initiated_at'); // Timestamp ``` ```php $order->get_meta('_nicky_payment_customer_ip'); // Customer IP ``` ```php $order->get_meta('_nicky_payment_user_agent'); // Browser user agent ``` -------------------------------- ### Perform Bug Fix Release Source: https://github.com/nickyvault/nicky-woocommerce-plugin/blob/main/RELEASE.md Use this command for patch releases to auto-increment the version or specify a direct version number. Ensure to update the changelog, commit, tag, push, and upload the zip file. ```bash # Interactive build with auto-increment ./build-production.sh # Choose option 1 (auto-increment) # Or specify version directly ./build-production.sh 1.0.2 ``` -------------------------------- ### Emergency Hotfix Release Source: https://github.com/nickyvault/nicky-woocommerce-plugin/blob/main/RELEASE.md Procedure for releasing a critical bug fix. This involves fixing the bug, performing a quick build with auto-increment, updating the changelog with a 'Hotfix:' prefix, testing, committing, tagging, pushing, and uploading. ```bash # 1. Fix the bug in your code # 2. Quick build with auto-increment ./build-production.sh 1.0.3 # 3. Update changelog with "Hotfix:" prefix # 4. Quick test # 5. Deploy immediately git add . && git commit -m "Hotfix v1.0.3: Critical bug fix" git tag v1.0.3 git push origin main --tags # 6. Upload to WordPress.org ``` -------------------------------- ### Register Payment Method for Blocks Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt Defines the payment method configuration for WooCommerce block-based checkout. ```javascript const nickyBlocksData = { title: 'Nicky Payment', description: 'Pay securely with cryptocurrency via Nicky.', icon: 'https://yourstore.com/wp-content/plugins/nicky-me/assets/images/logo.png', enabled: true, cartTotal: '99.99' }; ``` -------------------------------- ### Process Store API Payments Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt Configures the payment context and result status for WooCommerce Store API checkout processing. ```php $payment_context->payment_method = 'nicky'; $payment_context->order = $wc_order; // Result handling: $payment_result->set_status('success'); $payment_result->set_redirect_url('https://pay.nicky.me/home?paymentId=ABC123'); ``` -------------------------------- ### POST /api/public/WebHookApi/delete Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt Removes a specific webhook by its ID. ```APIDOC ## POST /api/public/WebHookApi/delete ### Description Removes webhook when API key is cleared or plugin deactivated. ### Method POST ### Endpoint https://api-public.pay.nicky.me/api/public/WebHookApi/delete ### Parameters #### Query Parameters - **id** (string) - Required - The unique identifier of the webhook to delete ``` -------------------------------- ### Delete Webhook via cURL Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt Removes a specific webhook by ID. Use this when the plugin is deactivated or the API key is cleared. ```bash curl -X POST "https://api-public.pay.nicky.me/api/public/WebHookApi/delete?id=webhook-uuid" \ -H "Content-Type: application/json" \ -H "x-api-key: YOUR_API_KEY" ``` -------------------------------- ### POST /api/public/PaymentRequestPublicApi/cancel Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt Cancels a pending payment request. This can be triggered manually or automatically when a WooCommerce order is cancelled. ```APIDOC ## POST /api/public/PaymentRequestPublicApi/cancel ### Description Cancels a pending payment request. ### Method POST ### Endpoint https://api-public.pay.nicky.me/api/public/PaymentRequestPublicApi/cancel?shortId=ABC123 ### Parameters #### Query Parameters - **shortId** (string) - Required - The short ID of the payment request to cancel. ### Response #### Success Response (200) - Returns `true` on successful cancellation. ``` -------------------------------- ### Cancel Payment Request Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt Cancels a pending payment request. This is typically triggered automatically by WooCommerce order cancellation. ```bash curl -X POST "https://api-public.pay.nicky.me/api/public/PaymentRequestPublicApi/cancel?shortId=ABC123" \ -H "Content-Type: application/json" \ -H "x-api-key: YOUR_API_KEY" ``` -------------------------------- ### Poll Payment Status Source: https://context7.com/nickyvault/nicky-woocommerce-plugin/llms.txt Methods for checking payment status via PHP backend or frontend AJAX requests. ```php $gateway = new Nicky_WC_Gateway_Nicky(); $result = $gateway->poll_order_by_short_id('ABC123'); // Returns: $result = array( 'status' => 'Finished', // Nicky payment status 'is_paid' => true, // WooCommerce order paid status 'open_amount' => 0.0 // Remaining amount to pay ); ``` ```javascript jQuery.ajax({ url: nicky_payment_params.ajax_url, type: 'POST', data: { action: 'nickym_check_nicky_payment_status', order_id: 123, nonce: nicky_payment_params.nonce }, success: function(response) { if (response.success) { console.log('Payment status:', response.data.nicky_status); console.log('Order status:', response.data.order_status); console.log('Is paid:', response.data.is_paid); } } }); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.