Fitness with Payments integration examples

The payment processor used in this example is Stripe.

Merchants

{
  "metadata": {
    "processing_instruction": "PROCESS_AS_COMPLETE",
    "shard_number": 0,
    "total_shards": 1,
    "nonce": "12923761",
    "generation_timestamp": 1515215404
  },
  "merchant": [
    {
      "merchant_id": "fitness-A",
      "name": "Extreme Cycling",
      "telephone": "+1 123-456-7890",
      "url": "xtremecycling123455.com",
      "geo": {
        "latitude": 37.422113,
        "longitude": -122.084041,
        "address": {
          "country": "US",
          "region": "CA",
          "postal_code": "94043",
          "street_address": "1201 Charleston Rd",
          "locality": "Mountain View"
        }
      },
      "tax_rate": {
        "micro_percent": 5550000
      },
      "tokenization_config": {
        "tokenization_parameter": {
          "gateway": "braintree",
          "braintree:apiVersion": "v1",
          "braintree:sdkVersion": "2.30.0",
          "braintree:merchantId": "fitness-A",
          "braintree:clientKey": "production_12345678_1234567890abcdef"
        }
      },
      "payment_option": [
        {
          "activation_type": "ACTIVATION_ON_FIRST_USE",
          "payment_option_id": "ZSER-10293-123",
          "price": {
            "price_micros": 290000000,
            "currency_code": "USD"
          },
          "session_count": 5,
          "description": "",
          "name": "Pack of 5 Classes",
          "valid_interval": {
            "begin_sec": 1503639426,
            "end_sec": 1506317826
          },
          "payment_option_type": "PAYMENT_OPTION_MULTI_USE",
          "purchase_interval": {
            "begin_sec": 1503639426,
            "end_sec": 1506317826
          },
          "tax_rate": {
            "micro_percent": 6750000
          }
        }
      ],
      "category": "gym",
      "num_bookings_30d": 300,
      "leadtime": 0,
      "tax_rate_basis_points": 0
    },
    {
      "merchant_id": "fitness-B",
      "name": "Modern Barre",
      "telephone": "+1 425-306-2552",
      "url": "modernbarreforall.com",
      "geo": {
        "latitude": 37.422113,
        "longitude": -122.084041,
        "address": {
          "country": "US",
          "region": "CA",
          "postal_code": "94043",
          "street_address": "1616 N Shoreline Blvd",
          "locality": "Mountain View"
        }
      },
      "tax_rate": {
        "micro_percent": 5550000
      },
      "tokenization_config": {
        "tokenization_parameter": {
          "gateway": "braintree",
          "braintree:apiVersion": "v1",
          "braintree:sdkVersion": "2.30.0",
          "braintree:merchantId": "fitness-B",
          "braintree:clientKey": "production_12345678_abcdefghijklmnop"
        }
      },
      "payment_option": [
        {
          "activation_type": "ACTIVATION_ON_FIRST_USE",
          "payment_option_id": "EFHS-3452",
          "price": {
            "price_micros": 150000000,
            "currency_code": "USD"
          },
          "description": "",
          "name": "Monthly Pass",
          "valid_interval": {
            "begin_sec": 1503639426,
            "end_sec": 1506317826
          },
          "payment_option_type": "PAYMENT_OPTION_UNLIMITED",
          "purchase_interval": {
            "begin_sec": 1503639426,
            "end_sec": 1506317826
          },
          "tax_rate": {
            "micro_percent": 6750000
          }
        }
      ],
      "category": "gym",
      "num_bookings_30d": 10,
      "leadtime": 0,
      "tax_rate_basis_points": 0
    },
    {
      "merchant_id": "fitness-C",
      "name": "Pat's Strength Class",
      "telephone": "+1 312-388-8861",
      "url": "buildpurestrength.com",
      "geo": {
        "latitude": 37.422113,
        "longitude": -122.084041,
        "address": {
          "country": "US",
          "region": "CA",
          "postal_code": "94043",
          "street_address": "1500 Plymouth St",
          "locality": "Mountain View"
        }
      },
      "tax_rate": {
        "micro_percent": 5550000
      },
      "tokenization_config": {
        "tokenization_parameter": {
          "gateway": "braintree",
          "braintree:apiVersion": "v1",
          "braintree:sdkVersion": "2.30.0",
          "braintree:merchantId": "fitness-C",
          "braintree:clientKey": "production_12345678_klmnopqrstuvwxyz"
        }
      },
      "payment_option": [
        {
          "activation_type": "ACTIVATION_ON_FIRST_USE",
          "payment_option_id": "ABCD-12345-12983-19283",
          "price": {
            "price_micros": 45000000,
            "currency_code": "USD"
          },
          "session_count": 1,
          "description": "",
          "name": "Single Class",
          "valid_interval": {
            "begin_sec": 1503639426,
            "end_sec": 1506317826
          },
          "payment_option_type": "PAYMENT_OPTION_SINGLE_USE",
          "purchase_interval": {
            "begin_sec": 1503639426,
            "end_sec": 1506317826
          },
          "tax_rate": {
            "micro_percent": 6750000
          }
        }
      ],
      "category": "gym",
      "num_bookings_30d": 300,
      "leadtime": 0,
      "tax_rate_basis_points": 0
    }
  ]
}

Services

