anchor.diff:  
   
   
  -
  -== Plugin Activation
  -
  -When a payment operation occurs, Kil Bill will chose which payment plugin to go to based on the `paymentMethodId` specified. The `paymentMethodId` will map to an specific payment method, which in turns contains the name of the plugin to chose for the payment.
  -
  
positive.code: |===
  
  
  Kill Bill has a https://docs.killbill.io/latest/userguide_payment.html#_janitor[Janitor] system in place that attempts to fix *PENDING* and *UNKNOWN* states . It polls the plugin via `PaymentPluginApi#getPaymentInfo` method. If the plugin subsequently returns *PROCESSED* , the Janitor updates the internal payment state as well as invoice balance, etc.) accordingly
  
  The Janitor matches the internal transactions against plugin transactions via the *transaction id*: make sure `PaymentTransactionInfoPlugin#getKbTransactionPaymentId` is correctly implemented.
  
  
negative.code: 
  A few pointers for implementing these methods:
  
  * Almost all the `PaymentPluginApi` methods accept parameters like *Kill bill accountId*, *Kill Bill payment id*, *Kill Bill transaction id*, etc which are self-explanatory. These may or may not be used by your plugin code. But you may need some of these values to populate the `PaymentTransactionInfoPlugin` object which is returned by all the methods as explained below. 
  
  * All the methods listed in the `PaymentPluginApi` also accept `Iterable<PluginProperty> properties` as a parameter. 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. It can be used to pass plugin specific properties to the plugin. For example, if your plugin requires properties like *city=San Francisco* and *billing_address=abc*, a client application can create two `PluginProperty` objects and pass a `List` of these objects.
  
  * All the methods listed in the `PaymentPluginApi` also accept as parameter either a `TenantContext` or a `CallContext`.  Read only operations (operations which retrieve some data from Kill Bill) like the `getPaymentInfo` listed below accept a `TenantContext`. Read/write operations like `authorizePayment` listed below accept a `CallContext`. Both these values can be used for auditing purposes. 
  
  * It is quite possible that your plugin might support some of the operations listed above. In such a case, the plugin can do one of the following:
  
  ** Return an *empty list* when the return type is a list 
  ** Return a transaction with status *CANCELED* if the return type is a `PaymentTransactionInfoPlugin` 
  ** Return empty objects otherwise
  
  == PaymentTransactionInfoPlugin 
  
  
  All the payment related methods listed in the `PaymentPluginApi` return an https://github.com/killbill/killbill-api/blob/4ae1c343a593de937415e21feecb9f5405037fa3/src/main/java/org/killbill/billing/payment/plugin/api/PaymentTransactionInfoPlugin.java[PaymentTransactionInfoPlugin] object. Again, the Kill Bill Plugin framework includes a class https://github.com/killbill/killbill-plugin-framework-java/blob/46d94fbeb1cf089aa04e62cfecf751ca47032023/src/main/java/org/killbill/billing/plugin/api/payment/PluginPaymentTransactionInfoPlugin.java[ PluginPaymentTransactionInfoPlugin] which implements the `PaymentTransactionInfoPlugin`. You can create a class that extends this class as done in our https://github.com/killbill/killbill-stripe-plugin/blob/657482f82949f08d4d317be8eb159855e7aad6f7/src/main/java/org/killbill/billing/plugin/stripe/StripePaymentTransactionInfoPlugin.java[Stripe plugin]
  
  The `PaymentTransactionInfoPlugin` has methods that return information like *Kill bill accountId*, *Kill Bill payment id*, *Kill Bill transaction id*, etc. Kill Bill retrieves and uses these values as required.
  
  The  `PaymentTransactionInfoPlugin` also has a `getProperties` method that returns a `PluginProperty` List. This can be used to return plugin specific properties to the client API 
  
  In addition, the `PaymentTransactionInfoPlugin` has a `getStatus` method that returns an  https://github.com/killbill/killbill-api/blob/4ae1c343a593de937415e21feecb9f5405037fa3/src/main/java/org/killbill/billing/payment/plugin/api/PaymentPluginStatus.java[PaymentPluginStatus].  It is very important to correctly populate the status type. The following table elaborates how the status should be populated:
  
  |===
  |Status | Status Description
  