### POST /api/pg/{slug}/init Source: https://mockgateway.com/docs/gateways/init-and-verify-endpoints Starts a payment. The fields accepted come from the gateway's schema; every gateway needs an amount and a currency. ```APIDOC ## POST /api/pg/{slug}/init ### Description Starts a payment. The fields accepted come from the gateway's schema; every gateway needs an amount and a currency. ### Method POST ### Endpoint /api/pg/{slug}/init ### Parameters #### Path Parameters - **slug** (string) - Required - The gateway's slug. #### Request Body - **amount** (number) - Required - The payment amount. Some templates require a whole number. - **currency** (string) - Required - The currency code (e.g., USD). ### Request Example ``` POST /api/pg/{slug}/init Authorization: Bearer sk_test_XXXXXXXX Content-Type: application/json { "amount": 4999, "currency": "USD" } ``` ### Response #### Success Response (200) - **payment_url** (string) - URL to send the customer to. - **payment_id** (string) - The payment identifier. #### Response Example ``` { "payment_url": "https://mockgateway.com/pg/pay/9f8c2a1e-...", "payment_id": "9f8c2a1e-..." } ``` ### Error Handling - **401** - Invalid or missing Bearer token. - **422** - Validation failed (e.g., missing amount/currency, amount not numeric). - **400** - Gateway setup incomplete. - **429** - Rate limit exceeded (120/minute). ``` -------------------------------- ### Verify a payment with curl Source: https://mockgateway.com/docs/getting-started/quickstart Checks payment status by sending a GET request to the verify endpoint with the payment ID and Bearer token. ```shell curl https://mockgateway.com/api/pg/YOUR-SLUG/verify/PAYMENT-ID \ -H "Authorization: Bearer sk_test_XXXXXXXX" ``` -------------------------------- ### GET /api/pg/{slug}/verify/{paymentId} Source: https://mockgateway.com/docs/gateways/init-and-verify-endpoints Reads a payment's state. The identifier can be the internal one or the one advertised in the init reply. ```APIDOC ## GET /api/pg/{slug}/verify/{paymentId} ### Description Reads a payment's state. The identifier can be the internal one or the one advertised in the init reply. ### Method GET ### Endpoint /api/pg/{slug}/verify/{paymentId} ### Parameters #### Path Parameters - **slug** (string) - Required - The gateway's slug. - **paymentId** (string) - Required - The payment identifier. ### Request Example ``` GET /api/pg/{slug}/verify/{paymentId} Authorization: Bearer sk_test_XXXXXXXX ``` ### Response #### Success Response (200) - **payment_id** (string) - The payment identifier. - **status** (string) - The payment status (e.g., pending). - **amount** (string) - The payment amount as a string. - **currency** (string) - The currency code. - **created_at** (string) - The creation timestamp. #### Response Example ``` { "payment_id": "9f8c2a1e-...", "status": "pending", "amount": "4999.00", "currency": "USD", "created_at": "2026-08-08T09:12:44.000000Z" } ``` ### Error Handling - **401** - Invalid or missing Bearer token. - **404** - No payment with that id. ``` -------------------------------- ### Init payment request Source: https://mockgateway.com/docs/gateways/init-and-verify-endpoints Starts a payment by sending an amount and currency to the init endpoint. Some templates require the amount as a whole number and reject decimals; the Stripe template is one of them. ```http POST /api/pg/{slug}/init Authorization: Bearer sk_test_XXXXXXXX Content-Type: application/json { "amount": 4999, "currency": "USD" } ``` -------------------------------- ### Run the ready-made curl command for the payment step Source: https://mockgateway.com/docs/getting-started/the-setup-wizard The wizard provides a curl command pre-filled with your gateway's slug and API key. Copy it into a terminal to make your first API call. The key is sensitive; anyone with it can create payments on your gateway. ```bash curl ``` -------------------------------- ### Initialize a payment with curl Source: https://mockgateway.com/docs/getting-started/quickstart Sends a POST request to the /init endpoint with Bearer authorization, specifying an amount and currency. Requires YOUR-SLUG and sk_test_ API key. ```shell curl -X POST https://mockgateway.com/api/pg/YOUR-SLUG/init \ -H "Authorization: Bearer sk_test_XXXXXXXX" \ -H "Content-Type: application/json" \ -d '{"amount": 4999, "currency": "USD"}' ``` -------------------------------- ### Default init response body Source: https://mockgateway.com/docs/gateways/init-and-verify-endpoints Default response body from the init endpoint when no response template is set. Contains the payment URL and payment ID. ```json { "payment_url": "https://mockgateway.com/pg/pay/9f8c2a1e-...", "payment_id": "9f8c2a1e-..." } ``` -------------------------------- ### POST /api/pg/{slug}/oauth2/token Source: https://mockgateway.com/docs/gateways/init-and-verify-endpoints Exchanges client credentials for a Bearer token. The token is accepted on every call, whatever the configured scheme. ```APIDOC ## POST /api/pg/{slug}/oauth2/token ### Description Exchanges client credentials for a Bearer token. The token is accepted on every call, whatever the configured scheme. ### Method POST ### Endpoint /api/pg/{slug}/oauth2/token ### Parameters #### Path Parameters - **slug** (string) - Required - The gateway's slug. #### Request Body - **grant_type** (string) - Required - Must be `client_credentials`. Any other value returns a 400 error. ### Request Example ``` POST /api/pg/{slug}/oauth2/token Authorization: Basic Content-Type: application/x-www-form-urlencoded grant_type=client_credentials ``` ### Response #### Success Response (200) - **access_token** (string) - The Bearer token. #### Error Response (400) - **error** (string) - `unsupported_grant_type` ### Error Handling - **400** - `{"error":"unsupported_grant_type"}` if grant_type is not `client_credentials`. ``` -------------------------------- ### Default verify response body Source: https://mockgateway.com/docs/gateways/init-and-verify-endpoints Default response body from the verify endpoint when no verify template is set. Shows the payment's current state. ```json { "payment_id": "9f8c2a1e-...", "status": "pending", "amount": "4999.00", "currency": "USD", "created_at": "2026-08-08T09:12:44.000000Z" } ``` -------------------------------- ### Verify payment request Source: https://mockgateway.com/docs/gateways/init-and-verify-endpoints Reads a payment's state using its payment ID. The identifier can be the internal one or the one advertised in the init reply. ```http GET /api/pg/{slug}/verify/{paymentId} Authorization: Bearer sk_test_XXXXXXXX ``` -------------------------------- ### OAuth2 token exchange request Source: https://mockgateway.com/docs/gateways/init-and-verify-endpoints Exchanges client credentials for a Bearer token using the OAuth2 client_credentials grant. Any other grant_type returns 400 with {"error":"unsupported_grant_type"}. ```http POST /api/pg/{slug}/oauth2/token Authorization: Basic Content-Type: application/x-www-form-urlencoded grant_type=client_credentials ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.