Transaction → Create SNAP Transaction
AI-generatedOverview
The Midtrans SNAP node enables users to create and manage payment transactions using the Midtrans SNAP API. Specifically, the "Create SNAP Transaction" operation allows you to initiate a new transaction with detailed order information, customer data, payment options, and expiry settings.
This node is beneficial in e-commerce or payment processing workflows where you need to programmatically generate payment requests for customers. For example, an online store can use this node to create a payment transaction when a customer places an order, specifying the order ID, amount, items purchased, and preferred payment methods.
Properties
| Name | Meaning |
|---|---|
| Order ID | Unique identifier for the transaction/order (e.g., ORDER-12345). |
| Gross Amount | Total transaction amount in Indonesian Rupiah (IDR). |
| Credit Card Settings | Options related to credit card payments: whether 3D Secure is enabled, the payment channel (MIGS or CyberSource), and the acquiring bank name. |
| Custom Field 1 | Custom string field for additional data. |
| Custom Field 2 | Custom string field for additional data. |
| Custom Field 3 | Custom string field for additional data. |
| Customer Details | Information about the customer including first name, last name, email, phone number, billing address, and shipping address. Each address includes fields like name, email, phone, street address, city, postal code, and country code (default "IDN"). |
| Enabled Payments | List of payment methods to enable for this transaction. Options include Credit Card, CIMB Clicks, BCA KlikBCA, BCA KlikPay, BRI E-Pay, various Virtual Accounts (VA), GoPay, Indomaret, Danamon Online, Akulaku, ShopeePay, Kredivo, UOB EzPay, and other QRIS. |
| Expiry Settings | Defines transaction expiry with start time (format: YYYY-MM-DD HH:mm:ss +0700), duration (number), and unit (minutes, hours, days). |
| Finish URL | URL to which the user will be redirected after completing the payment. |
| Item Details | List of items included in the transaction. Each item can have brand, category, item ID, merchant name, name, price (in IDR), quantity, and URL. |
Output
The node outputs JSON data representing the response from the Midtrans SNAP API after creating the transaction. This typically includes:
- A transaction token or redirect URL that can be used to proceed with payment.
- Status and metadata about the created transaction.
- Any error messages if the creation failed.
The output does not include binary data.
Dependencies
- Requires an API key credential for authenticating with the Midtrans API.
- The node uses different base URLs depending on the environment (production or sandbox).
- Proper configuration of credentials with server key and environment selection is necessary.
Troubleshooting
- Invalid Credentials: If authentication fails, verify that the API key credential is correctly configured and has the required permissions.
- Missing Required Fields: Ensure mandatory fields like Order ID and Gross Amount are provided; otherwise, the API will reject the request.
- Incorrect Date Format: The expiry start time must follow the specified format (
YYYY-MM-DD HH:mm:ss +0700); incorrect formatting may cause errors. - Unsupported Payment Methods: Enabling payment methods not supported by your Midtrans account or region may result in errors.
- Network Issues: Connectivity problems to the Midtrans API endpoints can cause failures; check network access and firewall settings.
Links and References
- Midtrans SNAP API Documentation
- Midtrans Payment Methods
- Date and Time Formatting Guide (for reference on date format)