### JSON Response Sample for Checkout Source: https://app.mangofy.com.br/checkout/doc Example of a JSON response received after a checkout operation. Includes payment details, status, and card information. ```json { "payment_code": "vpaj2qy09l", "payment_method": "credit_card", "payment_status": "approved", "payment_amount": 500, "sale_amount": 500, "shipping_amount": 0, "installments": 1, "installment_amount": 500, "card": { "card_rejected": true, "card_message": "string", "card_flag": "visa", "card_first_six_digits": "503143", "card_last_four_digits": "6351", "card_token": "8358c10af5464f7e3ba1aee829b0079f0aceaabc099b112d39e8b7e001325a10", "card_soft_descriptor": "primeiraloja" } } ``` -------------------------------- ### JSON Response for Refund Request Source: https://app.mangofy.com.br/checkout/doc Example of a JSON response indicating a successful refund request. The message confirms the cancellation was processed. ```json { "message": "Cancelamento solicitado" } ``` -------------------------------- ### Webhook Example for Approved PIX Payment Source: https://app.mangofy.com.br/checkout/doc Illustrates the structure of a webhook notification for an approved PIX payment. Includes key transaction details and timestamps. ```json { "payment_code": "PPPPPPPPPPPPP", "external_code": "AAAAAAAAAAA", "payment_method": "pix", "payment_status": "approved" "created_at": "1970-01-01 00:00:00", "updated_at" : "1970-01-01 00:00:00", "approved_at": "1970-01-01 00:00:00", "refunded_at": "1970-01-01 00:00:00", } ``` -------------------------------- ### Get Payment Details - PHP Source: https://app.mangofy.com.br/checkout/doc Use this snippet to retrieve the details of a specific payment using its code. Ensure you have your API Key and Store Code for authorization. ```php $client = new \GuzzleHttp\Client(); $url = 'https://checkout.mangofy.com.br/api/v1/payment/AAAAAAAAAA'; $response = $client->get($url, [ 'headers' => [ 'Authorization' => '2980d79d0a69fb12a0a0ee3be31f4cb9fwhgjdhm0ertokhggoe4ydm1lrrg43f', 'Store-Code' => 'vstmz4tr', 'Content-Type' => 'application/json', 'Accept' => 'application/json', ], ]); $body = $response->getBody(); print_r(json_decode((string) $body)); ``` -------------------------------- ### GET /api/v1/payment/{paymentCode} Source: https://app.mangofy.com.br/checkout/doc Retrieves the details of a specific payment using its unique code. Supports various payment statuses like approved, pending, refunded, and error. ```APIDOC ## GET /api/v1/payment/{paymentCode} ### Description Obtém os detalhes de um pagamento específico pelo código. ### Method GET ### Endpoint /api/v1/payment/{paymentCode} ### Parameters #### Path Parameters - **paymentCode** (string) - Required - Código do pagamento ### Responses #### Success Response (200) Detalhes do pagamento #### Error Response (404) Pagamento não encontrado ### Request Example ```javascript const url = 'https://checkout.mangofy.com.br/api/v1/payment/AAAAAAAAAA'; const headers = { 'Authorization': '2980d79d0a69fb12a0a0ee3be31f4cb9fwhgjdhm0ertokhggoe4ydm1lrrg43f', 'Store-Code': 'vstmz4tr', 'Content-Type': 'application/json', 'Accept': 'application/json' }; fetch(url, { method: 'GET', headers: headers }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error)); ``` ### Response Example (200) ```json { "payment_code": "vpaj2qy09l", "payment_method": "credit_card", "payment_status": "approved", "payment_amount": 500, "sale_amount": 500, "shipping_amount": 0, "installments": 1, "installment_amount": 500, "card": { "card_rejected": true, "card_message": "string", "card_flag": "visa", "card_first_six_digits": "503143", "card_last_four_digits": "6351", "card_token": "8358c10af5464f7e3ba1aee829b0079f0aceaabc099b112d39e8b7e001325a10", "card_soft_descriptor": "primeiraloja" } } ``` ``` -------------------------------- ### Payment Response Sample (200 OK) Source: https://app.mangofy.com.br/checkout/doc This is a sample JSON response for a successful payment retrieval. It includes details such as payment method, amount, and card information. ```json { * "payment_code": "vpaj2qy09l", * "payment_method": "credit_card", * "payment_status": "approved", * "payment_amount": 500, * "sale_amount": 500, * "shipping_amount": 0, * "installments": 1, * "installment_amount": 500, * "card": { * "card_rejected": true, * "card_message": "string", * "card_flag": "visa", * "card_first_six_digits": "503143", * "card_last_four_digits": "6351", * "card_token": "8358c10af5464f7e3ba1aee829b0079f0aceaabc099b112d39e8b7e001325a10", * "card_soft_descriptor": "primeiraloja" } } ``` -------------------------------- ### Create Payment Source: https://app.mangofy.com.br/checkout/doc Initiates a payment transaction with various details including store information, payment method, amounts, items, customer, and card details. ```APIDOC ## POST /api/v1/checkout ### Description Initiates a payment transaction. ### Method POST ### Endpoint /api/v1/checkout ### Request Body - **store_code** (string) - Required - The unique code of the store. - **external_code** (string) - Required - An external identifier for the transaction. - **payment_method** (string) - Required - The method of payment (e.g., "credit_card"). - **payment_format** (string) - Required - The format of the payment (e.g., "regular"). - **installments** (integer) - Optional - The number of installments for the payment. - **payment_amount** (number) - Required - The amount of the payment. - **shipping_amount** (number) - Required - The amount for shipping. - **postback_url** (string) - Required - The URL to receive postback notifications. - **items** (array) - Required - A list of items included in the transaction. - **code** (string) - Required - The item code. - **name** (string) - Required - The item name. - **amount** (number) - Required - The item amount. - **total** (number) - Required - The total amount for the item. - **customer** (object) - Required - Customer details. - **email** (string) - Required - Customer's email address. - **name** (string) - Required - Customer's name. - **document** (string) - Required - Customer's document number. - **phone** (string) - Required - Customer's phone number. - **ip** (string) - Required - Customer's IP address. - **card** (object) - Optional - Card details for credit card payments. - **token** (string) - Optional - Card token. - **number** (string) - Optional - Card number. - **holder_name** (string) - Optional - Name of the cardholder. - **expiration_month** (integer) - Optional - Expiration month of the card. - **expiration_year** (integer) - Optional - Expiration year of the card. - **cvv** (string) - Optional - Card verification value. - **soft_descriptor** (string) - Optional - Soft descriptor for the transaction. - **pix** (object) - Optional - Pix payment details. - **expires_in_days** (integer) - Optional - Number of days until Pix expires. - **billet** (object) - Optional - Billet payment details. - **expires_in_days** (integer) - Optional - Number of days until Billet expires. - **shipping** (object) - Optional - Shipping address details. - **street** (string) - Required - Street name. - **street_number** (string) - Required - Street number. - **complement** (string) - Optional - Complement to the address. - **neighborhood** (string) - Required - Neighborhood. - **city** (string) - Required - City. - **state** (string) - Required - State. - **zip_code** (string) - Required - Zip code. - **country** (string) - Required - Country. - **extra** (object) - Optional - Additional information for fraud detection and analytics. - **userAgent** (string) - Optional - User's User-Agent string. - **browser** (string) - Optional - User's browser name. - **os** (string) - Optional - User's operating system. - **device** (string) - Optional - User's device type. - **browser_fingerprint** (string) - Optional - Browser fingerprint. - **cybersource_fingerprint** (string) - Optional - Cybersource fingerprint. - **seon_fingerprint** (string) - Optional - Seon fingerprint. - **url_referer** (string) - Optional - Referer URL. - **url_full** (string) - Optional - Full URL of the request. - **metadata** (object) - Optional - Additional metadata. ### Request Example ```json { "store_code": "string", "external_code": "string", "payment_method": "credit_card", "payment_format": "regular", "installments": 1, "payment_amount": 500, "shipping_amount": 2000000, "postback_url": "string", "items": [ { "code": "string", "name": "string", "amount": 0, "total": 0 } ], "customer": { "email": "user@example.com", "name": "string", "document": "stringstrin", "phone": "string", "ip": "string" }, "card": { "token": "string", "number": "string", "holder_name": "string", "expiration_month": 1, "expiration_year": 2024, "cvv": "stri", "soft_descriptor": "string" }, "pix": { "expires_in_days": 1 }, "billet": { "expires_in_days": 1 }, "shipping": { "street": "string", "street_number": "string", "complement": "string", "neighborhood": "string", "city": "string", "state": "string", "zip_code": "string", "country": "string" }, "extra": { "userAgent": "string", "browser": "string", "os": "string", "device": "string", "browser_fingerprint": "string", "cybersource_fingerprint": "string", "seon_fingerprint": "string", "url_referer": "string", "url_full": "string", "metadata": {} } } ``` ### Response #### Success Response (200) - **payment_code** (string) - The unique code for the created payment. - **payment_method** (string) - The method of payment used. - **payment_status** (string) - The current status of the payment. - **payment_amount** (number) - The total amount of the payment. - **sale_amount** (number) - The total sale amount. - **shipping_amount** (number) - The shipping amount. - **installments** (integer) - The number of installments. - **installment_amount** (number) - The amount per installment. - **card** (object) - Details about the card used, if applicable. - **card_rejected** (boolean) - Indicates if the card was rejected. - **card_message** (string) - Message related to card processing. - **card_flag** (string) - The card network (e.g., "visa"). - **card_first_six_digits** (string) - The first six digits of the card number. - **card_last_four_digits** (string) - The last four digits of the card number. - **card_token** (string) - Token representing the card. - **card_soft_descriptor** (string) - Soft descriptor for the transaction. #### Response Example ```json { "payment_code": "vpaj2qy09l", "payment_method": "credit_card", "payment_status": "approved", "payment_amount": 500, "sale_amount": 500, "shipping_amount": 0, "installments": 1, "installment_amount": 500, "card": { "card_rejected": true, "card_message": "string", "card_flag": "visa", "card_first_six_digits": "503143", "card_last_four_digits": "6351", "card_token": "8358c10af5464f7e3ba1aee829b0079f0aceaabc099b112d39e8b7e001325a10", "card_soft_descriptor": "primeiraloja" } } ``` ``` -------------------------------- ### PHP Refund Request Source: https://app.mangofy.com.br/checkout/doc Demonstrates how to initiate a payment refund using PHP with the Guzzle HTTP client. Ensure correct headers and URL are used. ```php $client = new \GuzzleHttp\Client(); $url = 'https://checkout.mangofy.com.br/api/v1/payment/refund/PPPPPPPPPPPPP'; $response = $client->post($url, [ 'headers' => [ 'Authorization' => '2980d79d0a69fb12a0a0ee3be31f4cb9fwhgjdhm0ertokhggoe4ydm1lrrg43f', 'Content-Type' => 'application/json', 'Accept' => 'application/json', ], ]); print_r(json_decode((string) $response->getBody())); ``` -------------------------------- ### POST /api/v1/payment Source: https://app.mangofy.com.br/checkout/doc Creates a payment request with provided details including amount, currency, payment method, and customer information. Returns a unique PAYMENT_CODE for tracking. ```APIDOC ## POST /api/v1/payment ### Description Cria uma solicitação de pagamento com base nas informações fornecidas, como o valor da compra, moeda, método de pagamento e detalhes do comprador. A resposta inclui um ID único para o pagamento (PAYMENT_CODE), que pode ser utilizado para acompanhar o status da transação ou realizar outras operações, como estornos. ### Method POST ### Endpoint /api/v1/payment ### Parameters #### Request Body - **store_code** (string) - Required - <= 100 characters - **external_code** (string or null) - Optional - <= 100 characters - Identificador interno definido pela empresa integradora. Formato livre, utilizado para rastrear e referenciar transações em seu sistema. - **payment_method** (string) - Required - Enum: "credit_card", "billet", "pix" - **payment_format** (string) - Required - Enum: "regular", "orderbump", "upsell" - **installments** (integer) - Required - [1 .. 12] - Número de parcelas. - **payment_amount** (integer) - Required - [500 .. 2000000] - Valor total do pagamento em centavos. - **shipping_amount** (integer or null) - Optional - [0 .. 2000000] - Valor total do frete em centavos. - **postback_url** (string or null) - Optional - <= 1000 characters - URL para notificação. - **items** (Array of objects or null) - Optional - **customer** (object) - Required - **card** (object or null) - Campo obrigatório quando o campo `payment_method` for `credit_card`. - **pix** (object or null) - Campo obrigatório quando o campo `payment_method` for `pix`. - **billet** (object or null) - Campo obrigatório quando o campo `payment_method` for `billet`. - **shipping** (object or null) - Optional - **extra** (object or null) - Optional ### Responses #### Success Response (200) Pagamento criado com sucesso #### Error Response (4XX) Erro na requisição ### Request Example ```json { "store_code": "vstmz4tr", "external_code": "MEU_ID_EXTERNO_123", "payment_method": "credit_card", "payment_format": "regular", "installments": 1, "payment_amount": 5000, "shipping_amount": 1000, "postback_url": "https://meusite.com/webhook", "items": [ { "sku": "SKU001", "description": "Produto Exemplo 1", "quantity": 1, "unit_price": 5000 } ], "customer": { "name": "João Silva", "email": "joao.silva@example.com", "phone": "11999998888", "document": "11111111111", "address": { "street": "Rua das Flores", "number": "123", "complement": "Apto 4B", "neighborhood": "Centro", "city": "São Paulo", "state": "SP", "zipcode": "01000000" } }, "card": { "card_number": "4111111111111111", "card_holder_name": "Joao Silva", "card_expiration_date": "12/2025", "card_cvv": "123", "card_token": "8358c10af5464f7e3ba1aee829b0079f0aceaabc099b112d39e8b7e001325a10" } } ``` ``` -------------------------------- ### Webhooks Source: https://app.mangofy.com.br/checkout/doc Receives notifications for status updates on a sale. A POST request is sent to the specified `postback_url` with updated transaction information. ```APIDOC ## Webhooks ### Description A POST request will be sent to the URL specified in `postback_url` for every update in the sale status, containing all updated transaction information. In case of failures, there will be up to 4 additional attempts at increasing intervals: Second attempt: 4 minutes, Third attempt: 16 minutes, Fourth attempt: 64 minutes, Last attempt: 256 minutes. ### Request Body Example (Pix Approved Sale) ```json { "payment_code": "PPPPPPPPPPPPP", "external_code": "AAAAAAAAAAA", "payment_method": "pix", "payment_status": "approved", "created_at": "1970-01-01 00:00:00", "updated_at" : "1970-01-01 00:00:00", "approved_at": "1970-01-01 00:00:00", "refunded_at": "1970-01-01 00:00:00" } ``` ``` -------------------------------- ### Refund Payment Source: https://app.mangofy.com.br/checkout/doc Processes the refund (estorno) of a previously made payment using the payment code. ```APIDOC ## POST /api/v1/payment/refund/{paymentCode} ### Description Processes the refund (estorno) of a previously made payment. It receives the `paymentCode` of the original payment and performs a total refund. Used in cases of purchase cancellation, reimbursement, or disputes. As soon as the refund is effective, a postback will be sent with the new status `refunded`. ### Method POST ### Endpoint /api/v1/payment/refund/{paymentCode} ### Path Parameters - **paymentCode** (string) - Required - The code of the payment to be refunded. ### Responses #### Success Response (200) - **message** (string) - Confirmation message indicating the refund request was successful. #### Error Response (404) - Payment not found. #### Error Response (409) - Refund not permitted. ### Request Example (PHP) ```php $client = new \GuzzleHttp\Client(); $url = 'https://checkout.mangofy.com.br/api/v1/payment/refund/PPPPPPPPPPPPP'; $response = $client->post($url, [ 'headers' => [ 'Authorization' => '2980d79d0a69fb12a0a0ee3be31f4cb9fwhgjdhm0ertokhggoe4ydm1lrrg43f', 'Content-Type' => 'application/json', 'Accept' => 'application/json', ], ]); print_r(json_decode((string) $response->getBody())); ``` ### Response Example (200 OK) ```json { "message": "Cancelamento solicitado" } ``` ``` -------------------------------- ### JSON Request Payload Structure Source: https://app.mangofy.com.br/checkout/doc Defines the structure for a JSON request payload for checkout operations. Includes fields for store information, payment details, items, customer, card, and shipping. ```json { "store_code": "string", "external_code": "string", "payment_method": "credit_card", "payment_format": "regular", "installments": 1, "payment_amount": 500, "shipping_amount": 2000000, "postback_url": "string", "items": [ { "code": "string", "name": "string", "amount": 0, "total": 0 } ], "customer": { "email": "user@example.com", "name": "string", "document": "stringstrin", "phone": "string", "ip": "string" }, "card": { "token": "string", "number": "string", "holder_name": "string", "expiration_month": 1, "expiration_year": 2024, "cvv": "stri", "soft_descriptor": "string" }, "pix": { "expires_in_days": 1 }, "billet": { "expires_in_days": 1 }, "shipping": { "street": "string", "street_number": "string", "complement": "string", "neighborhood": "string", "city": "string", "state": "string", "zip_code": "string", "country": "string" }, "extra": { "userAgent": "string", "browser": "string", "os": "string", "device": "string", "browser_fingerprint": "string", "cybersource_fingerprint": "string", "seon_fingerprint": "string", "url_referer": "string", "url_full": "string", "metadata": { } } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.