{
  "metadata": {
    "processing_instruction": "PROCESS_AS_COMPLETE",
    "shard_number": 0,
    "total_shards": 1,
    "nonce": "12484223",
    "generation_timestamp": 1522991406
  },
  "service": [
    {
      "merchant_id": "fitness-A",
      "service_id": "123456",
      "localized_service_name": {
        "value": "Cycling Class",
        "localized_value": [
          {
            "locale": "en",
            "value": "Cycling Class"
          }
        ]
      },
      "localized_description": {
        "value": "Join a small group of 15 students for cycling class. All levels welcome.",
        "localized_value": [
          {
            "locale": "en",
            "value": "Join a small group of 15 students for cycling class. All levels welcome."
          }
        ]
      },
      "price": {
        "price_micros": 40000000,
        "currency_code": "USD"
      },
      "rules": {
        "min_advance_booking": 0,
        "min_advance_online_canceling": 86400
      },
      "prepayment_type": "REQUIRED",
      "tax_rate": {
        "micro_percent": 7750000
      },
      "require_credit_card": "REQUIRE_CREDIT_CARD_ALWAYS"
    },
    {
      "merchant_id": "fitness-B",
      "service_id": "238472",
      "localized_service_name": {
        "value": "Barre Class",
        "localized_value": [
          {
            "locale": "en",
            "value": "Barre Class"
          }
        ]
      },
      "localized_description": {
        "value": "Join in on the Barre craze. Our studio fits 30 students and all levels welcome.",
        "localized_value": [
          {
            "locale": "en",
            "value": "Join in on the Barre craze. Our studio fits 30 students and all levels welcome."
          }
        ]
      },
      "price": {
        "price_micros": 75000000,
        "currency_code": "USD"
      },
      "rules": {
        "min_advance_booking": 0,
        "min_advance_online_canceling": 86400
      },
      "prepayment_type": "REQUIRED",
      "tax_rate": {
        "micro_percent": 7750000
      },
      "require_credit_card": "REQUIRE_CREDIT_CARD_ALWAYS"
    },
    {
      "merchant_id": "fitness-C",
      "service_id": "019283",
      "localized_service_name": {
        "value": "Pure Strength Class",
        "localized_value": [
          {
            "locale": "en",
            "value": "Pure Strength Class"
          }
        ]
      },
      "localized_description": {
        "value": "Build muscle with our award winning instructors. Advanced level recommended.",
        "localized_value": [
          {
            "locale": "en",
            "value": "Build muscle with our award winning instructors. Advanced level recommended."
          }
        ]
      },
      "price": {
        "price_micros": 155000000,
        "currency_code": "USD"
      },
      "rules": {
        "min_advance_booking": 0,
        "min_advance_online_canceling": 86400
      },
      "prepayment_type": "REQUIRED",
      "tax_rate": {
        "micro_percent": 7750000
      },
      "require_credit_card": "REQUIRE_CREDIT_CARD_ALWAYS"
    }
  ]
}

Availability

{
  "metadata": {
    "processing_instruction": "PROCESS_AS_COMPLETE",
    "shard_number": 0,
    "total_shards": 1,
    "nonce": "12384212",
    "generation_timestamp": 1462926569
  },
  "service_availability": [
    {
      "availability": [
        {
          "duration_sec": 1800,
          "merchant_id": "fitness-A",
          "payment_option_id": [
            "ZSER-10293-123"
          ],
          "resources": {
            "room_id": "room_0",
            "room_name": "Room-A",
            "staff_id": "staff_0",
            "staff_name": "Alice"
          },
          "service_id": "123456",
          "spots_open": 1,
          "spots_total": 1,
          "start_sec": 1468080000,
          "confirmation_mode": "CONFIRMATION_MODE_SYNCHRONOUS"
        },
        {
          "duration_sec": 1800,
          "merchant_id": "fitness-A",
          "payment_option_id": [
            "EFHS-3452"
          ],
          "resources": {
            "room_id": "room_1",
            "room_name": "Room-B",
            "staff_id": "staff_1",
            "staff_name": "Bob"
          },
          "service_id": "238472",
          "spots_open": 1,
          "spots_total": 1,
          "start_sec": 1468080000,
          "confirmation_mode": "CONFIRMATION_MODE_SYNCHRONOUS"
        },
        {
          "duration_sec": 1800,
          "merchant_id": "fitness-A",
          "payment_option_id": [
            "ABCD-12345-12983-19283"
          ],
          "resources": {
            "room_id": "room_2",
            "room_name": "Room-C",
            "staff_id": "staff_2",
            "staff_name": "Pat"
          },
          "service_id": "019283",
          "spots_open": 1,
          "spots_total": 1,
          "start_sec": 1468080000,
          "confirmation_mode": "CONFIRMATION_MODE_SYNCHRONOUS"
        },
        {
          "duration_sec": 1800,
          "merchant_id": "fitness-A",
          "payment_option_id": [
            "ABCD-12345-12983-19283"
          ],
          "resources": {
            "room_id": "room_0",
            "room_name": "Room-A",
            "staff_id": "staff_0",
            "staff_name": "Pat"
          },
          "service_id": "019283",
          "spots_open": 1,
          "spots_total": 1,
          "start_sec": 1468081800,
          "confirmation_mode": "CONFIRMATION_MODE_SYNCHRONOUS"
        }
      ]
    }
  ]
}