Payment

The Payment object represents a financial transaction in your Fungies store.

A Payment object represents a single financial transaction - either a one-time purchase or a recurring subscription charge. Payments track the monetary flow, including the amount, fees, tax, and processing status.

Each payment is associated with an Order and optionally with a User and Subscription. Payments contain detailed information about charges, including payment method details and invoice data when applicable.

Endpoints

MethodEndpointDescription
GET/v0/payments/listList and filter payments
GET/v0/payments/{paymentId}Retrieve a payment by ID
PATCH/v0/payments/{paymentId}/cancelCancel a payment that is still pending

To refund a payment that has already completed, use PATCH /v0/orders/{orderIdOrNumber}/refund instead.

Cancelling a pending payment

PATCH /v0/payments/{paymentId}/cancel aborts an in-progress checkout before it completes.

Only PENDING payments are eligible — any other status returns a 400, including PAID, FAILED, CANCELLED, REFUNDED, PARTIALLY_REFUNDED, UNPAID, and EXPIRED. Two more cases return 400: PayPal payments, and subscription plan-change payments (subscription_update), which cannot be cancelled through this endpoint.

A 200 means the cancellation was requested, not that it has taken effect. The payment stays PENDING until the payment processor confirms, at which point it becomes CANCELLED. Poll the payment or wait for the status to change rather than assuming it flipped.

The Payment object

objectstring

Object type identifier. Always "payment" for Payment objects.

idstringrequired

Unique identifier (UUID) for this payment.

numberstringrequired

Human-readable payment number (e.g., L8VQK3N2M7KpQ9nR). Used for reference in invoices and support. Subscription renewals add a cycle suffix (L8VQK3N2M7KpQ9nR-0003). The dashboard shows this with a leading #; the API never returns one.

typestringrequired

Type of payment. Possible values: one_time, subscription_initial, subscription_update, subscription_interval, subscription_extra, claim_free

statusstringrequired

Current payment status. Possible values: PENDING, PAID, FAILED, UNPAID, CANCELLED, REFUNDED, PARTIALLY_REFUNDED, EXPIRED

valueinteger

Payment amount in the smallest currency unit (e.g., cents for USD). Includes tax but excludes fees. Defaults to 0.

taxinteger

Tax amount in the smallest currency unit. Included in the total value. Defaults to 0.

feeinteger

Processing fee in the smallest currency unit. This is deducted from your payout. Defaults to 0.

currencystring | null

Three-letter ISO 4217 currency code (e.g., "USD", "EUR", "GBP").

currencyDecimalsinteger | null

Number of decimal places for this currency (e.g., 2 for USD, 0 for JPY).

createdAtinteger

Unix timestamp (milliseconds) when the payment was created.

userIdstring | null

UUID of the User who made this payment.

userUser | null

Expanded User object with basic information about the payer.

user properties
objectstring

Always "user".

idstringrequired

Unique identifier (UUID) for this user.

usernamestring | null

Username of the user.

orderIdstring | null

UUID of the associated Order. For subscription payments, this links to the initial order.

orderNumberstring | null

Human-readable order number of the associated order.

orderOrder | null

Expanded Order object with basic information.

order properties
objectstring

Always "order".

idstringrequired

Unique identifier (UUID) for this order.

numberstringrequired

Human-readable order number.

statusstringrequired

Current order status.

checkoutIdstring | null

UUID of the checkout element this payment originated from, if it was created through one. null otherwise. Filter payments by it with the checkoutIds query parameter on list.

subscriptionIdstring | null

Subscription identifier if this is a subscription-related payment.

subscriptionSubscription | null

Expanded Subscription object with status and ID.

subscription properties
objectstring

Always "subscription".

idstringrequired

Subscription identifier.

statusstringrequired

Subscription status: active, past_due, canceled, unpaid, incomplete, incomplete_expired, trialing, paused

discountDiscount | null

Applied Discount object if a discount code or sale was used.

discount properties
objectstring

Always "discount".

idstringrequired

Unique identifier (UUID) for this discount.

typestringrequired

Discount type: code or sale.

namestring | null

Display name of the discount.

amountnumberrequired

Discount amount (fixed value or percentage).

amountTypestringrequired

Whether amount is fixed or percentage.

discountCodestring | null

The coupon code if this is a code-type discount.

invoiceNumberstring | null

Invoice number for completed payments. Only available for PAID, REFUNDED, or PARTIALLY_REFUNDED statuses.

invoiceUrlstring | null

URL to download the invoice PDF. Only available for completed payments with generated invoices, and null for an order that has no redeem link.

chargesarray | null

Array of charge attempts for this payment.

charge properties
objectstring

Always "charge".

idstringrequired

Unique identifier (UUID) for this charge.

statusstring | null

Charge status: succeeded, pending, failed

createdAtnumber | null

Unix timestamp (milliseconds) when the charge was created.

authorizedAtnumber | null

Unix timestamp (milliseconds) when the charge was authorized — the same value as createdAt for a pending or succeeded charge. null for a charge that failed (declined or blocked), and null for PayPal.

