Skip to main content
Glama
zakblacki

Satim Payment Gateway Integration

by zakblacki

register_order

Initiate payment processing by registering a new order with the SATIM payment gateway. Specify order details, redirect URLs, and mandatory parameters to enable secure transactions via CIB/Edhahabia cards on the SATIM-ePAY platform.

Instructions

Register a new order with SATIM payment gateway

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
amountInDAYesOrder amount in Algerian Dinars (minimum 50 DA)
currencyNoCurrency code according to ISO 4217 (012 for DZD)012
descriptionNoOrder description
failUrlNoURL to redirect after failed payment
force_terminal_idYesTerminal ID assigned by bank (mandatory)
languageNoLanguage for the payment interface
orderNumberYesUnique order identifier in merchant's system
returnUrlYesURL to redirect after successful payment
udf1YesSATIM specific parameter (mandatory)
udf2NoAdditional parameter
udf3NoAdditional parameter
udf4NoAdditional parameter
udf5NoAdditional parameter

Implementation Reference

  • MCP CallToolRequest handler for the 'register_order' tool: checks if credentials are configured, prepares jsonParams and OrderRegistrationParams from input arguments, invokes SatimPaymentGateway.registerOrder, and returns the response as text content.
    case "register_order": if (!satimGateway) { throw new McpError(ErrorCode.InvalidRequest, "Credentials not configured. Use configure_credentials first."); } const jsonParams: any = { force_terminal_id: args.force_terminal_id as string, udf1: args.udf1 as string, }; // Add optional parameters only if they exist if (args.udf2) jsonParams.udf2 = args.udf2 as string; if (args.udf3) jsonParams.udf3 = args.udf3 as string; if (args.udf4) jsonParams.udf4 = args.udf4 as string; if (args.udf5) jsonParams.udf5 = args.udf5 as string; const registrationResponse = await satimGateway.registerOrder({ orderNumber: args.orderNumber as string, amount: SatimPaymentGateway.convertAmountToCentimes(args.amountInDA as number), currency: (args.currency as string) || "012", returnUrl: args.returnUrl as string, failUrl: args.failUrl as string, description: args.description as string, language: args.language as 'AR' | 'FR' | 'EN', jsonParams }); return { content: [ { type: "text", text: JSON.stringify(registrationResponse, null, 2) } ] };
  • Core handler logic in SatimPaymentGateway class: authenticates with SATIM credentials, builds query parameters from OrderRegistrationParams, performs HTTP GET to /register.do endpoint, returns the API response.
    async registerOrder(params: OrderRegistrationParams): Promise<OrderRegistrationResponse> { try { const queryParams = new URLSearchParams({ userName: this.credentials.userName, password: this.credentials.password, orderNumber: params.orderNumber, amount: params.amount.toString(), currency: params.currency, returnUrl: params.returnUrl, ...(params.failUrl && { failUrl: params.failUrl }), ...(params.description && { description: params.description }), ...(params.language && { language: params.language }), jsonParams: JSON.stringify(params.jsonParams) }); const response = await axios.get(`${this.baseUrl}/register.do?${queryParams}`); return response.data; } catch (error) { throw new Error(`Order registration failed: ${error}`); } }
  • TypeScript interface defining the internal parameters structure for order registration used by SatimPaymentGateway.registerOrder.
    interface OrderRegistrationParams { orderNumber: string; amount: number; // Amount in centimes (multiply by 100) currency: string; // ISO 4217 (012 for DZD) returnUrl: string; failUrl?: string; description?: string; language?: 'AR' | 'FR' | 'EN'; jsonParams: { force_terminal_id: string; // Mandatory udf1: string; // Mandatory udf2?: string; udf3?: string; udf4?: string; udf5?: string; }; }
  • MCP tool registration descriptor returned by ListToolsRequestHandler, specifying name, description, and detailed inputSchema with properties and required fields.
    { name: "register_order", description: "Register a new order with SATIM payment gateway", inputSchema: { type: "object", properties: { orderNumber: { type: "string", description: "Unique order identifier in merchant's system" }, amountInDA: { type: "number", description: "Order amount in Algerian Dinars (minimum 50 DA)" }, currency: { type: "string", description: "Currency code according to ISO 4217 (012 for DZD)", default: "012" }, returnUrl: { type: "string", description: "URL to redirect after successful payment" }, failUrl: { type: "string", description: "URL to redirect after failed payment" }, description: { type: "string", description: "Order description" }, language: { type: "string", enum: ["AR", "FR", "EN"], description: "Language for the payment interface" }, force_terminal_id: { type: "string", description: "Terminal ID assigned by bank (mandatory)" }, udf1: { type: "string", description: "SATIM specific parameter (mandatory)" }, udf2: { type: "string", description: "Additional parameter" }, udf3: { type: "string", description: "Additional parameter" }, udf4: { type: "string", description: "Additional parameter" }, udf5: { type: "string", description: "Additional parameter" } }, required: ["orderNumber", "amountInDA", "returnUrl", "force_terminal_id", "udf1"] } }, {
  • Static helper method used in register_order to convert amount from DA to centimes before API call.
    static convertAmountToCentimes(amountInDA: number): number { return Math.round(amountInDA * 100); }

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/zakblacki/Satim-Payment-Gateway-Integration'

If you have feedback or need assistance with the MCP directory API, please join our Discord server