anchor.diff:  
   ** `client` This is of type http://gocardless.github.io/gocardless-pro-java/com/gocardless/GoCardlessClient.html[GoCardlessClient]. This is a GoCardless specific class that can be used to access the GoCardless API
   
  -* The constructor simply initializes the fields with the values passed in. In addition, it also creates a GoCardless client and initializes the `client` field 
  +* The constructor simply initializes the fields with the values passed in. In addition, it also creates a GoCardless client and initializes the `client` field.
   
   Within this class, we need to implement the `buildFormDescriptor`, `addPaymentMethod` and `purchasePayment` as explained in the <<using_gocardless_from_killbill, "Using GoCardless from Kill Bill">> section above. 
   
  
positive.code: |getSecondPaymentReferenceId
  |Returns gateway specific second payment id if any
  |getProperties
  |Returns a `PluginProperty` List. This can be used to return plugin specific properties to the client API 
  |===
  
  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:
  
  |===
  |Status | Status Description
  
  |PROCESSED
  |Indicates that the payment is successful
  |ERROR
  |Indicates that the payment is rejected by the gateway (insufficient funds, fails AVS check, fraud detected, etc.)
  |PENDING
  |Indicates that the payment requires a completion step (3D-S verification, HPP, etc.)
  |CANCELED
  |Indicates that the gateway wasn't contacted (DNS error, SSL handshake error, socket connect timeout, etc.)
  |UNDEFINED
  |Should be used for all other cases (socket read timeout, 500 returned, etc.)
  |===
  
  
  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*, so make sure `PaymentTransactionInfoPlugin#getKbTransactionPaymentId` is correctly implemented.
  
  You should try to avoid *UNDEFINED* as much as possible, because it is the only case where Kill Bill cannot retry payments (since the payment may or may not have happened).
  
  
  == GoCardless Plugin Tutorial
  
  
negative.code: 
  In order to get started with your own payment plugin, you need to do the following:
  
  . Set up the *Hello World Plugin* as explained in the  https://docs.killbill.io/latest/plugin_development.html#_getting_started[__Plugin Development__] document.
  
  . Create a new Maven project similar to *Hello World Plugin*.
  
  . Create a class similar to https://github.com/killbill/killbill-hello-world-java-plugin/blob/719779b1ea25c14928e92996b6aa21cc9bf8d4fe/src/main/java/org/killbill/billing/plugin/helloworld/HelloWorldPaymentPluginApi.java[HelloWorldPaymentPluginApi.java]. This is a reference class that implements the `PaymentPluginApi` interface.
  
  . Implement the desired methods from the `PaymentPluginApi` interface within your class. These methods are explained in the <<paymentpluginapi_methods, "PaymentPluginApi Methods">> table below.
  
  