### Example Pix Approved Sale Webhook Payload Source: https://app.goldiix.com/gateway/doc/index This JSON object represents an example webhook payload for a Pix payment that has been approved. It includes transaction details such as payment code, external code, payment method, status, 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 /api/v2/payment/{paymentCode} Source: https://app.goldiix.com/gateway/doc/index Retrieves the details of a specific payment using its unique payment code. This endpoint allows you to check the status and information of a transaction. ```APIDOC ## GET /api/v2/payment/{paymentCode} ### Description Obtém os detalhes de um pagamento específico pelo código. Permite verificar o status e as informações de uma transação. ### Statuses - **approved**: Transação aprovada com sucesso. - **pending**: Transação pendente de confirmação. - **refunded**: Transação estornada. - **error**: Houve um erro no processamento do pagamento. ### Method GET ### Endpoint /api/v2/payment/{paymentCode} ### Parameters #### Path Parameters - **paymentCode** (string) - Required - O código único do pagamento a ser consultado. #### Headers - **Authorization** (string) - Required - Bearer token obtained from the authentication endpoint. - **Content-Type** (string) - Required - application/json - **Accept** (string) - Required - application/json ### Request Example ```php $client = new \GuzzleHttp\Client(); $url = 'checkout.goldiix.com/api/v2/payment/AAAAAAAAAA'; $accessToken = 'YOUR_ACCESS_TOKEN'; // Replace with your actual access token $response = $client->get($url, [ 'headers' => [ 'Authorization' => 'Bearer ' . $accessToken, 'Content-Type' => 'application/json', 'Accept' => 'application/json', ], ]); $body = $response->getBody(); print_r(json_decode((string) $body)); ``` ### Response #### Success Response (200) - **payment_code** (string) - The unique code for the payment. - **payment_method** (string) - The method used for the payment (e.g., 'credit_card'). - **payment_status** (string) - The current status of the payment (approved, pending, refunded, error). - **payment_amount** (float) - The total amount of the payment. - **sale_amount** (float) - The amount of the sale. - **shipping_amount** (float) - The amount charged for shipping. - **installments** (integer) - The number of installments, if applicable. - **installment_amount** (float) - The amount of each installment. - **card** (object) - Details about the card used for payment, if applicable. - **card_rejected** (boolean) - Indicates if the card was rejected. - **card_message** (string) - Message related to the card status. - **card_flag** (string) - The brand of the card (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) - A token representing the card details. - **card_soft_descriptor** (string) - The soft descriptor for the transaction. #### Response Example ```json { "payment_code": "ABCDE", "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": "john doe" } } ``` #### Error Response (404) - **message** (string) - Indicates that the payment was not found. ``` -------------------------------- ### Refund Payment Request Sample (JavaScript) Source: https://app.goldiix.com/gateway/doc/index This JavaScript code snippet illustrates how to request a payment refund. It uses the `fetch` API to send a POST request to the refund endpoint, including the authorization token in the headers. Replace placeholder values with your actual access token and payment code. ```javascript async function refundPayment(paymentCode, accessToken) { const url = `https://app.goldiix.com/api/v2/payment/refund/${paymentCode}`; const response = await fetch(url, { method: 'POST', headers: { 'Authorization': `Bearer ${accessToken}`, 'Content-Type': 'application/json', 'Accept': 'application/json' } }); if (!response.ok) { const errorData = await response.json(); throw new Error(`Refund failed: ${response.status} - ${errorData.message}`); } return await response.json(); } // Example usage: // const paymentCode = 'YOUR_PAYMENT_CODE'; // const accessToken = 'YOUR_ACCESS_TOKEN'; // refundPayment(paymentCode, accessToken) // .then(data => console.log('Refund successful:', data)) // .catch(error => console.error('Refund error:', error)); ``` -------------------------------- ### Payment Creation Response Sample (200 OK) Source: https://app.goldiix.com/gateway/doc/index This JSON object represents a successful payment creation response. It includes details about the created payment, such as its code, status, and amounts. This response is returned when the payment is processed successfully. ```json { "payment_code": "ABCDE", "payment_method": "credit_card", "payment_status": "approved", "payment_amount": 500, "sale_amount": 500, "shipping_amount": 0, "installments": 1, "installment_amount": 500, "card": { "card_rejected": false, "card_message": "string", "card_flag": "visa", "card_first_six_digits": "503143", "card_last_four_digits": "6351", "card_token": "8358c10af5464f7e3ba1aee829b0079f0aceaabc099b112d39e8b7e001325a10", "card_soft_descriptor": "john doe" } } ``` -------------------------------- ### Refund Payment Request Sample (Python) Source: https://app.goldiix.com/gateway/doc/index This Python code snippet shows how to perform a payment refund using the `requests` library. It sends a POST request to the refund API endpoint with the necessary authorization headers. Remember to substitute placeholder values with your specific payment code and access token. ```python import requests def refund_payment(payment_code, access_token): url = f"https://app.goldiix.com/api/v2/payment/refund/{payment_code}" headers = { "Authorization": f"Bearer {access_token}", "Content-Type": "application/json", "Accept": "application/json" } try: response = requests.post(url, headers=headers) response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx) return response.json() except requests.exceptions.RequestException as e: print(f"Error refunding payment: {e}") return None # Example usage: # payment_code = 'YOUR_PAYMENT_CODE' # access_token = 'YOUR_ACCESS_TOKEN' # result = refund_payment(payment_code, access_token) # if result: # print('Refund successful:', result) ``` -------------------------------- ### POST /api/v2/payment Source: https://app.goldiix.com/gateway/doc/index Creates a payment request based on provided details such as purchase amount, currency, payment method, and buyer information. The response includes a unique payment ID for tracking. ```APIDOC ## POST /api/v2/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/v2/payment ### Parameters #### Headers - **Authorization** (string) - Required - Bearer token obtained from the authentication endpoint. - **Content-Type** (string) - Required - application/json - **Accept** (string) - Required - application/json #### Request Body (The request body schema is not detailed in the provided text, but would typically include fields like:) - **amount** (float) - Required - The total amount of the payment. - **currency** (string) - Required - The currency of the payment (e.g., 'BRL'). - **payment_method** (string) - Required - The chosen payment method (e.g., 'credit_card', 'boleto'). - **customer** (object) - Required - Details about the buyer. - **name** (string) - Required - Buyer's full name. - **email** (string) - Required - Buyer's email address. - **document** (string) - Required - Buyer's identification number (CPF/CNPJ). - **phone** (string) - Optional - Buyer's phone number. - **card** (object) - Required if payment_method is 'credit_card' - Card details for the transaction. - **card_number** (string) - Required - Full card number. - **card_expiration_date** (string) - Required - Card expiration date (MM/YY). - **card_cvv** (string) - Required - Card security code. - **card_holder_name** (string) - Required - Name of the cardholder. ### Response #### Success Response (200 or 201) (The success response details are not explicitly provided, but it should at least include:) - **payment_code** (string) - The unique code generated for the payment. #### Response Example (Hypothetical example based on common practices:) ```json { "payment_code": "NEWPAYMENTCODE123", "status": "pending", "message": "Payment request created successfully." } ``` #### Error Response (Details for error responses are not provided, but common errors might include:) - **400 Bad Request**: Invalid or missing request body parameters. - **401 Unauthorized**: Invalid or expired access token. - **402 Payment Required**: Payment could not be processed (e.g., insufficient funds, declined card). - **500 Internal Server Error**: An unexpected error occurred on the server. ``` -------------------------------- ### Generate Access Token - PHP Source: https://app.goldiix.com/gateway/doc/index Generates an access token using Basic Authentication by combining public and secret keys. The token is valid for 1 hour and must be included in the Authorization header for subsequent requests. Ensure your server's IP is registered. ```php $client = new \\GuzzleHttp\\Client(); $url = 'checkout.goldiix.com/api/v2/auth/generate_token'; $publicKey = 'sua_public_key'; $privateKey = 'sua_secret_key'; $auth = 'Basic ' . base64_encode($publicKey . ':' . $privateKey); $response = $client->post($url, [ 'headers' => [ 'Authorization' => $auth, 'Content-Type' => 'application/json', 'Accept' => 'application/json', ], ]); $body = json_decode((string) $response->getBody()); $accessToken = $body->access_token; print_r($body); ``` -------------------------------- ### POST /api/v2/payment Source: https://app.goldiix.com/gateway/doc/index Initiates a new payment transaction. Supports various payment methods like credit card, billet, and Pix, along with detailed item, customer, and shipping information. ```APIDOC ## POST /api/v2/payment ### Description Initiates a new payment transaction. Supports various payment methods like credit card, billet, and Pix, along with detailed item, customer, and shipping information. ### Method POST ### Endpoint https://app.goldiix.com/api/v2/payment ### Parameters #### Request Body - **external_code** (string) - Required - 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) - Required - **customer** (object) - Required - **card** (object or null) - Optional - Campo obrigatório quando o campo `payment_method` for `credit_card`. - **pix** (object or null) - Optional - Campo obrigatório quando o campo `payment_method` for `pix`. - **billet** (object or null) - Optional - Campo obrigatório quando o campo `payment_method` for `billet`. - **shipping** (object or null) - Optional - **extra** (object or null) - Optional ### Request Example ```json { "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) - Code of the created payment. - **payment_method** (string) - The payment method used. - **payment_status** (string) - The current status of the payment. - **payment_amount** (integer) - The total payment amount in cents. - **sale_amount** (integer) - The total sale amount in cents. - **shipping_amount** (integer) - The shipping amount in cents. - **installments** (integer) - The number of installments. - **installment_amount** (integer) - The amount of each installment in cents. - **card** (object) - Card details if payment method is credit_card. #### Response Example ```json { "payment_code": "ABCDE", "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": "john doe" } } ``` ``` -------------------------------- ### POST /api/v2/auth/generate_token Source: https://app.goldiix.com/gateway/doc/index Generates an access token using Basic Authentication with your public and secret keys. The token is required for subsequent API requests and is valid for 1 hour. ```APIDOC ## POST /api/v2/auth/generate_token ### Description Gera um token no formato Basic Auth, combinando public_key e secret_key com ":", codificando em Base64 e adicionando o prefixo "Basic ". O token gerado deve ser utilizado no header Authorization de todas as requisições subsequentes. O token possui validade de 3600 segundos (1 hora). ### Method POST ### Endpoint /api/v2/auth/generate_token ### Parameters #### Headers - **Authorization** (string) - Required - Basic Auth token (Public Key + Secret Key encoded in Base64 with "Basic " prefix). - **Content-Type** (string) - Required - application/json - **Accept** (string) - Required - application/json ### Request Example ```php $client = new \GuzzleHttp\Client(); $url = 'checkout.goldiix.com/api/v2/auth/generate_token'; $publicKey = 'sua_public_key'; $privateKey = 'sua_secret_key'; $auth = 'Basic ' . base64_encode($publicKey . ':' . $privateKey); $response = $client->post($url, [ 'headers' => [ 'Authorization' => $auth, 'Content-Type' => 'application/json', 'Accept' => 'application/json', ], ]); $body = json_decode((string) $response->getBody()); $accessToken = $body->access_token; print_r($body); ``` ### Response #### Success Response (200) - **access_token** (string) - The generated Bearer token. - **token_type** (string) - Type of the token, usually "Bearer". - **expires_in** (integer) - Token validity in seconds (3600). #### Response Example ```json { "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdG9yZV9jb2RlIjoiYmxwc3RyZ3J4ZyIsImV4cGlyYXRpb24iOjE3NjI0NjI5NDh9.ygSdsBKzh5bv1mVLC7+MKTdmGrFLiYVZF/GoCnJ/jEA=", "token_type": "Bearer", "expires_in": 3600 } ``` #### Error Response (401) - **message** (string) - Indicates invalid credentials. ``` -------------------------------- ### POST /api/v2/payment/refund/{paymentCode} Source: https://app.goldiix.com/gateway/doc/index Processes the refund (chargeback) of a previously made payment. It receives the `paymentCode` of the original payment and performs a full refund. Used in cases of purchase cancellation, reimbursement, or disputes. A postback will be sent with the new `refunded` status once the refund is effective. ```APIDOC ## POST /api/v2/payment/refund/{paymentCode} ### Description Processes the refund (chargeback) of a previously made payment. It receives the `paymentCode` of the original payment and performs a full refund. Used in cases of purchase cancellation, reimbursement, or disputes. A postback will be sent with the new `refunded` status once the refund is effective. ### Method POST ### Endpoint https://app.goldiix.com/api/v2/payment/refund/{paymentCode} ### Parameters #### Path Parameters - **paymentCode** (string) - Required - The code of the payment to be refunded. #### Response #### Success Response (200) - **message** (string) - Confirmation message of the refund request. #### Response Example ```json { "message": "Cancelamento solicitado" } ``` #### Error Responses - **404** - Payment not found. - **409** - Refund not allowed. ``` -------------------------------- ### Refund Payment Request (PHP) Source: https://app.goldiix.com/gateway/doc/index This PHP code snippet demonstrates how to initiate a payment refund using the Guzzle HTTP client. It sends a POST request to the refund endpoint with the necessary authorization headers. Ensure you replace placeholder values with actual credentials and payment codes. ```php $client = new \GuzzleHttp\Client(); $url = 'checkout.goldiix.com/api/v2/payment/refund/PPPPPPPPPPPPP'; $accessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdG9yZV9jb2RlIjoiYmxwc3RyZ3J4ZyIsImV4cGlyYXRpb24iOjE3NjI0NjI5NDh9.ygSdsBKzh5bv1mVLC7+MKTdmGrFLiYVZF/GoCnJ/jEA='; $response = $client->post($url, [ 'headers' => [ 'Authorization' => 'Bearer ' . $accessToken, 'Content-Type' => 'application/json', 'Accept' => 'application/json', ], ]); print_r(json_decode((string) $response->getBody())); ``` -------------------------------- ### Fetch Payment Details - PHP Source: https://app.goldiix.com/gateway/doc/index Retrieves the details of a specific payment using its unique code. This endpoint requires an access token in the Authorization header. The response includes payment status, amount, and associated card details. ```php $client = new \\GuzzleHttp\\Client(); $url = 'checkout.goldiix.com/api/v2/payment/AAAAAAAAAA'; $accessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdG9yZV9jb2RlIjoiYmxwc3RyZ3J4ZyIsImV4cGlyYXRpb24iOjE3NjI0NjI5NDh9.ygSdsBKzh5bv1mVLC7+MKTdmGrFLiYVZF/GoCnJ/jEA='; $response = $client->get($url, [ 'headers' => [ 'Authorization' => 'Bearer ' . $accessToken, 'Content-Type' => 'application/json', 'Accept' => 'application/json', ], ]); $body = $response->getBody(); print_r(json_decode((string) $body)); ``` -------------------------------- ### Create Payment Request Payload (JSON) Source: https://app.goldiix.com/gateway/doc/index This JSON object represents the structure of a payment creation request. It includes details about the transaction, customer, payment method, and associated items. Ensure all required fields are populated according to the schema. ```json { "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": { } } } ``` -------------------------------- ### Refund Payment Success Response (JSON) Source: https://app.goldiix.com/gateway/doc/index This JSON object represents a successful response after initiating a payment refund. It typically contains a confirmation message indicating that the cancellation has been requested. This response is returned when the refund request is valid and processed. ```json { "message": "Cancelamento solicitado" } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.