Payment Reference
This page lists the data structures and values used by payments. For setup, see the Payment Overview.
Payment callback data
When you configure Actionflow inputs under Payment result handling, you can bind data under Payment callback. Each event provides different data:
| Data | Type | On payment | On refund | On subscription status change | On recurring billing |
|---|---|---|---|---|---|
| Payment | payment_record record | Yes | Yes | ||
| Order paid amount | Decimal | Yes | |||
| Refund | refund record | Yes | |||
| Recurring payment | recurring_payment record | Yes | |||
| Previous status | Text | Yes | |||
| Previous cancel at period end | Boolean | Yes | |||
| Callback request body | JSON | Yes | Yes | Yes |
- Payment, Refund, and Recurring payment expose the record and its fields, but not its relations.
- Order paid amount is the total of all
SUCCESSFULpayment records for the order. - Callback request body is the raw notification from the gateway; its format depends on the gateway.
System table fields
payment_record
| Field | Description |
|---|---|
id | Payment record ID, used for refunds |
type | Payment channel type |
grand_total_value | Payment amount, in the same unit as the gateway’s payment action |
currency | Currency code |
status | See Payment status |
description | Transaction description |
order_id | Related order ID |
transaction_id | Gateway transaction ID |
out_trade_no | Order number Momen sends to the gateway |
account_id | Account that started the payment |
recurring_payment_id | Related subscription for subscription charges |
config_id | Payment configuration used |
refund
| Field | Description |
|---|---|
id | Refund record ID |
payment_record_id | Refunded payment record |
account_id | Account that started the refund |
status | REFUNDING, REFUNDED, or FAILED |
out_refund_no | Gateway refund ID |
amount | Refund amount |
recurring_payment
| Field | Description |
|---|---|
id | Subscription ID, used to cancel a subscription |
account_id | Subscribing account |
agreement_no | Gateway subscription ID |
first_order_id | Order used to start the subscription |
status | See Subscription status |
payment_type | Gateway of the subscription |
current_period_start | Start of the current billing period |
current_period_end | End of the current billing period |
cancel_at_period_end | When true, the subscription ends after the current period |
config_id | Payment configuration used |
All three tables also have creation and update timestamps.
Payment status
| Status | Description |
|---|---|
PENDING | The payment record exists and is waiting for the gateway notification |
SUCCESSFUL | Payment succeeded |
CANCELLED | Payment was canceled |
PARTIALLY_REFUNDED | Partially refunded |
REFUNDED | Fully refunded |
PENDING can only change to SUCCESSFUL or CANCELLED. SUCCESSFUL and PARTIALLY_REFUNDED can only change to PARTIALLY_REFUNDED or REFUNDED through refunds. Notifications that break these rules are ignored.
Only SUCCESSFUL or PARTIALLY_REFUNDED payments can be refunded. A refund record moves from REFUNDING to REFUNDED or FAILED.
Subscription status
| Status | Description |
|---|---|
INCOMPLETE | Subscription started; the first period is not paid yet |
INCOMPLETE_EXPIRED | The first period was not paid in time and the subscription expired |
TRIALING | In trial |
ACTIVE | Active |
PAST_DUE | A charge is overdue |
UNPAID | Unpaid |
CANCELED | Canceled |
CANCELED and INCOMPLETE_EXPIRED are final. A notification that only moves the billing period updates the record without running On subscription status change.
Amount units
| Gateway | Payment action amount | Example |
|---|---|---|
| Stripe | Smallest currency unit | Enter 1000 to charge USD 10.00 |
| Airwallex | Major currency unit | Enter 10 to charge USD 10.00 |
Refund amounts use the same unit as the original payment. A refund larger than the remaining refundable amount refunds the remaining amount.
Validation messages
The editor reports an error in these cases:
| Message | Fix |
|---|---|
| Action does not choose a payment config | Select a Payment configuration on the payment action |
| The payment config referenced by the action does not exist | The configuration was deleted; select another one |
| The payment config belongs to a different channel than the action | Select a configuration of the action’s gateway |
| Action does not choose a payment product | Select a Payment product on the payment action |
| The payment product is not available on this client | Select a product available on the current client |
| The payment config does not enable the payment product | Enable the product under the configuration’s Payment products |
| A payment config field cannot be blank | Fill in the required merchant information |
| A payment config field must be a Secret binding | Bind the sensitive field to a secret |
| The Actionflow handling subscription invoice creation must run synchronously and output a BIGINT order ID | See Handle subscription renewals |
| Payment callback data can only be used in a payment callback configuration | Bind Payment callback data only in Actionflow inputs under Payment result handling |
| The payment callback field does not apply to this event type | Bind data that the event provides; see Payment callback data |