### 3DS2 Setup Response Example Source: https://docs.malga.io/documentations/3ds2-malga/3ds-malga/transacao-3ds2-na-malga This is a simplified example of the JSON response received after successfully setting up a 3DS2 session. Key fields like 'id', 'token', and 'collectUrl' are crucial for proceeding with the transaction. ```json { "id": "11111111-2222-3333-4444-555555555555", "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9....", "collectUrl": "https://centinel.api.cardecommerce.com/V1/Cruise/Collect", "providerType": "CYBERSOURCE", "error": null } ``` -------------------------------- ### Create Charge with Card ID and 3D Secure Setup Source: https://docs.malga.io/api-reference/charges/realizar-nova-cobranca This example shows how to create a charge using a pre-registered card ID and initiating a 3D Secure setup. It includes parameters for liability shift and redirect URLs. ```json { "merchantId": "b669086b-68b1-4f55-95bd-8ab45e48d670", "amount": 150, "statementDescriptor": "Teste Card Adyen", "capture": true, "paymentMethod": { "paymentType": "credit", "installments": 1 }, "paymentSource": { "sourceType": "card", "cardId": "f01044c6-1452-43bc-8492-29a17d58ba9d" }, "vendor": { "id": "c0a7f5fa-4a8a-48ef-9f46-7727ca2d75b4" }, "threeDSecure2": { "setupId": "05ee0280-afe2-4b81-991b-383a7feaae5f", "requiresLiabilityShift": false, "redirectURL": "https://www.google.com", "requestorURL": "https://localhost", "browser": { "acceptBrowserValue": "v1" } } } ``` -------------------------------- ### Complete main.ts Configuration (Vue 3) Source: https://docs.malga.io/sdks/malga-checkout/vue A full example of the main.ts file showing the import of Vue, Malga Checkout core loader, and the application setup. ```typescript import { createApp } from "vue"; import { applyPolyfills, defineCustomElements, } from "@malga-checkout/core/loader"; import App from "./App.vue"; const app = createApp(App); applyPolyfills().then(() => { defineCustomElements().then(() => { app.mount("#app"); }); }); ``` -------------------------------- ### Install Dependencies with npm Source: https://docs.malga.io/documentations/3ds2-malga/3ds-malga/exemplo-pratico Use this command to install the necessary project dependencies. Ensure you have Node.js and npm installed. ```bash npm install ``` -------------------------------- ### Install Malga Tokenization SDK with npm Source: https://docs.malga.io/sdks/tokenization/v2/quickstart Install the Malga Tokenization SDK using npm. Ensure you have Node.js and npm installed. ```bash npm install @malga/tokenization ``` -------------------------------- ### Authenticate and List Subscription Cycles Source: https://docs.malga.io/api-reference/subscriptions/listagem-de-cycles-de-uma-assinatura Example of how to authenticate with Malga API using X-Client-ID and X-Api-Key headers and make a GET request to list subscription cycles. ```bash curl --location --request GET 'https://api.malga.io/v1/subscriptions/{id}/cycles' \ --header 'X-Client-Id: ' \ --header 'X-Api-Key: ' ``` -------------------------------- ### Install Malga Tokenization SDK with yarn Source: https://docs.malga.io/sdks/tokenization/v2/quickstart Install the Malga Tokenization SDK using yarn. Ensure you have Node.js and yarn installed. ```bash yarn add @malga/tokenization ``` -------------------------------- ### Authentication Example Source: https://docs.malga.io/api-reference/api-spec.yaml Example of how to authenticate API requests using X-Client-ID and X-Api-Key headers. ```APIDOC ## Authenticated Request Example ```bash curl --location --request GET 'https://api.malga.io/v1/' \ --header 'X-Client-Id: ' \ --header 'X-Api-Key: ' ``` ### Description This example demonstrates how to make an authenticated GET request to the Malga API. You need to replace the placeholder values for `X-Client-Id` and `X-Api-Key` with your actual credentials. ### Method GET ### Endpoint `https://api.malga.io/v1/` ### Headers - **X-Client-Id** (string) - Required - Your unique Malga account identifier. - **X-Api-Key** (string) - Required - Your secret API access key. ``` -------------------------------- ### Install Malga Tokenization SDK with pnpm Source: https://docs.malga.io/sdks/tokenization/v2/quickstart Install the Malga Tokenization SDK using pnpm. Ensure you have Node.js and pnpm installed. ```bash pnpm add @malga/tokenization ``` -------------------------------- ### Install Malga Checkout SDK Source: https://docs.malga.io/sdks/malga-checkout/vue Install the Malga Checkout core package using npm or yarn. ```bash npm install --save @malga-checkout/core ``` -------------------------------- ### Start the Development Server Source: https://docs.malga.io/documentations/3ds2-malga/3ds-malga/exemplo-pratico Run this command to start the Node.js server for the demo project. This will make the checkout page accessible locally. ```bash npm run serve ``` -------------------------------- ### Example Authenticated GET Request Source: https://docs.malga.io/analytics/authentication/authentication An example of an authenticated GET request to the Malga Analytics API. Replace placeholders with your actual client ID and secret key. ```bash curl --location --request GET 'https://api.malga.io/v1/graphql' \ --header 'X-Client-Id: ' \ --header 'X-Api-Key: ' \ ... ``` -------------------------------- ### Authenticated API Request Example Source: https://docs.malga.io/api-reference/authentication This example demonstrates how to make an authenticated GET request to the Malga API using cURL. Ensure you replace `` and `` with your actual credentials. ```bash curl --location --request GET 'https://api.malga.io/v1/' \ --header 'X-Client-Id: ' \ --header 'X-Api-Key: ' ``` -------------------------------- ### Create Seller Example Source: https://docs.malga.io/documentations/split/seller This example demonstrates how to create a new seller by sending a POST request to the /v1/sellers endpoint with the required payload and headers. ```APIDOC ## POST /v1/sellers ### Description Creates a new seller (recebedor) in the Malga system. ### Method POST ### Endpoint https://api.malga.io/v1/sellers ### Headers - **X-Client-Id**: - **X-Api-Key**: - **Content-Type**: application/json ### Request Body - **merchantId** (string) - Required - The unique identifier for the merchant. - **owner** (object) - Required - Information about the seller's owner. - **name** (string) - Required - **email** (string) - Required - **phoneNumber** (string) - Required - **birthdate** (string) - Required (YYYY-MM-DD) - **document** (object) - Required - **type** (string) - Required (e.g., "cpf") - **number** (string) - Required - **country** (string) - Required (e.g., "BR") - **address** (object) - Required - **street** (string) - Required - **streetNumber** (string) - Required - **complement** (string) - Optional - **zipCode** (string) - Required - **country** (string) - Required - **state** (string) - Required - **city** (string) - Required - **district** (string) - Required - **businessCategory** (string) - Required (e.g., "OTHER_SERVICES") - **business** (object) - Required - Information about the seller's business. - **name** (string) - Required - **corporateReason** (string) - Optional - **phoneNumber** (string) - Optional - **email** (string) - Optional - **website** (string) - Optional - **description** (string) - Optional - **facebook** (string) - Optional - **twitter** (string) - Optional - **openingDate** (string) - Optional (YYYY-MM-DD) - **address** (object) - Required - **street** (string) - Required - **streetNumber** (string) - Required - **complement** (string) - Optional - **zipCode** (string) - Required - **country** (string) - Required - **state** (string) - Required - **city** (string) - Required - **district** (string) - Required - **document** (object) - Required - **type** (string) - Required (e.g., "cnpj") - **number** (string) - Required - **country** (string) - Required (e.g., "BR") - **mcc** (integer) - Required - Merchant Category Code. - **bankAccount** (object) - Required - Bank account details for transfers. - **holderName** (string) - Required - **holderDocument** (string) - Required - **bank** (string) - Required - **branchNumber** (string) - Required - **branchCheckDigit** (string) - Optional - **accountNumber** (string) - Required - **accountCheckDigit** (string) - Required - **type** (string) - Required (e.g., "conta_corrente") - **transferPolicy** (object) - Optional - Policy for fund transfers. - **transferDay** (integer) - Optional - **transferEnabled** (boolean) - Optional - **transferInterval** (string) - Optional (e.g., "weekly") - **automaticAnticipationEnabled** (boolean) - Optional - **anticipatableVolumePercentage** (string) - Optional - **automaticAnticipationType** (string) - Optional - **automaticAnticipationDays** (string) - Optional - **automaticAnticipation1025Delay** (string) - Optional ### Request Example ```json { "merchantId": "b1612460-0fef-447d-9590-97825cf60cf6", "owner": { "name": "Seller", "email": "seller@email.com", "phoneNumber": "85988350264", "birthdate": "1995-01-27", "document": { "type": "cpf", "number": "36243319067", "country": "BR" }, "address": { "street": "Rua Nova Lua", "streetNumber": "30", "complement": "casa 4", "zipCode": "61000-320", "country": "BR", "state": "CE", "city": "Maracanaú", "district": "AB" }, "businessCategory": "OTHER_SERVICES" }, "business": { "name": "Seller business", "corporateReason": "Company social reason", "phoneNumber": "85988350264", "email": "sellerbusiness@email.com", "website": "www.sellerbusiness.com.br", "description": "Seller business", "facebook": "facebook Seller business", "twitter": "twitter Seller business", "openingDate": "1995-01-27", "address": { "street": "Rua Nova Lua", "streetNumber": "30", "complement": "sala 100", "zipCode": "61000-320", "country": "BR", "state": "CE", "city": "Maracanaú", "district": "AB" }, "document": { "type": "cnpj", "number": "94938591000196", "country": "BR" } }, "mcc": 4040, "bankAccount": { "holderName": "Seller name", "holderDocument": "36243319067", "bank": "077", "branchNumber": "492", "branchCheckDigit": "1", "accountNumber": "4929", "accountCheckDigit": "22", "type": "conta_corrente" }, "transferPolicy": { "transferDay": 5, "transferEnabled": true, "transferInterval": "weekly", "automaticAnticipationEnabled": false, "anticipatableVolumePercentage": "", "automaticAnticipationType": "", "automaticAnticipationDays": "", "automaticAnticipation1025Delay": "" } } ``` ``` -------------------------------- ### Initialize Malga API SDK (Node.js) Source: https://docs.malga.io/sdks/api-sdks/docs/intro Import and initialize the Malga SDK with your API key, client ID, and optional configurations like sandbox mode and HTTP retry settings. Ensure you have your Malga credentials before proceeding. ```typescript import { Malga } from "malga"; const malga = new Malga({ apiKey: "17a64c8f-a387-4682-bdd8-d280493715e0", clientId: "d1d2b51a-0446-432a-b055-034518c2660e", options: { sandbox: true, http: { retries: 3, retryDelay: 10000, }, }, }); ``` -------------------------------- ### Example Authenticated Request Source: https://docs.malga.io/api-reference/api-spec.yaml This example demonstrates how to make an authenticated GET request to the Malga API using curl. Ensure you replace the placeholder values for 'X-Client-Id' and 'X-Api-Key' with your actual credentials. ```bash curl --location --request GET 'https://api.malga.io/v1/' \ --header 'X-Client-Id: ' \ --header 'X-Api-Key: ' ``` -------------------------------- ### Start typing animation Source: https://malga.io/blog This function initiates the typing animation by getting references to the relevant DOM elements and starting the animation sequence. It checks for element existence and uses an IntersectionObserver to trigger the animation when the element is in view. ```javascript function g(){const e={principal:document.getElementById("principal-phrase"),rotating:document.getElementById("rotating-phrase"),cursorPrincipal:document.getElementById("principal-cursor"),cursorRotating:document.getElementById("rotating-cursor")};Object.values(e).some(n=>!n)||(e.cursorRotating?.classList.add("hidden"),s(e),t.animationStarted=!0)} ``` -------------------------------- ### Example Authenticated Request Source: https://docs.malga.io/api-reference/client-token/criar-nova-chave-publica-para-uso-no-client-side This bash command demonstrates how to make an authenticated GET request to the Malga API using your Client ID and Secret Key. ```bash curl --location --request GET 'https://api.malga.io/v1/' \ --header 'X-Client-Id: ' \ --header 'X-Api-Key: ' ``` -------------------------------- ### Initiate 3D Secure Setup Source: https://docs.malga.io/api-reference/api-spec.yaml This endpoint creates a setup for 3D Secure Malga. It requires your Client ID and API Key in the headers and a card ID in the JSON payload. ```Python import requests client_id = public_key = request = requests.post('https://api.malga.io/v1/charges/3ds/setup', headers={ "X-Client-Id": client_id, "X-Api-Key": publick_key }, json={ "sourceType": "card", "cardId": "4918cfd2-b14a-4db2-ade4-d1b8a6bd40e2" }) print(request.json().get('id')) ``` -------------------------------- ### Criar Assinatura com Cobrança Imediata Source: https://docs.malga.io/documentations/more/recurrence/engine/instant-payment Exemplo de requisição cURL para criar uma assinatura com o campo 'startAt' definido para a data atual, resultando em processamento imediato da primeira cobrança. Certifique-se de substituir os placeholders como 'YOUR_CLIENT_ID', 'YOUR_API_KEY', 'YOUR_MERCHANT_ID', 'YOUR_CUSTOMER_ID', e 'YOUR_CARD_ID' pelos seus valores reais. O campo 'startAt' deve estar em formato UTC. ```bash curl --location 'https://api.malga.io/v1/subscriptions' \ --header 'Content-Type: application/json' \ --header 'X-Client-Id: YOUR_CLIENT_ID' \ --header 'X-Api-Key: YOUR_API_KEY' \ --data '{ \ "name": "Assinatura Premium com Eventos", \ "merchantId": "YOUR_MERCHANT_ID", \ "customerId": "YOUR_CUSTOMER_ID", \ "referenceKey": "SUB-PREMIUM-001", \ "recurrence": { \ "interval": "monthly", \ "startAt": "2025-08-06" \ }, \ "paymentMethod": { \ "type": "credit", \ "card": { \ "cardId": "YOUR_CARD_ID" \ } \ }, \ "items": [ \ { \ "name": "Ingresso VIP Mensal", \ "description": "Acesso VIP premium a eventos mensais", \ "amount": 29900, \ "quantity": 1, \ "sku": "VIP-EVENT-001", \ "risk": "Low", \ "categoryId": "entertainment", \ "locality": "São Paulo", \ "date": "2025-12-01", \ "type": 1, \ "genre": "Shows e Eventos", \ "tickets": { \ "quantityTicketSale": 1, \ "convenienceFeeValue": 15.5, \ "quantityFull": 1, \ "batch": 1 \ }, \ "location": { \ "street": "Av. Paulista", \ "number": "1000", \ "complement": "Centro de Convenções", \ "zipCode": "01310-100", \ "city": "São Paulo", \ "state": "SP", \ "country": "Brasil", \ "district": "Bela Vista", \ "reference": "Próximo ao MASP" \ } \ } \ ] \ }' ``` -------------------------------- ### Create Subscription with Specific Start Date Source: https://docs.malga.io/documentations/more/recurrence/engine/instant-payment Example of a successful API response when creating a subscription with a defined 'startAt' date. This response includes all details of the created subscription and its first cycle. ```json { "id": "subscription_id_example", "name": "Assinatura Premium com Eventos", "clientId": "YOUR_CLIENT_ID", "merchantId": "YOUR_MERCHANT_ID", "customerId": "YOUR_CUSTOMER_ID", "referenceKey": "SUB-PREMIUM-001", "currency": "BRL", "items": [ { "name": "Ingresso VIP Mensal", "description": "Acesso VIP premium a eventos mensais", "amount": 29900, "quantity": 1, "sku": "VIP-EVENT-001", "risk": "Low", "categoryId": "entertainment", "locality": "São Paulo", "date": "2025-12-01", "type": 1, "genre": "Shows e Eventos", "tickets": { "quantityTicketSale": 1, "convenienceFeeValue": 15.5, "quantityFull": 1, "batch": 1 }, "location": { "street": "Av. Paulista", "number": "1000", "complement": "Centro de Convenções", "zipCode": "01310-100", "city": "São Paulo", "state": "SP", "country": "Brasil", "district": "Bela Vista", "reference": "Próximo ao MASP" } } ], "recurrence": { "interval": "monthly", "startAt": "2025-08-05", "nextDueDate": "2025-09-05" }, "paymentMethod": { "type": "credit", "card": { "cardId": "YOUR_CARD_ID" }, "installments": 1 }, "status": "active", "amount": 29900, "liveMode": true, "lastCycle": { "id": "cycle_id_example", "customerId": "YOUR_CUSTOMER_ID", "merchantId": "YOUR_MERCHANT_ID", "cycle": 1, "attempts": 1, "status": "authorized", "isEmulated": false, "createdAt": "2025-08-05T17:59:45.243691Z", "scheduledAt": "2025-08-05", "executedAt": "2025-08-05", "paymentHistory": [ { "id": "payment_history_id_example", "createdAt": "2025-08-05T17:59:45.249579Z", "chargeId": "charge_id_example", "attemptNumber": 1, "status": "authorized", "error": null } ] }, "createdAt": "2025-08-05T17:59:45.219657Z", "updatedAt": "2025-08-05T17:59:47.02068159Z" } ``` -------------------------------- ### API Root Endpoint Source: https://docs.malga.io/documentations/welcome/authentication This example shows how to make a GET request to the API root endpoint to verify authentication. It requires your Malga Client ID and Secret API Key in the headers. ```APIDOC ## GET /v1/ ### Description Verifies authentication by accessing the API root. ### Method GET ### Endpoint /v1/ ### Parameters #### Headers - **X-Client-Id** (string) - Required - Your Malga Client ID. - **X-Api-Key** (string) - Required - Your Malga Secret API Key. ### Request Example ```bash curl --location --request GET 'https://api.malga.io/v1/' \ --header 'X-Client-Id: ' \ --header 'X-Api-Key: ' ``` ``` -------------------------------- ### Complete Vue.js Main Configuration Source: https://docs.malga.io/sdks/malga-checkout-full/vue This example shows a complete `main.ts` file for a Vue 2 application, including the Malga Checkout SDK initialization. Ensure all imports and configurations are correctly placed. ```typescript import Vue from "vue"; import App from "./App.vue"; import { applyPolyfills, defineCustomElements, } from "@malga-checkout/core/loader"; Vue.config.productionTip = false; Vue.config.ignoredElements = [/malga-\w*/]; applyPolyfills().then(() => { defineCustomElements(); }); new Vue({ render: (h) => h(App), }).$mount("#app"); ``` -------------------------------- ### Conditional Operators for Transaction Routing Source: https://docs.malga.io/documentations/flow-guide/introduction Examples of supported conditional operators used to define routing logic for payment transactions. These operators can compare native transaction data like amount and installments, or custom metadata. ```text transaction.amount < 5000 ``` ```text transaction.amount > 5000 ``` ```text transaction.amount <= 5000 ``` ```text transaction.amount >= 5000 ``` ```text transaction.installments = 0 ``` ```text transaction.installments != 0 ``` ```text transaction.installments = 0 and transaction.amount < 5000 ``` ```text transaction.installments = 0 or transaction.amount < 5000 ``` -------------------------------- ### Complete AppModule Configuration Source: https://docs.malga.io/sdks/malga-checkout/angular An example of a complete `app.module.ts` file after importing the Malga Checkout module. ```typescript import { NgModule } from "@angular/core"; import { BrowserModule } from "@angular/platform-browser"; import { MalgaCheckoutModule } from "@malga-checkout/angular"; import { AppComponent } from "./app.component"; @NgModule({ declarations: [AppComponent], imports: [BrowserModule, MalgaCheckoutModule], providers: [], bootstrap: [AppComponent], }) export class AppModule {} ```