Navigation SDK is currently available only to select customers. Contact sales to learn more.

Set up billing

If your contract with Google specifies billing on a per-transaction basis, your app must call recordPickupAtWaypoint() and recordDropoffAtWaypoint() to mark the start and end of each transaction. A transaction corresponds to a single ride for a single passenger or item for delivery.

Starting a transaction with recordPickupAtWaypoint()

When the driver picks up a passenger or collects an item for delivery, your application must call GMSNavigationTransactionRecorder.recordPickupAtWaypoint(). You should initiate this call when the driver interacts with your app to register the pickup. Do not make this call as part of the didArriveAtWaypoint() callback.

The following sample code assumes that the driver taps a button on your app's UI when picking up a passenger or delivery item:

Swift

func recordPickupAtWaypoint() {
  transactionRecorder.recordPickup(at: nil, forTransactionIDs: transactionId)
}

Objective-C

- (void) pickUp {
  [_transactionRecorder recordPickupAtWaypoint:nil forTransactionIDs:transactionId];
}

Pass the following parameters to the recordPickupAtWaypoint() method:

  • The Waypoint at which the pickup is occurring, or nil if the pickup is not part of an existing navigation session.
  • One or more transaction IDs that apply to this pickup. A transaction ID is an arbitrary string that uniquely identifies a billable transaction. See more on transaction IDs.

Ending a transaction with recordDropoffAtWaypoint()

When the driver drops off a passenger or delivers an item, your application must call GMSNavigationTransactionRecorder.recordDropoffAtWaypoint(). You should initiate this call when the driver interacts with your app to register the dropoff. Do not make this call as part of the didArriveAtWaypoint() callback.

The following sample code assumes that the driver taps a button on your app's UI when dropping off a passenger or delivery item:

Swift

func recordDropoffAtWaypoint() {
  transactionRecorder.recordDropoff(at: nil, forTransactionIDs: transactionId)
}

Objective-C

- (void) dropOff {
  [_transactionRecorder recordDropoffAtWaypoint:nil forTransactionIDs:transactionId];
}

Pass the following parameters to the recordDropoffAtWaypoint() method:

  • The Waypoint at which the dropoff is occurring, or nil if the dropoff is not part of an existing navigation session.
  • One or more transaction IDs that apply to this dropoff. A transaction ID is an arbitrary string that uniquely identifies a billable transaction. See more on transaction IDs.

Using your own transaction ID or generate one

The transaction ID provides a way to link a ride with a billing transaction from Google. A transaction ID is an arbitrary string with a maximum length of 64 characters. The ID must be unique across transactions.

It's best if you can provide your own transaction ID: one which your systems already use and store.

Alternatively, you can generate a random, unique transaction ID by calling GMSNavigationTransactionRecorder.generateTransactionId(). Store the generated ID in case your organization needs it for reconciling ride transactions.

Implementation guidelines for the navigation transaction recorder

Use the following guidelines to determine how to allocate billable transactions to rides and deliveries.

General guidelines:

  • You must report billable transactions whenever the Navigation SDK for iOS is in use, including the use of the road-snapped location provider, and even if the app is not in the foreground for a specific journey. When you want to stop reporting billable transactions, disable navigation by setting isGuidanceActive to false.
  • You must register rides and deliveries as separate and independent transactions, even if a driver does both a ride and a delivery at the same time.
  • You must record pickup and dropoff events immediately when the event occurs.

Guidelines for ride transactions:

  • Navigation sessions not involving a passenger (for example, driving to a pickup point or directing a driver to a popular location for future pickups) do not count as billable transactions.
  • The pickup and dropoff of one passenger counts as one billable transaction.

  • A ride for a group of passengers billed as a group, counts as one billable transaction. In more detail: if the driver picks up two or more passengers at one location and drops them off at another location, and you bill them as a group, this counts as a single transaction. Call recordPickupAtWaypoint() just once, and recordDropoffAtWaypoint() just once, with the relevant transaction ID.

  • A shared ride for two separately billed passengers counts as two billable transactions, even if the passengers are picked up and dropped off at the same locations. Call recordPickupAtWaypoint() with both transaction IDs (one for each transaction) when the driver picks up the passengers, and call recordDropoffAtWaypoint() with both transaction IDs when the driver drops off the passengers.

  • Discretionary stopovers do not count as separate billable transactions. Examples include breaking the journey to pick up coffee, or to drop off a co-passenger who is not separately billed. Do not call recordDropoffAtWaypoint() for stopovers like these as normal.

  • If your organization bills some rides indirectly rather than billing at ride time, you must treat these rides as if billing is per ride. For example, your organization may provide a monthly subscription model for unlimited rides. Call recordPickupAtWaypoint() and recordDropoffAtWaypoint() for these rides.

  • If your organization provides bus services that pick up and drop off passengers at a fixed set of stops but do not keep track of the individuals who get in and out at each stop, you must get a separate product license. These types of bus services are outside the scope of per-transaction billing.

  • If your organization provides vehicle for hire services that allow a passenger to make unlimited stops over an extended time period that is all billed as one fee, you must get a separate product license. These services are outside the scope of the per-transaction billing.

Guidelines for delivery transactions:

  • Navigation sessions not involving an item for delivery (for example, driving to a store for picking up goods to be delivered) do not count as billable transactions.
  • The pickup and dropoff of an order from a single location counts as one billable transaction. An order may include multiple physical objects - for example, two bags of groceries. Call recordPickupAtWaypoint() when the driver picks up the order, and recordDropoffAtWaypoint() when the driver delivers the order.
  • When a driver picks up items from multiple locations (for example, stores or restaurants) as part of the same order, each location counts as a separate billable transaction. Use a different transaction ID for each location.
  • When a driver picks up items for multiple customers’ orders from the same location, each order counts as a separate billable transaction. Use a different transaction ID for each order.
  • When two drivers separately pick up and drop off items as part of the same customer order, each driver's delivery counts as a separate billable transaction, even if the items are from the same store location. Use a different transaction ID for each driver.