Testing Guide

Test your integration end-to-end using the Glin staging environment, test cards, and simulated payment outcomes.

Staging Environment

All development and testing should use the Glin staging environment. This environment processes test payments through MercadoPago's sandbox -- no real money is charged.

SettingValue
Base URLhttps://pay.staging.glin.com.br
MercadoPago Test Public KeyTEST-bd0c8ceb-c538-488b-8792-0cc82d4e1fe9
You can generate staging API keys from your merchant dashboard at pay.staging.glin.com.br. Staging and production keys are separate.

SDK Staging Configuration

When using the Checkout SDK in staging, use a public key with the pk_stag_ prefix. The SDK automatically routes to the staging API.

typescript
GlinCheckout.mount('#checkout', {
  publicKey: 'pk_stag_YOUR_STAGING_PUBLIC_KEY',  // pk_stag_ prefix auto-routes to staging
  remittanceId: 'REMITTANCE_ID',

  onPaymentReady: async ({ remittanceId, paymentData }) => {
    const res = await fetch('/api/confirm-payment', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ remittanceId, paymentData }),
    });
    return res.json();
  },

  onSuccess: (data) => {
    console.log('Payment confirmed:', data.orderId);
  },
  onError: (error) => {
    console.error('Payment failed:', error.message);
  },
});

Test Credit Cards

Use these MercadoPago test card numbers in the staging environment. Any 3-digit CVV and any future expiration date will work.

BrandCard NumberCVVExpiry
Visa4509 9535 6623 3704Any 3 digitsAny future date
Mastercard5031 4332 1540 6351Any 3 digitsAny future date

Simulating Payment Outcomes

The cardholder name controls whether the test payment is approved or rejected. Use these special names in the cardholder name field.

Cardholder NameResultDescription
APROPayment approvedUse this cardholder name to simulate a successful payment.
OTHEPayment rejectedUse this cardholder name to simulate a declined payment.
CONTPayment pendingUse this cardholder name to simulate a payment in pending validation.
CALLCall to authorizeUse this cardholder name to simulate a payment that requires phone authorization.
The cardholder name must match exactly (e.g. APRO, not Apro). MercadoPago uses this field to determine the simulated outcome.

Simulando Estados de Pagamento

O SDK exibe diferentes estados visuais conforme o resultado do pagamento. Utilize os nomes de titular abaixo para testar cada cenario no ambiente de staging.

Aprovado (Sucesso)

Use o nome do titular APRO. O SDK exibirá o estado de validacao pendente ("Aguarde um instante") e em seguida o widget de sucesso. Se successRedirectUrl estiver configurado, o redirecionamento ocorre apos 2 segundos.

Rejeitado (Recuperacao de Erro)

Use o nome do titular OTHE. O SDK restaurará o formulario com todos os campos preenchidos e exibirá a mensagem de erro inline. O cliente pode corrigir os dados e tentar novamente sem perder as informacoes já digitadas.

Validacao Pendente

Use o nome do titular CONT. O SDK exibirá o estado de polling com um icone de relogio e a mensagem "Aguarde um instante" enquanto aguarda a resposta do banco.

PIX (QR Code)

Selecione PIX como metodo de pagamento para visualizar o fluxo completo: QR code, codigo copia-e-cola e polling automatico ate a confirmacao. No ambiente de staging, o pagamento PIX e confirmado automaticamente.

Test CPFs

In the staging environment, any valid CPF format is accepted. You do not need to use a real CPF for testing.

text
Example test CPF: 123.456.789-09 (or 12345678909 without formatting)
The SDK validates CPF format (11 digits with valid check digits) but does not verify ownership in staging. In production, CPF validation is handled by the payment provider.

Testing Checklist

Successful Card Payment

Use a test Visa card with cardholder name APRO. Verify the onSuccess callback fires and your webhook receives the confirmation.

Rejected Card Payment

Use a test card with cardholder name OTHE. Verify the SDK displays an appropriate error message and the onError callback fires.

Card Retry On Same Remittance

Submit one or more rejected card attempts, then submit an approved card without creating a new remittance. Verify the same checkout can recover and complete.

3D Secure Retry Path

Simulate a retryable card refusal and verify the next attempt can return a threeDSecure URL or a structured CANCELED response instead of a raw server error.

PIX Payment

Complete a PIX payment flow. Verify the QR code is displayed and the payment can be confirmed in staging.

Expired Remittance

Create a remittance with a past expiresAt date and verify the SDK shows an expiration message.