Sends a preview request to Paddle to simulate a transaction without creating it.

paddle_preview_transaction(
  items,
  customer_id = NULL,
  currency_code = NULL,
  discount_id = NULL,
  ignore_trials = NULL,
  customer_ip_address = NULL,
  address = NULL
)

Arguments

items

List of lists. Required. Each must include `price_id` and `quantity`.

customer_id

Character. Optional. Customer ID prefixed with "ctm_".

currency_code

Character. Optional. Must be valid ISO 4217 code.

discount_id

Character. Optional. Discount ID prefixed with "dsc_".

ignore_trials

Logical. Optional. If TRUE, disables trial discounts.

customer_ip_address

Character. Optional. Valid IPv4 or IPv6.

address

Named list. Optional. Must include `country_code` (2-letter) and optionally `postal_code`.

Value

A list with previewed transaction data.

Examples

if (FALSE) { # paddle_has_token()
set_paddle_mode("sandbox")
result <- paddle_preview_transaction(
  items = list(list(price_id = "pri_123", quantity = 2)),
  customer_id = "ctm_123",
  currency_code = "EUR",
  discount_id = "dsc_123",
  ignore_trials = TRUE,
  customer_ip_address = "8.8.8.8"
)
}