### Enable Magento Module and Upgrade Setup Source: https://docs.sequra.com/docs/copy-of-magento-2 Run these commands to enable a Magento module and upgrade the setup. Ensure the module name is correctly specified. ```bash php bin/magento module:enable ... php bin/magento setup:upgrade ``` -------------------------------- ### Example Credit Agreements for pp3 Source: https://docs.sequra.com/docs/credit-conditions This snippet shows the structure of credit agreements for the 'pp3' product, including details for different instalment counts. Ensure amounts are in cents. ```json { "pp3": [ { "apr": {"value": 6498, "string": "64,98 %"}, "cost_of_credit_pct": {"value": 420, "string": "4,20 %"}, "cost_of_credit": {"value": 6300, "string": "63,00 €"}, "default": false, "down_payment_amount": {"value": 50000, "string": "500,00 €"}, "down_payment_fees": {"value": 2100, "string": "21,00 €"}, "down_payment_total": {"value": 52100, "string": "521,00 €"}, "drawdown_payment_amount": {"value": 100000, "string": "1000,00 €"}, "grand_total": {"value": 156300, "string": "1563,00 €"}, "instalment_amount": {"value": 50000, "string": "500,00 €"}, "instalment_count": 3, "instalment_fee": {"value": 2100, "string": "21,00 €"}, "instalment_total": {"value": 52100, "string": "521,00 €"}, "interest": {"value": 0, "string": "0,00 %"}, "max_amount": {"value": 300000, "string": "3000,00 €"}, "max_credit": {"value": 300000, "string": "3000,00 €"}, "max_financed_amount": {"value": 300000, "string": "3000,00 €"}, "min_amount": {"value": 5000, "string": "50,00 €"}, "min_credit": {"value": 5000, "string": "50,00 €"}, "over_max_financed_amount": {"value": 0, "string": "0,00 €"}, "over_max": {"value": 0, "string": "0,00 €"}, "setup_fee": {"value": 0, "string": "0,00 €"}, "total_with_tax": {"value": 150000, "string": "1500,00 €"}, "product": "pp3", "available": true }, { "instalment_count": 6, "product": "pp3" ... // analogous details as above, but for 6 months credits }, { "instalment_count": 12, "product": "pp3" ... // analogous details as above, but for 12 months credits }] } ``` -------------------------------- ### Example Credit Agreements for pp5 Source: https://docs.sequra.com/docs/credit-conditions This snippet illustrates the structure of credit agreements for the 'pp5' product, including campaign details and date information. Amounts are in cents. ```json { "pp5": [ { "agreed_amount": {"value": 150000, "string": "1500,00 €"}, "apr": {"value": 240, "string": "2,40 %"}, "campaign": "mayo2017", "cost_of_credit_pct": {"value": 60, "string": "0,60 %"}, "cost_of_credit": {"value": 895, "string": "8,95 €"}, "down_payment_amount": {"value": 0, "string": "0,00 €"}, "down_payment_fees": {"value": 895, "string": "8,95 €"}, "down_payment_total": {"value": 895, "string": "8,95 €"}, "drawdown_payment_amount": {"value": 150000, "string": "1500,00 €"}, "due_date": {"value": "2018-07-10", "string": "10 de julio"}, "end_date": {"value": "2018-05-29", "string": "29 de mayo"}, "first_date": {"value": "2018-01-16", "string": "16 de enero"}, "grand_total": {"value": 150895, "string": "1508,95 €"}, "instalment_count": 1, "instalment_fee": {"value": 0, "string": "0,00 €"}, "interest": {"value": 0, "string": "0,00 %"}, "last_date": {"value": "2018-05-29", "string": "29 de mayo"}, "max_credit": {"value": 160000, "string": "1600,00 €"}, "max_financed_amount": {"value": 160000, "string": "1600,00 €"}, "min_amount": {"value": 10000, "string": "100,00 €"}, "min_credit": {"value": 10000, "string": "100,00 €"}, "over_max_financed_amount": {"value": 0, "string": "0,00 €"}, "product": "pp5", "setup_fee": {"value": 895, "string": "8,95 €"}, "start_date": {"value": "2018-01-16", "string": "16 de enero"}, "total_with_tax": {"value": 150000, "string": "1500,00 €"} }] } ``` -------------------------------- ### Navigate and Extract Module Files (Manual Install) Source: https://docs.sequra.com/docs/copy-of-magento-2 Use these commands to navigate to your Magento root directory, create the necessary directory structure, and extract the SeQura Affiliate Marketing module ZIP file. ```bash # Navigate to the Magento root directory cd /path/to/magento/root # Create the directory structure mkdir -p app/code/SequraAffiliateMarketing # Extract the ZIP content into the directory unzip SequraAffiliateMarketing.zip -d app/code/SequraAffiliateMarketing/ ``` -------------------------------- ### Pre-activation Cancellation Request Example Source: https://docs.sequra.com/docs/cancel-a-subscription This JSON payload is used for cancellations that occur before the subscription is activated. It includes an optional `purchase_fee` if applicable. ```json { "reason": "Customer request", "summary": { "kept_items": [], "returned_items": [], "purchase_fee": 5000, "total_to_pay": 5000 } } ``` -------------------------------- ### Compute Credit Agreements Source: https://docs.sequra.com/docs/credit-conditions Call `Sequra.computeCreditAgreements` to get available credit agreements for a specific amount and product. Wrap calls in `Sequra.onLoad` to ensure the library is ready. ```javascript Sequra.onLoad(function() { Sequra.computeCreditAgreements({ amount: "15000", product: "pp3", instalmentCount: 3 }); }); ``` -------------------------------- ### Install Module via Composer and Enable Source: https://docs.sequra.com/docs/copy-of-magento-2 If the module is available via Composer, use this command to add it to your project. Follow up with commands to enable the module, upgrade the database, compile code, and flush the cache. ```bash # Add the module via Composer composer require sequra/affiliate-marketing:^1.0 # Enable the module and update the DB php bin/magento module:enable SequraAffiliateMarketing_AffiliateMarketing php bin/magento setup:upgrade # Compile and flush cache php bin/magento setup:di:compile php bin/magento cache:flush ``` -------------------------------- ### Getting the Cancellation Cost Source: https://docs.sequra.com/docs/cancel-a-subscription Retrieves the suggested cancellation costs for each item in a subscription, based on the remaining subscription months. ```APIDOC ## GET /api/public/v1/subscriptions/:id ### Description Retrieves detailed information about a subscription, including pre-calculated costs for keeping or returning items if the subscription is active or activating. This is used to present options to the customer before finalising cancellation. ### Method GET ### Endpoint /api/public/v1/subscriptions/:id ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the subscription. ### Response #### Success Response (200) - **id** (integer) - The subscription ID. - **status** (string) - The current status of the subscription (e.g., `active`, `activating`). - **current_month** (integer) - The current month of the subscription term. - **total_months** (integer) - The total number of months in the subscription term. - **last_persisted_cart** (object) - Contains details about the items in the subscription. - **cart_items** (array) - List of items in the subscription. - **reference** (string) - Unique identifier for the item. - **name** (string) - Name of the item. - **subscription_price** (object) - The monthly price of the item. - **value** (integer) - The price value in cents. - **string** (string) - The price formatted as a string (e.g., "15,00 €"). - **cancellation_cost_kept** (object or null) - Cost if the customer keeps the item. Null if the subscription is not active or activating. - **value** (integer) - The cost value in cents. - **string** (string) - The cost formatted as a string. - **cancellation_cost_returned** (object or null) - Cost if the customer returns the item. Null if the subscription is not active or activating. - **value** (integer) - The cost value in cents. - **string** (string) - The cost formatted as a string. ### Response Example ```json { "id": 123, "status": "active", "current_month": 6, "total_months": 24, "last_persisted_cart": { "cart_items": [ { "reference": "FRAME-001", "name": "Designer Frame", "subscription_price": { "value": 1500, "string": "15,00 €" }, "cancellation_cost_kept": { "value": 27000, "string": "270,00 €" }, "cancellation_cost_returned": { "value": 13500, "string": "135,00 €" } }, { "reference": "LENS-001", "name": "Progressive Lenses", "subscription_price": { "value": 2000, "string": "20,00 €" }, "cancellation_cost_kept": { "value": 36000, "string": "360,00 €" }, "cancellation_cost_returned": { "value": 18000, "string": "180,00 €" } } ] } } ``` ``` -------------------------------- ### Get Credit Agreements Source: https://docs.sequra.com/docs/credit-conditions Retrieve available credit agreements based on specified parameters. The response is structured by product type. ```APIDOC ## GET /websites/sequra/creditAgreements ### Description Retrieves a list of available credit agreements for financing products based on provided query parameters. ### Method GET ### Endpoint /websites/sequra/creditAgreements ### Parameters #### Query Parameters - **amount** (integer) - Yes - The total amount of the purchase or product in cents. For example, 15,00 EUR should be represented as 1500. - **product** (string) - No - Filters credit agreements by a specific product. If not provided, all products will be returned. - **campaign** (string) - No - Filters credit agreements by a specific campaign. If not provided, all campaigns will be returned. This parameter is mandatory for the `_pp5_` product. - **instalmentCount** (integer) - No - Filters credit agreements by the number of installments. If not provided, all available installment counts will be returned. ### Response #### Success Response (200) - **creditAgreements** (object) - An object where keys are product types (e.g., "pp3", "pp5") and values are arrays of credit agreement objects. Each credit agreement object contains detailed financing information. #### Response Example ```json { "pp3": [ { "apr": { "value": 6498, "string": "64,98 %" }, "cost_of_credit_pct": { "value": 420, "string": "4,20 %" }, "cost_of_credit": { "value": 6300, "string": "63,00 €" }, "default": false, "down_payment_amount": { "value": 50000, "string": "500,00 €" }, "down_payment_fees": { "value": 2100, "string": "21,00 €" }, "down_payment_total": { "value": 52100, "string": "521,00 €" }, "drawdown_payment_amount": { "value": 100000, "string": "1000,00 €" }, "grand_total": { "value": 156300, "string": "1563,00 €" }, "instalment_amount": { "value": 50000, "string": "500,00 €" }, "instalment_count": 3, "instalment_fee": { "value": 2100, "string": "21,00 €" }, "instalment_total": { "value": 52100, "string": "521,00 €" }, "interest": { "value": 0, "string": "0,00 %" }, "max_amount": { "value": 300000, "string": "3000,00 €" }, "max_credit": { "value": 300000, "string": "3000,00 €" }, "max_financed_amount": { "value": 300000, "string": "3000,00 €" }, "min_amount": { "value": 5000, "string": "50,00 €" }, "min_credit": { "value": 5000, "string": "50,00 €" }, "over_max_financed_amount": { "value": 0, "string": "0,00 €" }, "over_max": { "value": 0, "string": "0,00 €" }, "setup_fee": { "value": 0, "string": "0,00 €" }, "total_with_tax": { "value": 150000, "string": "1500,00 €" }, "product": "pp3", "available": true } ], "pp5": [ { "agreed_amount": { "value": 150000, "string": "1500,00 €" }, "apr": { "value": 240, "string": "2,40 %" }, "campaign": "mayo2017", "cost_of_credit_pct": { "value": 60, "string": "0,60 %" }, "cost_of_credit": { "value": 895, "string": "8,95 €" }, "down_payment_amount": { "value": 0, "string": "0,00 €" }, "down_payment_fees": { "value": 895, "string": "8,95 €" }, "down_payment_total": { "value": 895, "string": "8,95 €" }, "drawdown_payment_amount": { "value": 150000, "string": "1500,00 €" }, "due_date": { "value": "2018-07-10", "string": "10 de julio" }, "end_date": { "value": "2018-05-29", "string": "29 de mayo" }, "first_date": { "value": "2018-01-16", "string": "16 de enero" }, "grand_total": { "value": 150895, "string": "1508,95 €" }, "instalment_count": 1, "instalment_fee": { "value": 0, "string": "0,00 €" }, "interest": { "value": 0, "string": "0,00 %" }, "last_date": { "value": "2018-05-29", "string": "29 de mayo" }, "max_credit": { "value": 160000, "string": "1600,00 €" }, "max_financed_amount": { "value": 160000, "string": "1600,00 €" }, "min_amount": { "value": 10000, "string": "100,00 €" }, "min_credit": { "value": 10000, "string": "100,00 €" }, "over_max_financed_amount": { "value": 0, "string": "0,00 €" }, "product": "pp5", "setup_fee": { "value": 895, "string": "8,95 €" }, "start_date": { "value": "2018-01-16", "string": "16 de enero" }, "total_with_tax": { "value": 150000, "string": "1500,00 €" } } ] } ``` ``` -------------------------------- ### List Available Disbursements (Bash) Source: https://docs.sequra.com/docs/disbursement-api Make a GET request to the disbursements endpoint to retrieve a list of available disbursements. Ensure your account key and secret are correctly set in the SQPASS variable. ```bash $ SQPASS='yourAccountKey:yourAccountSecret' $ curl -i -u $SQPASS https://sandbox.sequrapi.com/merchants/yourMerchantName/disbursements ``` -------------------------------- ### HTTP 404 Not Found Error Response Source: https://docs.sequra.com/docs/disbursement-api This is an example of a standard HTTP 404 Not Found error response from the API, indicating that the requested resource could not be found. ```http HTTP/1.1 404 Not Found Content-Type: application/json; charset=utf-8 {"status":"404","error":"Not Found"} ``` -------------------------------- ### Cancel Subscription Request Example Source: https://docs.sequra.com/docs/cancel-a-subscription Use this JSON payload to cancel an active subscription when the customer returns one item and keeps another. The `summary` object details the costs associated with kept and returned items. ```json { "reason": "Customer request", "explanation": "Customer no longer needs the subscription", "summary": { "kept_items": [{ "id": "frame-cart-item-id", "price": 45000 }], "returned_items": [{ "id": "lens-cart-item-id", "price": 22500 }], "purchase_fee": 0, "total_to_pay": 67500 } } ``` -------------------------------- ### Activate Subscription Item Source: https://docs.sequra.com/docs/activate-the-subscription-items Activates a specific item within a subscription. This action is typically performed when the store delivers the item to the shopper and sets the contract's start date. ```APIDOC ## PATCH /api/public/v1/subscriptions/:subscription_id/cart_items/:reference_uuid/activate ### Description Activates a specific item within a subscription. This action is crucial as it establishes the contract's start date once all items in the cart have been delivered. ### Method PATCH ### Endpoint `/api/public/v1/subscriptions/:subscription_id/cart_items/:reference_uuid/activate` ### Parameters #### Path Parameters - **subscription_id** (string) - Required - The unique identifier for the subscription. - **reference_uuid** (string) - Required - The unique identifier for the cart item to be activated. ### Request Body This endpoint does not require a request body. ### Response #### Success Response (200) - **id** (string) - The unique identifier of the activated item. - **type** (string) - The type of the subscription item. - **reference** (string) - The reference identifier for the item. - **reference_uuid** (string) - The unique identifier for the cart item. - **name** (string) - The name of the item. - **price_with_tax** (object) - The price of the item including tax. - **value** (integer) - The price value in the smallest currency unit. - **string** (string) - The price formatted as a string. - **quantity** (integer) - The quantity of the item. - **total_with_tax** (object) - The total price for the item including tax. - **value** (integer) - The total price value in the smallest currency unit. - **string** (string) - The total price formatted as a string. - **status** (string) - The current status of the item (e.g., 'active'). - **activated_at** (string) - The timestamp when the item was activated. - **subscription_price** (object) - The price of the subscription for this item. - **value** (integer) - The subscription price value in the smallest currency unit. - **string** (string) - The subscription price formatted as a string. - **discount_type** (string) - The type of discount applied, if any. - **discount_amount** (object) - The amount of discount applied. - **value** (integer) - The discount value in the smallest currency unit. - **string** (string) - The discount amount formatted as a string. - **original_price_with_tax** (object) - The original price of the item including tax. - **value** (integer) - The original price value in the smallest currency unit. - **string** (string) - The original price formatted as a string. - **original_subscription_price** (object) - The original subscription price for this item. - **value** (integer) - The original subscription price value in the smallest currency unit. - **string** (string) - The original subscription price formatted as a string. - **catalogue_price_with_tax** (object) - The catalogue price of the item including tax. - **value** (integer) - The catalogue price value in the smallest currency unit. - **string** (string) - The catalogue price formatted as a string. - **catalogue_subscription_price** (object) - The catalogue subscription price for this item. - **value** (integer) - The catalogue subscription price value in the smallest currency unit. - **string** (string) - The catalogue subscription price formatted as a string. - **line_price_with_tax** (object) - The line item price including tax. - **value** (integer) - The line item price value in the smallest currency unit. - **string** (string) - The line item price formatted as a string. - **line_subscription_price** (object) - The line item subscription price. - **value** (integer) - The line item subscription price value in the smallest currency unit. - **string** (string) - The line item subscription price formatted as a string. #### Response Example ```json { "id": "d781164a-4c56-4ec0-a6dd-66b1af9b868c", "type": "material_subscription", "reference": "item_5", "reference_uuid": "test-uuid-123", "name": "Merchant merchant_2 item #5", "price_with_tax": { "value": 2500, "string": "25,00 €" }, "quantity": 1, "total_with_tax": { "value": 2500, "string": "25,00 €" }, "status": "active", "activated_at": "2025-11-12 08:28:02 +0000", "subscription_price": { "value": 1000, "string": "10,00 €" }, "discount_type": null, "discount_amount": null, "original_price_with_tax": { "value": 0, "string": "0,00 €" }, "original_subscription_price": { "value": 0, "string": "0,00 €" }, "catalogue_price_with_tax": { "value": 0, "string": "0,00 €" }, "catalogue_subscription_price": { "value": 0, "string": "0,00 €" }, "line_price_with_tax": { "value": 0, "string": "0,00 €" }, "line_subscription_price": { "value": 0, "string": "0,00 €" } } ``` ``` -------------------------------- ### Compile Code and Deploy Production Mode Source: https://docs.sequra.com/docs/copy-of-magento-2 Before going live, run these commands to compile Magento's code, set the environment to production mode, and flush the cache for optimal performance. ```bash # Compile code php bin/magento setup:di:compile # Switch to production mode (if not already set) php bin/magento deploy:mode:set production # Flush cache php bin/magento cache:flush ``` -------------------------------- ### Get subscription cancellation cost Source: https://docs.sequra.com/docs/cancel-a-subscription Retrieve the pre-calculated costs for keeping or returning items in a subscription. This is useful for active or activating subscriptions before proceeding with cancellation. ```json { "id": 123, "status": "active", "current_month": 6, "total_months": 24, "last_persisted_cart": { "cart_items": [ { "reference": "FRAME-001", "name": "Designer Frame", "subscription_price": { "value": 1500, "string": "15,00 €" }, "cancellation_cost_kept": { "value": 27000, "string": "270,00 €" }, "cancellation_cost_returned": { "value": 13500, "string": "135,00 €" } }, { "reference": "LENS-001", "name": "Progressive Lenses", "subscription_price": { "value": 2000, "string": "20,00 €" }, "cancellation_cost_kept": { "value": 36000, "string": "360,00 €" }, "cancellation_cost_returned": { "value": 18000, "string": "180,00 €" } } ] } } ``` -------------------------------- ### Load seQura JavaScript Library Source: https://docs.sequra.com/docs/credit-conditions Include this script in your page header with the required configuration parameters. Ensure to replace placeholder values with your actual merchant and asset keys. ```html ``` -------------------------------- ### Configure File Permissions and Ownership Source: https://docs.sequra.com/docs/copy-of-magento-2 After extracting the module files, set the correct file permissions and ownership for the module directory. Adjust `www-data:www-data` to match your server's user and group. ```bash # Configure permissions find app/code/SequraAffiliateMarketing -type f -exec chmod 644 {} ; find app/code/SequraAffiliateMarketing -type d -exec chmod 755 {} ; # Assign the correct owner (example for Apache/NGINX) chown -R www-data:www-data app/code/SequraAffiliateMarketing ``` -------------------------------- ### Verify Order in Database Source: https://docs.sequra.com/docs/copy-of-magento-2 Query the `sequra_affiliate_orders` table to confirm that a purchase has been recorded and check its status. The status should be 'sent' or 'pending'. ```sql SELECT order_id, transaction_id, status FROM sequra_affiliate_orders ORDER BY created_at DESC LIMIT 1; ``` -------------------------------- ### GET /merchants/{merchantName}/disbursements/{disbursementId} Source: https://docs.sequra.com/docs/disbursement-api Retrieves the details of a specific disbursement, including all associated settlements. A disbursement aggregates multiple settlements for orders that seQura has processed. ```APIDOC ## GET /merchants/{merchantName}/disbursements/{disbursementId} ### Description Retrieves the details of a specific disbursement, including all associated settlements. A disbursement aggregates multiple settlements for orders that seQura has processed. ### Method GET ### Endpoint `/merchants/{merchantName}/disbursements/{disbursementId}` ### Parameters #### Path Parameters - **merchantName** (string) - Required - Your unique merchant name. - **disbursementId** (string) - Required - The unique identifier for the disbursement. ### Request Example ```bash curl -i -u $SQPASS -H 'Accept: application/json' \ https://sandbox.sequrapi.com/merchants/yourMerchantName/disbursements/c6105f92-5718-4355-9f5b-56b24fe19baa ``` ### Response #### Success Response (200) - **disbursement** (object) - Contains disbursement and settlement details. - **issue_date** (string) - The date the disbursement was issued. - **to_date** (string) - The end date for the period covered by the disbursement. - **currency** (string) - The currency of the disbursement (e.g., EUR). - **disbursed_amount** (integer) - The total amount disbursed in cents. - **adjustments_with_tax** (integer) - Total adjustments with tax. - **adjustments** (array) - List of adjustments. - **reference** (string) - A reference number for the disbursement. - **path** (string) - The API path to this disbursement resource. - **settlements** (array) - A list of settlements included in this disbursement. - **order_ref_1** (string) - The merchant's primary order ID. - **order_ref_2** (string or null) - The merchant's secondary order ID, if applicable. - **order_date** (string) - The date the order was confirmed. - **amount_with_tax** (integer) - The amount settled for this order in cents. Positive for payments to merchant, negative for returns/cancellations. - **cost_of_credit** (string) - Non-taxable cost of credit for the merchant. - **maximum_amount_with_tax** (integer) - The maximum value registered for the order in cents until disbursement. - **product_name** (string) - The seQura product used for the order. - **fixed_fee** (string) - The fixed fee applied to this settlement. - **variable_fee** (string) - The variable fee applied to this settlement. - **shopper_fee** (string) - The shopper fee (excluding VAT) included in the cart. - **fee_vat** (string) - The VAT applied to all fees. - **vat_percentage** (string) - The VAT percentage applied to the fees. - **retention** (string) - Any amount retained by seQura, negative when applied, positive when released. - **shipment_ref** (string or null) - Reference to the shipment, if provided by the merchant. - **ticket_ref** (string or null) - Reference to the ticket, if provided by the merchant. - **shop_ref** (string or null) - Reference to the shop, if provided by the merchant. #### Response Example ```json { "disbursement": { "issue_date": "2014-12-02", "to_date": "2014-11-16", "currency": "EUR", "disbursed_amount": 29535, "adjustments_with_tax": 0, "adjustments": [], "reference": "0000008mlHWOC", "path": "/merchants/yourMerchantName/disbursements/c6105f92-5718-4355-9f5b-56b24fe19baa", "settlements": [ { "order_ref_1": "100001126", "order_ref_2": null, "order_date": "2014-11-12", "amount_with_tax": 0, "cost_of_credit": "0.0", "maximum_amount_with_tax": 5094, "product_name": "i1", "fixed_fee": "0.0", "variable_fee": "0.35", "shopper_fee": "0.0", "fee_vat": "0.0735", "vat_percentage": "21.0", "retention": "0.0" }, { "order_ref_1": "100001118", "order_ref_2": null, "order_date": "2014-11-11", "amount_with_tax": 3974, "cost_of_credit": "0.0", "maximum_amount_with_tax": 3974, "product_name": "i1", "fixed_fee": "0.0", "variable_fee": "0.35", "shopper_fee": "0.0", "fee_vat": "0.0735", "vat_percentage": "21.0", "retention": "0.0" }, { "order_ref_1": "100001123", "order_ref_2": null, "order_date": "2014-11-11", "amount_with_tax": 25870, "cost_of_credit": "0.0", "maximum_amount_with_tax": 25870, "product_name": "i1", "fixed_fee": "0.0", "variable_fee": "0.35", "shopper_fee": "0.0", "fee_vat": "0.0735", "vat_percentage": "21.0", "retention": "0.0" } ] } } ``` ``` -------------------------------- ### POST /api/public/v1/subscriptions Source: https://docs.sequra.com/docs/create-the-subscription-soliciation Creates a new subscription solicitation. This is the initial request to the service, including personal data and cart items. The shopper must confirm the subscription through a checkout process, and confirmation is received via webhook. ```APIDOC ## POST /api/public/v1/subscriptions ### Description Creates a new subscription solicitation by including personal data and cart items. This is the initial request to the service. ### Method POST ### Endpoint /api/public/v1/subscriptions ### Request Body - **merchant** (object) - Required - Information about the merchant. - **id** (string) - Required - Provided by sequra’s onboarding team. - **store_ref** (string) - Required - Shared with seQura’s onboarding team. - **reference** (string) - Required - Internal id generated at Merchant’s PoS. - **operator_ref** (string) - Required - Email shared with seQura’s onboarding team. - **cart_items** (array) - Required - List of items in the cart. - **reference** (string) - Required - Item reference. - **type** (string) - Required - Type of item (e.g., `material_subscription`, `subscription_package`). - **name** (string) - Required - Name of the item. - **quantity** (integer) - Required - Quantity of the item. - **price_with_tax** (integer) - Required - Price in cents (e.g., 35000 for 350.00€). - **subscription_vat_rate** (integer) - Required - Percentage multiplied by 100 (e.g., 2100 for 21.00%). - **items** (array) - Optional - For `subscription_package` type, contains nested items. - **given_names** (string) - Required - Shopper's first name. - **surnames** (string) - Required - Shopper's last name(s). - **joint_customer** (string) - Optional - Name of a joint customer. - **mobile_phone** (string) - Required - Shopper's mobile phone number. - **email** (string) - Required - Shopper's email address. - **date_of_birth** (string) - Required - Shopper's date of birth (YYYY-MM-DD). - **nin** (string) - Required - Shopper's national identification number. - **address** (string) - Required - Shopper's street address. - **postal_code** (string) - Required - Shopper's postal code. - **city** (string) - Required - Shopper's city. - **colony** (string) - Optional - Required for Mexican merchants. - **first_surname** (string) - Optional - Required for Mexican merchants. - **second_surname** (string) - Optional - Required for Mexican merchants. ### Request Example ```json { "merchant": { "id": "tienda_moderna", "store_ref": "tienda_moderna" }, "reference": "ref001-5", "operator_ref": "merchant@sequra.es", "cart_items": [ { "reference": "glasses1", "type": "material_subscription", "name": "Progressive Glasses", "quantity": 1, "price_with_tax": 35000, "subscription_vat_rate": 2100 }, { "quantity": 1, "type": "subscription_package", "name": "Glasses Package", "price_with_tax": 75000, "subscription_vat_rate": 2100, "items": [ { "reference": "frame1", "type": "material_subscription", "name": "Designer Frame", "quantity": 1, "price_with_tax": 40000, "subscription_vat_rate": 2100 }, { "reference": "lenses1", "type": "material_subscription", "name": "Anti-glare Lenses", "quantity": 1, "price_with_tax": 35000, "subscription_vat_rate": 2100 } ] } ], "given_names": "John", "surnames": "Doe Jr", "joint_customer": "Jane Doe", "mobile_phone": "679959234", "email": "john.doe@example.com", "date_of_birth": "2000-12-20", "nin": "12345678Z", "address": "C falsa, 123", "postal_code": "01234", "city": "Barcelona" } ``` ### Response (Success response details not provided in the source text) ### Error Handling (Error handling details not provided in the source text) ### Regional Differences (Mexico) For Mexican merchants, `surnames` must be sent in two separate fields (`first_surname`, `second_surname`), and the `colony` field is added to the address. ### Regional Differences Example (Mexico) ```json { "given_names": "Juan", "first_surname": "García", "second_surname": "López", "date_of_birth": "1990-05-15", "nin": "GALJ900515HDFXPN09", "address": "Av. Insurgentes Sur 123", "postal_code": "06600", "city": "Ciudad de México", "colony": "Juárez", "joint_customer": "María García" } ``` ``` -------------------------------- ### Verify Frontend Cookie Source: https://docs.sequra.com/docs/copy-of-magento-2 Access your store with a test parameter to verify that the `cookie_sequra_afm` is correctly set in the browser's application cookies. ```bash https://your-store.com/?transaction_id=TEST_AFM_XYZ ``` -------------------------------- ### Manual Form URL Generation (for testing) Source: https://docs.sequra.com/docs/crm-integration Manually construct the identification form URL for testing purposes when developing from outside Spain. This method is NOT recommended for production. ```APIDOC ## Manual Form URL Generation (for testing) ### Description Manually construct the identification form URL for testing purposes when developing from outside Spain. seQura only sends SMS to Spanish mobile numbers. This method is NOT recommended for production as the identification form must be delivered to the shopper's mobile phone for the credit to be approved. ### Method GET (manual construction) ### Endpoint `https://sandbox.sequrapi.com/orders/{order_uuid}/pumbaa_form?product={product_code}` ### Parameters #### Path Parameters - **order_uuid** (string) - Required - The unique identifier for the order. #### Query Parameters - **product** (string) - Required - The financing product code (e.g., `pp3`). ### Example URL `https://sandbox.sequrapi.com/orders/1dc26b35-06f6-41d6-b6f5-d0eb6c66aad1/pumbaa_form?product=pp3` ``` -------------------------------- ### Monitor System Logs for S2S Calls Source: https://docs.sequra.com/docs/copy-of-magento-2 If Test Mode is enabled, use this command to monitor the system log file for SeQura Affiliate Marketing related entries, helping to diagnose S2S call execution. ```bash tail -f var/log/system.log | grep "SeQura Affiliate" ``` -------------------------------- ### Send Form URL via SMS Source: https://docs.sequra.com/docs/crm-integration Use this POST request to send the form URL to a shopper via SMS. Ensure you have the correct order UUID, channel, and product code. A campaign name is required for PP5 financing. ```bash $ SQPASS='yourAccountKey:yourAccountSecret' $ curl -i -X POST -u $SQPASS -k \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ --data-binary '{ "channel": "sms", "product_code": "pp3" }' \ https://sandbox.sequrapi.com/orders/1dc26b35-06f6-41d6-b6f5-d0eb6c66aad1/form_deliveries ``` -------------------------------- ### Subscription Item Activation Response Source: https://docs.sequra.com/docs/activate-the-subscription-items This is the expected JSON response after successfully activating a subscription item. It includes details about the item, its status, and activation timestamp. ```json { "id": "d781164a-4c56-4ec0-a6dd-66b1af9b868c", "type": "material_subscription", "reference": "item_5", "reference_uuid": "test-uuid-123", "name": "Merchant merchant_2 item #5", "price_with_tax": { "value": 2500, "string": "25,00 €" }, "quantity": 1, "total_with_tax": { "value": 2500, "string": "25,00 €" }, "status": "active", "activated_at": "2025-11-12 08:28:02 +0000", "subscription_price": { "value": 1000, "string": "10,00 €" }, "discount_type": null, "discount_amount": null, "original_price_with_tax": { "value": 0, "string": "0,00 €" }, "original_subscription_price": { "value": 0, "string": "0,00 €" }, "catalogue_price_with_tax": { "value": 0, "string": "0,00 €" }, "catalogue_subscription_price": { "value": 0, "string": "0,00 €" }, "line_price_with_tax": { "value": 0, "string": "0,00 €" }, "line_subscription_price": { "value": 0, "string": "0,00 €" } } ``` -------------------------------- ### Fetch Disbursement Details using cURL Source: https://docs.sequra.com/docs/disbursement-api Use this cURL command to retrieve disbursement data from the seQura API. Ensure you have your API credentials and the disbursement ID. ```bash $ curl -i -u $SQPASS -H 'Accept: application/json' \ https://sandbox.sequrapi.com/merchants/yourMerchantName/disbursements/c6105f92-5718-4355-9f5b-56b24fe19baa ``` -------------------------------- ### Add Custom Code Before Sequra Widget Source: https://docs.sequra.com/docs/before_woocommerce_sequra_add_widget_to_page Use this action hook to execute custom code just before the seQura widget shortcode is added to a product page. This can prevent multiple instances of the widget from appearing. ```php add_action('before_woocommerce_sequra_add_widget_to_page', function(){ // Add your custom code here }); ```