capturedAtnumber | null

Unix timestamp (milliseconds) when the charge was captured. Charges on this platform are captured at creation (Stripe's default capture method; no manual-capture path exists here), so this equals createdAt for a captured charge. null while not captured, for PayPal, and for charges recorded before this field existed. Stripe's Charge object carries no separate capture timestamp; a Radar review flags a captured charge for a human to look at and does not delay capture.

ipAddressstring | null

IP address of the customer at time of charge.

outcomeobject | null

Fraud/authorization signal from the payment processor for this charge attempt. null for PayPal.

typestring | null

Processor's outcome classification: authorized, manual_review, issuer_declined, blocked, or invalid. unknown if Stripe returns a value not in this list.

riskLevelstring | null

Stripe Radar's risk assessment: normal, elevated, highest, or not_assessed. unknown if Stripe returns a value not in this list.

riskScorenumber | null

Stripe Radar's 0-100 risk score. null when Radar scoring isn't enabled.

networkStatusstring | null

Card network's response to the authorization request: approved_by_network, declined_by_network, not_sent_to_network, or reversed_after_approval. unknown if Stripe returns a value not in this list.

threeDSecurestring | null

3D Secure authentication result for a card charge: authenticated, attempted, failed, or not_supported when the card issuer didn't invoke 3DS. null for non-card payment methods, for PayPal, and for charges recorded before this field started being captured (even if 3DS was actually used).

reasonstring | null

Machine-readable reason code for the charge outcome, useful for branching on failures. null when no reason was reported.

sellerMessagestring | null

Human-readable explanation of the charge outcome — the most useful field for showing a merchant or support agent why a charge failed. null when no message was reported.

paymentMethodobject | null

Payment method details including type, brand, last4, and card.

typestring

Payment method type (e.g., card, paypal, bank_transfer, klarna, affirm).

brandstring | null

Card brand if payment method is a card (visa, mastercard, amex, discover, diners, jcb, unionpay).

last4string | null

Last 4 digits of the card or account number.

cardobject

Card-specific payment details. Present when the payment method type is card.

brandstring | null

Card brand (visa, mastercard, amex, discover, diners, jcb, unionpay).

last4string | null

Last 4 digits of the card number.

countrystring | null

Two-letter ISO country code of the card issuer.

networkstring | null

Card network (e.g., visa, mastercard).

walletobject | null

Digital wallet details, if the card payment was made via a wallet (e.g., Apple Pay, Google Pay). Null when no wallet was used.

typestring

The type of digital wallet: amex_express_checkout, apple_pay, google_pay, link, masterpass, samsung_pay, or visa_checkout.

dynamicLast4string | null

The last four digits of the device account number. May differ from the physical card's last4.


Example response

{
  "status": "success",
  "data": {
    "payment": {
      "object": "payment",
      "id": "660e8400-e29b-41d4-a716-446655440001",
      "number": "L8VQK3N2M7KpQ9nR",
      "type": "one_time",
      "status": "PAID",
      "value": 2999,
      "tax": 500,
      "fee": 87,
      "currency": "USD",
      "currencyDecimals": 2,
      "createdAt": 1705590000000,
      "userId": "123e4567-e89b-12d3-a456-426614174000",
      "user": {
        "object": "user",
        "id": "123e4567-e89b-12d3-a456-426614174000",
        "username": "johndoe"
      },
      "orderId": "550e8400-e29b-41d4-a716-446655440000",
      "orderNumber": "L8VQK3N2M7KpQ9nR",
      "order": {
        "object": "order",
        "id": "550e8400-e29b-41d4-a716-446655440000",
        "number": "L8VQK3N2M7KpQ9nR",
        "status": "PAID"
      },
      "checkoutId": "aa0e8400-e29b-41d4-a716-446655440007",
      "subscriptionId": null,
      "subscription": null,
      "discount": null,
      "invoiceNumber": "INV-2024-001234",
      "invoiceUrl": "https://api.fungies.io/invoice/INV-2024-001234",
      "charges": [
        {
          "object": "charge",
          "id": "770e8400-e29b-41d4-a716-446655440002",
          "status": "succeeded",
          "createdAt": 1705590000000,
          "authorizedAt": 1705590000000,
          "capturedAt": 1705590000000,
          "ipAddress": "192.168.1.100",
          "outcome": {
            "type": "authorized",
            "riskLevel": "normal",
            "riskScore": 12,
            "networkStatus": "approved_by_network"
          },
          "threeDSecure": "authenticated",
          "reason": null,
          "sellerMessage": "Payment complete.",
          "paymentMethod": {
            "type": "card",
            "brand": "visa",
            "last4": "4242",
            "card": {
              "brand": "visa",
              "last4": "4242",
              "country": "US",
              "network": "visa",
              "wallet": {
                "type": "apple_pay",
                "dynamicLast4": "7279"
              }
            }
          }
        }
      ]
    }
  }
}

Last updated