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.
| Setting | Value |
|---|---|
| Base URL | https://pay.staging.glin.com.br |
| MercadoPago Test Public Key | TEST-bd0c8ceb-c538-488b-8792-0cc82d4e1fe9 |
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.
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.
| Brand | Card Number | CVV | Expiry |
|---|---|---|---|
| Visa | 4509 9535 6623 3704 | Any 3 digits | Any future date |
| Mastercard | 5031 4332 1540 6351 | Any 3 digits | Any 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 Name | Result | Description |
|---|---|---|
| APRO | Payment approved | Use this cardholder name to simulate a successful payment. |
| OTHE | Payment rejected | Use this cardholder name to simulate a declined payment. |
| CONT | Payment pending | Use this cardholder name to simulate a payment in pending validation. |
| CALL | Call to authorize | Use this cardholder name to simulate a payment that requires phone authorization. |
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.
Example test CPF: 123.456.789-09 (or 12345678909 without formatting)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.