The most likely reason to use the tremendousr package is to send rewards This function, trem_send_reward(), provides an easy interface to do so. See the examples for more details.

trem_send_reward(
  client,
  name,
  email = NULL,
  phone = NULL,
  reward_amount,
  currency_code = "USD",
  delivery_method = "EMAIL",
  payment_description_id,
  funding_source_id,
  reward_types,
  parse = TRUE
)

Arguments

client

A Tremendous API Client object, created with trem_client_new.

name

Name of the recipient.

email

Email address of the recipient.

phone

Phone number of the recipient (US phone numbers only).

reward_amount

Amount of the reward (numeric).

currency_code

Currency of the reward (default to "USD").

delivery_method

Default to "EMAIL", for sending the reward to the recipient via email. Alternatively, reward can be delivered via a link ("LINK") or text message ("PHONE").

payment_description_id

Unique ID for specific order. This will appear as external_id on Tremendous Dashboard.

funding_source_id

ID of the funding source linked to your account, to draw funds from for this order. One of the IDs from trem_get("funding_sources").

reward_types

A character vector of product ids -- reward options -- for the recipient to choose from. Available options can be found here.

parse

Logical: Should the API Response results be parsed into a data frame?

Value

If parse = TRUE (default), a list containing the response from payment API request. Otherwise, the R6 HttpResponse object containing API request data.

Examples

if (FALSE) { # Create a Tremendous Client test_client <- trem_client_new(api_key = "TEST_YOUR-KEY-HERE", sandbox = TRUE) # Sandbox environment so no actual money is sent # To send a payment, you can simply pass in the client # and specify the necessary fields. payment1 <- trem_send_reward(client = test_client, name = "first last", email = "email@website.com", reward_amount = 10, currency_code = "USD", delivery_method = "EMAIL", payment_description_id = "payment-from-tremendousr-examples", funding_source_id = "your-funding-id-from-tremendous", reward_types = "Q24BD9EZ332JT", # ID for virtual visa gift card parse = TRUE # Return a parsed API response ) }