Purchase
Use this endpoint to create and process a Pay-In or Pay-Out transaction.
POST /api/transactions/authorize
Authorization: Bearer <access_token>
Content-Type: application/json
This endpoint creates a transaction and starts processing it. It supports Pay-In purchases and Pay-Out withdrawals. Select the operation with transaction_type and the client-facing flow with payment_method.type.
Required request fields
| Field | Description |
|---|---|
terminal_id | Terminal whose payment configuration will process the transaction. See Entities. |
reference | Merchant order reference, unique per terminal; maximum 80 characters. |
description | Human-readable description; maximum 100 characters. |
currency | ISO 4217 three-letter currency code. |
amount | Integer amount in the currency’s minor unit; minimum 100. |
payment_method, customer, and browser_info are conditionally required by the selected payment flow. Direct card integrations should send all three.
Common optional fields
| Field | Description |
|---|---|
transaction_type | PURCHASE (default) or WITHDRAWAL, subject to terminal support. |
payment_method | Client-facing payment flow in type and its accepted string fields in data. |
payment_provider_account_id | Optional account selector that pins the transaction to one eligible payment provider account connected to the terminal. Always include it for canonical Pay-In and Pay-Out flows for now, because other routing modes do not yet support canonical inputs. |
customer | Customer identity, contact, address, and customer_ip. |
browser_info | Browser data used by 3-D Secure and risk processing. If supplied, all browser fields are required. |
metadata | Merchant-defined string key/value data returned with the transaction. |
attributes | Merchant-defined structured attributes supported by the transaction flow. |
options | Additional structured options supported by the selected flow. |
parent_transaction_id | Related transaction ID when the operation requires one. |
return_url | Destination after a successful customer interaction. |
error_url | Destination after a failed customer interaction. |
cancel_url | Destination after a canceled customer interaction. |
Do not place protocol fields in metadata. In particular, the original customer IP belongs in customer.customer_ip.
Select a payment provider account
Always include payment_provider_account_id at the top level for now to use direct routing. The field remains optional in the API contract, but other routing modes do not yet support canonical inputs.
To pin the transaction to a specific eligible account, send its identifier once at the top level:
{
"terminal_id": "your-terminal-id",
"payment_provider_account_id": "your-payment-provider-account-id",
"transaction_type": "PURCHASE",
"payment_method": {
"type": "BankDeposit",
"data": {
"id_number": "AB123456",
"id_type": "NATIONAL_ID",
"phone_number": "+359881234567"
}
}
}
The selected account must be active, connected to terminal_id, and support the requested flow and transaction type. An invalid or incompatible identifier causes request validation to fail; Morefin does not silently route the request to a different account.
payment_provider_account_id controls routing only. For the new Pay-In and Pay-Out flows, never place it inside payment_method.data, and do not add integration-specific fields to the flow data.
The top-level field also applies to legacy payment_method.type: apm requests and is the preferred account-selector location. Existing apm clients that place the account identifier inside payment_method.data may continue using that compatibility contract during migration. New Pay-In and Pay-Out flows must use the top-level field.
Browser information
When browser_info is present, include:
accept_header, color_depth, language, java_enabled, screen_height, screen_width, time_zone_offset, and user_agent.
Example card purchase
{
"terminal_id": "your-terminal-id",
"payment_provider_account_id": "your-payment-provider-account-id",
"reference": "merchant-order-10001",
"description": "Order 10001",
"currency": "EUR",
"amount": 1050,
"transaction_type": "PURCHASE",
"payment_method": {
"type": "CardDeposit",
"data": {
"encrypted_card_number": "<encrypted-value>",
"encrypted_cvv": "<encrypted-value>",
"encrypted_expiration_month": "<encrypted-value>",
"encrypted_expiration_year": "<encrypted-value>",
"cardholder_name": "Jane Doe"
}
},
"customer": {
"id": "customer-123",
"first_name": "Jane",
"last_name": "Doe",
"email": "jane@example.com",
"country": "DE",
"customer_ip": "203.0.113.10"
},
"browser_info": {
"accept_header": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"color_depth": 24,
"language": "en-US",
"java_enabled": false,
"screen_height": 1080,
"screen_width": 1920,
"time_zone_offset": -60,
"user_agent": "Mozilla/5.0 ..."
},
"return_url": "https://merchant.example/payments/return",
"error_url": "https://merchant.example/payments/error",
"cancel_url": "https://merchant.example/payments/cancel",
"metadata": {
"merchant_account": "store-1"
}
}
See Pay-In flows for accepted flow inputs and Card data for encryption requirements.
Handling the response
An HTTP 200 means the API accepted and processed the request far enough to return transaction instructions. It does not by itself mean the payment was approved.
Inspect the response for one of these branches:
| Branch | Integration action |
|---|---|
result | Read result.status, approved, pending, errors, processing_code, and response_message. |
redirect | Send the customer’s browser to redirect.url; retain transaction_id. |
form_submit | POST every returned form_submit.data field to form_submit.url, using the browser as required by the flow. |
action | Perform the client-side action described by action.type using the returned token or payment data. |
Do not assume a fixed priority between these branches or infer success from the HTTP status. Treat fields outside the returned branch as absent.
Example direct result:
{
"result": {
"id": "TBHNm227QTyOTGQEcUCe",
"terminal_id": "your-terminal-id",
"reference": "merchant-order-10001",
"currency": "EUR",
"amount": 1050,
"transaction_type": "PURCHASE",
"status": "APPROVED",
"approved": true,
"pending": false,
"processing_code": "0000",
"response_message": "approved or completed successfully"
}
}
Example redirect:
{
"redirect": {
"transaction_id": "TBHNm227QTyOTGQEcUCe",
"session_id": "TBHNm227QTyOTGQEcUCe",
"url": "https://payments.example/authentication"
}
}
Example form submission:
{
"form_submit": {
"transaction_id": "TBHNm227QTyOTGQEcUCe",
"session_id": "TBHNm227QTyOTGQEcUCe",
"url": "https://uat-api.morefin.com/threeds/threeds_method",
"data": {
"field_name_from_response": "field value from response"
}
}
}
The names and number of form_submit.data fields are dynamic. Submit the response as received; do not hard-code flow-specific response fields.
Errors
Handle both transport errors and transaction outcomes:
400— malformed request or request validation failure.401— missing, invalid, or expired access token.403— authenticated client is not allowed to use the operation or terminal.422— the request cannot be processed in its current state.5xx— temporary server-side failure.- HTTP
200with a declined, invalid, pending, or error transaction — a payment outcome, not a successful payment.
Use the structured error information returned by the API for diagnostics. Do not parse human-readable messages to decide the transaction outcome.
Status and lookup endpoints
| Method | Path | Purpose |
|---|---|---|
GET | /api/transactions/{id}/status | Get the current status for a transaction session. |
GET | /api/transactions/{id} | Get transaction details by ID. |
GET | /api/transactions?transactionIds=<id> | Get transactions by one or more repeated transaction ID parameters. |
GET | /api/transactions/search | Search transactions using supported criteria. |
A PENDING response is not final. Continue the customer action where applicable, then obtain the outcome through status lookup or a webhook. See Transaction Statuses.