These scenarios run against the sandbox (
https://apistagepc.grogov.us). Replace pc_<your-sandbox-key> and <your-portal-id> with your sandbox credentials. The card numbers are test fixtures listed in Test data. Your portal must support these simulated scenarios. See Sandbox access.Authorization: ApiKey pc_…. You do not need to obtain an access token. Replace $(uuidgen) with any unique string if your shell does not have uuidgen. For independent tests, use a fresh payment-level referenceId as described in Test data to avoid restrictions caused by earlier attempts.
1. Successful sale
Create a payment with the Visa test card and the sandboxportalId provided by GroGov. Returns status: "succeeded" immediately.
cURL
2. Refund
Refund the payment from scenario 1 in full, including the service fee. Replace$PAYMENT_ID with its id. Returns reversalType ("void" while the batch is open, "refund" after it settles) and remainingRefundableAmountCents: 0.
cURL
capture: "auth" returns 501 CAPTURE_NOT_SUPPORTED.
3. Declined charge
Use the general-decline test card4111511111111112. The request returns 402 with code PAYMENT_DECLINED. When the attempt was recorded, details.id holds the failed payment’s ID; GET /payments/{id} returns it with status failed.
cURL
4. Unknown charge outcome
Use the test card4200400000000077 to simulate an unreadable payment gateway response. The request returns 504 with code PAYMENT_TIMEOUT. When you receive this error the outcome is unknown. List recent payments (GET /api/partner/v1/payments with portalId and a from/to window) to check before retrying. See Errors for retry guidance.
cURL
5. Portal without gateway
Charging a portal with no payment gateway configured returns503 with code GATEWAY_NOT_CONFIGURED. Contact GroGov support to request a sandbox portal configured for this scenario.
cURL
6. Unauthorized portal
Use aportalId your API account cannot access. This example uses a placeholder UUID and returns 403 with code PORTAL_ACCESS_DENIED; unknown portals return the same code, so the response does not reveal whether a portal exists.
cURL
7. Idempotent replay
Send the same request body andIdempotency-Key twice using your sandbox portalId. The second response is identical to the first and carries the Idempotent-Replayed: true response header. Replace my-idempotency-key-001 with any fixed string; the key must be the same in both calls.
cURL
8. Partial refund
Refund part of a payment’s principal by itsid (line items cannot be refunded individually). Replace $PAYMENT_ID with the payment’s id. The service fee is not refunded on a partial refund.
cURL
API Reference
Switch to the API Reference tab above to browse every endpoint, inspect request and response schemas, and try requests directly in the interactive playground.