Handling Refunds

Handling Refunds#

In case a Trip is delayed or terminated, Customers may request a Refund via customer support. In that case, the Integrator is responsible to reimburse the amount to the Customer. To know when to handle a Refund, you need to query them.

List Refunds#

To get a list of all Refunds, we use the ListRefunds RPC.

grpcurl \
  -H "Authorization: Bearer ${ACCESS_TOKEN}" \
  -import-path ./protos/ \
  -proto "moia/trip/refund/v1beta1/refund.proto" \
  -proto "google/rpc/error_details.proto" \
  -d "{\"pageSize\": 5}" \
  $API_URL moia.trip.refund.v1beta1.RefundService/ListRefunds

We receive a response of type ListRefundsResponse, which contains a list of Refunds, ordered by date from newest to oldest, and an optional next_page_token to support pagination.

If a next_page_token is present, it can be used to retrieve subsequent Refunds by passing it as page_token in a ListRefundsRequest.

If next_page_token is not present, there are no more Refunds to return.

We can end the repeated calls prematurely if we received all Refunds that we haven’t processed yet.

Optionally, you may specify a customer_id to filter for Refunds of that Customer.

A Refund contains the ID of the Customer who ordered the Trip, the ID of that Trip and the amount of money to be refunded. Partial refunds are not supported.

Get Refund#

To get a specific Refund by its identifier, we use the GetRefund RPC.

# export REFUND_ID="<replace with refund id>"
grpcurl \
  -H "Authorization: Bearer ${ACCESS_TOKEN}" \
  -import-path ./protos/ \
  -proto "moia/trip/refund/v1beta1/refund.proto" \
  -proto "google/rpc/error_details.proto" \
  -d "{\"refundId\": \"${REFUND_ID}\"}" \
  $API_URL moia.trip.refund.v1beta1.RefundService/GetRefund