anchor.diff:  [[payment_plugin_status]]
   == Payment Plugin Status
   
  -https://github.com/killbill/killbill-api/blob/4ae1c343a593de937415e21feecb9f5405037fa3/src/main/java/org/killbill/billing/payment/plugin/api/PaymentPluginStatus.java[_PaymentPluginStatus_] indicates the status of executing a plugin method. It is returned as part of the <<PaymentTransactionInfoPlugin, "PaymentTransactionInfoPlugin">> object returned by plugin methods. It is used by Kill Bill to compute the https://github.com/killbill/killbill-api/blob/master/src/main/java/org/killbill/billing/payment/api/TransactionStatus.java[_payment transaction status_].  The following table elaborates how the status should be populated and the `TransactionStatus` that the `PaymentPluginStatus` translates to:
  +https://github.com/killbill/killbill-api/blob/4ae1c343a593de937415e21feecb9f5405037fa3/src/main/java/org/killbill/billing/payment/plugin/api/PaymentPluginStatus.java[_PaymentPluginStatus_] indicates the status of executing a plugin method. It can be returned via the `PaymentTransactionInfoPlugin#getStatus` method. It is used by Kill Bill to compute the https://github.com/killbill/killbill-api/blob/master/src/main/java/org/killbill/billing/payment/api/TransactionStatus.java[_TransactionStatus_].  The following table elaborates how the status should be populated and the `TransactionStatus` that the `PaymentPluginStatus` translates to:
   
   |===
  -|Plugin Status | Status Description | Transaction Status
  +|*Plugin Status* | *Status Description* | *Transaction Status*
   
   |PROCESSED
   |Indicates that the payment is successful
  
positive.code: 
  === What if my payment gateway processes a smaller amount
  
  Some payment gateways may sometimes charge a smaller amount than what is passed to it by a plugin method like <<purchase_payment, "purchasePayment">>. In such cases, the plugin should let Kill Bill know so that Kill Bill can update the invoice/account balance accordingly. 
  For this, the plugin needs to set the actual amount processed by the payment gateway in the <<PaymentTransactionInfoPlugin, "PaymentTransactionInfoPlugin">> object returned by the plugin method. In other words, the `PaymentTransactionInfoPlugin#getAmount` method should be implemented to return the actual processed amount. Kill Bill then takes care of the rest by updating its database accordingly. 
  
  === What should I do if my payment gateway processes payments offline or processes payments after a delay
  
  
negative.code: 
  * Finally, the `client.payments().create()` is invoked with the `idempotencyKey`, `amount` and `currency` values. This returns a `Payment` object which contains a `paymentId`. Additionally, the `kbPaymentId` and `kbTransactionId` are sent as *metadata* to GoCardless in this call. GoCardless *metadata* allows an application to send custom key value pairs to GoCardless. These can then be retrieved later on as required.  In our case, the `kbPaymentId` and `kbTransactionId` are required retrieving the payment information as explained in the <<getPaymentInfo, "getPaymentInfo">> section. 
  
  * The `purchasePayment` method returns a `PaymentTransactionInfoPlugin`  object.  We have already created a <<GoCardlessPaymentTransactionInfoPlugin, "GoCardlessPaymentTransactionInfoPlugin">> class above.
  
  * If the payment is successful, the `GoCardlessPaymentTransactionInfoPlugin` object is created with the following values:
  
  