Make your first payment

This page will help you get started with TrueGate. You'll be up and running in a jiffy!

Start a transaction on your backend, pass its transactionId to the frontend SDK, and receive the payment result through a webhook.

Integrating with an AI assistant?

Add https://truegate.readme.io/mcp as a remote MCP server in your assistant using Streamable HTTP, with no authentication for reading API documentation. Your assistant can look up endpoints and inspect their request and response schemas while you follow this guide.

See Connect your AI assistant via MCP for setup details, example prompts, and available documentation.

1. Start the transaction on your backend

Choose the endpoint for your payment flow:

Send the required parameters described in the endpoint documentation and sign the request using your project secret. See Signing requests.

Save the returned transactionId with your order and pass it to your frontend, together with requiredFields when that optional array is present. Each entry contains a field name and its type (string or number). Keep your project secret on the backend.

2. Initialize the SDK on your frontend

Install and configure the Truegate SDK.

Pass the transactionId received from your backend into the SDK configuration, initialize the SDK, and display the payment methods. The SDK handles payment details and any required customer authentication.

For card payments, collect any additional customer information listed in requiredFields before submission. For example, a payment processor may require phone and zipcode. Your integration supplies these values through the card submit method's userDetails map; the SDK does not collect these fields automatically. See Additional customer fields.

See the SDK integration instructions and examples.

You can also find integration examples in the Truegate SDK examples repository.

3. Receive the webhook

Provide Truegate with your backend webhook URL during project setup.

When a payment or subscription event occurs, Truegate sends an HTTP POST to this URL. Match the event to your order using transactionId, check its type and status or subscription state, and update your records. Handle repeated deliveries without processing the same event twice.

Use the webhook to confirm the outcome on your backend, even if the customer closes the payment page.

See Webhook events and payload examples.

4. Handle API errors

Check the HTTP status before reading a success response. The response table on each endpoint lists the applicable errors.

HTTP statusMeaning
400Invalid parameters or an operation that is not allowed for the current data. Correct the request before sending it again.
401Invalid request signature. Check the project secret, field order, and signed values.
403The source subscription or target plan is outside the signed project on endpoints that return this status.
404A required resource was not found or is unavailable within the signed project.
409A subscription state conflict, such as resuming a subscription that is not paused. Read its current state before deciding what to do next.
500The server could not complete the request. Check the existing transaction or subscription result before retrying a payment operation.

HTTP errors normally contain statusCode, timestamp, path, and message. An optional innerError can contain additional details with no fixed structure. For example, a pause date in the past can return:

{
  "statusCode": 400,
  "timestamp": "2026-09-30T12:00:00.000Z",
  "path": "/api/v1/subscriptions/pause",
  "message": "pauseUntilDate must be greater than now"
}

Validation errors can also use a different HTTP 400 body: statusCode, message, and an errors array. Each issue has code, path, and message, and may contain further details such as expected or received. A path contains field names and, for arrays, numeric positions. Validation of the signed request uses the normal HTTP-error body, whose message can contain serialized validation issues. Handle both forms.

An unhandled HTTP 500 error can contain only statusCode and message, without timestamp or path.

An HTTP 201 response can still contain an unsuccessful operation status. Follow the endpoint's response contract and confirm payment outcomes through webhooks.


Did this page help you?