title: Graphql ruby how to create interface type and implement it
body: <p>I have follow this <a href="http://www.rubydoc.info/github/rmosolgo/graphql-ruby/GraphQL/InterfaceType" rel="nofollow noreferrer" title="docs">docs</a> about to create and implement interface on graphql:</p>
  
  <p>here is my code:</p>
  
  <pre><code>PaymentInterface = GraphQL::InterfaceType.define do
    name 'Payment'
  
    field :name, types.String
    field :grand_total, MoneyType
    field :subtotal, MoneyType
    field :shipping_fee, MoneyType
  end
  </code></pre>
  
  <p>and this is the object type that implement previous interface</p>
  
  <pre><code>PaypalPaymentType = GraphQL::ObjectType.define do
    interfaces [PaymentInterface]
  
    field :paypal_charge do
      type -&gt; { MoneyType }
      type types.String
      resolve lambda { |obj, _args, _ctx|
        Hashie::Mash.new(
          currency: obj.currency,
          price: obj.paypal_charge
        )
      }
    end
  end
  </code></pre>
  
  <p>Here is the query:</p>
  
  <pre><code>interface PaymentInterface {
      name: String
      grand_total: MoneyType
      subtotal: MoneyType
      shipping_fee: MoneyType
  }
  type PaypalPaymentType implements PaymentInterface {
      name: String
      grand_total: MoneyType
      subtotal: MoneyType
      shipping_fee: MoneyType
      paypal_charge: MoneyType
  }
  {
    purchasables {
      isService
      isProduct
      price
      ... on PaypalPaymentType {
        paypal_charge { raw formatted }
      }
    }
  }
  </code></pre>
  
  <p>But Im keep getting error, anyone has the same experience before? thanks in advance</p>
  
  <pre><code>GraphQL::Schema::InvalidTypeError (Field PaymentMethod.paypal_charge is invalid: name must return String, not NilClass (nil)):
  </code></pre>