anchor.diff:  
   == Further Reading
   
  -* https://docs.killbill.io/latest/plugin_development.html[_Plugin Development Guide_]
  -
   * https://docs.killbill.io/latest/plugin_installation.html[_Plugin Installation_]
   
   * https://docs.killbill.io/latest/Kill-Bill-Glossary.html[_Kill Bill Glossary_]
  
positive.code: 
  ==== Step 5 - Implementing GoCardlessPaymentPluginApi#addPaymentMethod
  
  The `addPaymentMethod` method is typically used to add a https://docs.killbill.io/latest/Kill-Bill-Glossary.html#payment_method[_payment method_] in Kill Bill corresponding to a https://docs.killbill.io/latest/Kill-Bill-Glossary.html#account[_customer/account_]. Most plugins use this method to create the payment method in the gateway and store payment method specific data in the plugin tables). This tutorial uses it to *complete* the *redirect flow*. Thus, it is implemented as follows (See https://github.com/killbill/killbill-gocardless-example-plugin/blob/9522498ecde5849c940574c598ceb5ce088d32a7/src/main/java/org/killbill/billing/plugin/gocardless/GoCardlessPaymentPluginApi.java#L223[`GoCardlessPaymentPluginApi#addPaymentMethod`]):
  
  [source,java,linenums]
  ----
  
negative.code: 
  . The merchant site can then invoke `KillBill#purchasePayment` as required. This in turn invokes `GoCardlessPlugin#purchasePayment`.
  
  . The `GoCardlessPlugin#purchasePayment` invokes the `payments().create()` to charge the customer against the saved *mandate id*  as explained in the https://developer.gocardless.com/direct-debit/taking-a-one-off-payment[Gocardless documentation].
  
  === Creating the GoCardless Plugin
  
  