TinyPass Developer's Resources

Multiple Price Options

In our next example, this publisher wants to offer a few purchase options to their users.

  • $0.05 per 24 hour access
  • $0.10 per 72 hour access
  • $0.50 per 30 day access

//Create 3 price options
$po1 = new TPPriceOption("0.05", "24 hours");
$po2 = new TPPriceOption("0.10", "72 hours");
$po3 = new TPPriceOption("0.50", "30 days");
 
$offer->addPriceOption($po1);
$offer->addPriceOption($po2);
$offer->addPriceOption($po3);

//Create 3 price options
PriceOption po1 = new PriceOption("0.05", "24 hours");
PriceOption po2 = new PriceOption("0.10", "72 hours");
PriceOption po3 = new PriceOption("0.50", "30 days");
 
offer.addPriceOptions(po1, po2, po3);

//Create 3 price options
var po1 = new PriceOption("0.05", "24 hours");
var po2 = new PriceOption("0.10", "72 hours");
var po3 = new PriceOption("0.50", "30 days");
 
offer.AddPriceOptions(po1, po2, po3);

# Create 3 price options
price_option1 = Tinypass::PriceOption.new('0.05', '24 hours')
price_option2 = Tinypass::PriceOption.new('0.10', '72 hours')
price_option3 = Tinypass::PriceOption.new('0.50', '30 days')
 
offer.pricing.price_options = [price_option1, price_option2, price_option3]