anchor.diff:  [NOTE]
   *Note*: `PROCESSED`, `ERROR` and `PENDING` are normal cases and it is okay to return these status values from plugin methods. However, `CANCELED` and `UNDEFINED` should be reserved for serious issues like plugin failure,  timeout, etc. 
   
  +[[plugin_property_notes]]
  +== Plugin Property Notes  
  +
  +Sometimes, it may be necessary to pass extra plugin/gateway specific data to/from a plugin. Plugin properties can be used in such situations. A https://github.com/killbill/killbill-api/blob/4ae1c343a593de937415e21feecb9f5405037fa3/src/main/java/org/killbill/billing/payment/api/PluginProperty.java[_PluginProperty_] consists of a *key-value* pair. For example, *city=San Francisco*. It is important to note that plugin properties passed to a plugin or returned by a plugin are opaque to Kill Bill. So, Kill Bill just passes these values through. 
  +
  +* Properties can be passed to a plugin method via the `properties` parameter (If you recall, all the <<paymentpluginapi_methods, plugin methods>> accept `Iterable<PluginProperty> properties` as a parameter).
  +
  +* Properties can be returned from a plugin via the <<PaymentTransactionInfoPlugin, PaymentTransactionInfoPlugin>> object (So the `PaymentTransactionInfoPlugin#getProperties` must be implemented to return the desired plugin properties).
  +
  +See the https://docs.killbill.io/latest/userguide_payment.html#_plugin_properties[__payment guide__] for more information on plugin properties.
  +
   == GoCardless Plugin Tutorial
   
   In order to demonstrate creating a payment plugin, we will be creating a Kill Bill payment plugin for https://gocardless.com/[_GoCardless_]. GoCardless allows direct debit from customer's bank accounts. It requires a customer to set up a *mandate* the first time. A *mandate* is an *authorisation* from a customer to take payments from their bank account. Once a mandate is set up, it directly collects payments against the mandate. 
  
positive.code: |getSecondPaymentReferenceId
  |Returns gateway specific second payment id if any
  |getProperties
  |Returns a https://github.com/killbill/killbill-api/blob/4ae1c343a593de937415e21feecb9f5405037fa3/src/main/java/org/killbill/billing/payment/api/PluginProperty.java[PluginProperty] list. This can be used to return arbitrary plugin specific properties
  |===
  
  It is very important to correctly populate the https://github.com/killbill/killbill-api/blob/4ae1c343a593de937415e21feecb9f5405037fa3/src/main/java/org/killbill/billing/payment/plugin/api/PaymentPluginStatus.java[PaymentPluginStatus]  in the `PaymentTransactionInfoPlugin` object. The following table elaborates how the status should be populated and the payment state that the plugin status translates to:
  
  |===
  |Plugin Status | Status Description | Payment State
  
  |PROCESSED
  |Indicates that the payment is successful
  
negative.code: = Payment Plugin Overview
  
  Payment plugins integrate Kill Bill with a specific gateway (i.e. payment processor), such as Stripe or Braintree. We already have many open-source payment plugins available on GitHub as listed in our https://docs.killbill.io/latest/plugin_introduction.html#payment_gateways[_plugin document_].
  
  This tutorial can be used to develop a custom payment plugin.
  
  == Prerequisites
  
  * Make sure to familiarize yourself with https://docs.killbill.io/latest/userguide_subscription.html#components-payment[_payment components_] and the https://docs.killbill.io/latest/userguide_payment.html[_payment userguide_].
  
  * Make sure to familiarize yourself with https://docs.killbill.io/latest/plugin_introduction.html[_Kill Bill plugins_].
  
  
  == Developing a Payment Plugin
  
  Kill Bill provides a  https://github.com/killbill/killbill-plugin-api/[_Plugin API_] for plugin development. This includes the https://github.com/killbill/killbill-plugin-api/blob/master/payment/src/main/java/org/killbill/billing/payment/plugin/api/PaymentPluginApi.java[_PaymentPluginApi_] interface which can be used to develop a payment plugin. Thus, this interface needs to be implemented in order to develop a custom payment plugin.
  
  Kill Bill also provides a https://github.com/killbill/killbill-plugin-framework-java[_plugin framework_] which has many classes that can be used out of the box for plugin development. We strongly encourage you to use this framework.  
  
  == Getting Started
  
  At a high level, the following needs to be done to develop a payment plugin:
  
  . Clone one of our existing sample plugins and set it up as explained in the https://docs.killbill.io/latest/plugin_development.html#\_getting\_started[__Plugin Development__] document. You can use one of the following:
  .. https://github.com/killbill/killbill-hello-world-java-plugin[_Hello World Plugin_] - This is a sample plugin and can be used as a template for developing other plugins. 
  ..  https://github.com/killbill/killbill-gocardless-example-plugin[_GoCardless example plugin_] - This is a sample payment plugin for https://gocardless.com/[_Gocardless_] and is used in this tutorial.
  . Create a class that implements the `PaymentPluginApi` interface (Similar to https://github.com/killbill/killbill-hello-world-java-plugin/blob/master/src/main/java/org/killbill/billing/plugin/helloworld/HelloWorldPaymentPluginApi.java[_HelloWorldPaymentPluginApi_] or https://github.com/killbill/killbill-gocardless-example-plugin/blob/main/src/main/java/org/killbill/billing/plugin/gocardless/GoCardlessPaymentPluginApi.java[_GoCardlessPaymentPluginApi.java_]).
  . Implement the desired methods from the `PaymentPluginApi` interface within your class. These methods are explained in the <<paymentpluginapi_methods, "PaymentPluginApi Methods">> table below.
  . Create an activator class that is responsible for starting the plugin (Similar to https://github.com/killbill/killbill-hello-world-java-plugin/blob/master/src/main/java/org/killbill/billing/plugin/helloworld/HelloWorldActivator.java[_HelloWorldActivator_] or https://github.com/killbill/killbill-gocardless-example-plugin/blob/main/src/main/java/org/killbill/billing/plugin/gocardless/GoCardlessActivator.java[_GoCardlessActivator_]).
  
  [[paymentpluginapi_methods]]
  == PaymentPluginApi Methods
  
  The following table lists the methods in the https://github.com/killbill/killbill-plugin-api/blob/master/payment/src/main/java/org/killbill/billing/payment/plugin/api/PaymentPluginApi.java[_PaymentPluginApi_] interface. You can implement the desired methods in your plugin class.
  
  |===
  |Method Name | Method Description
  