Skip to content

matias-aguero-hs/killbill-dwolla-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

killbill-dwolla-plugin

Plugin to use Dwolla as a gateway.

Release builds are available on Maven Central with coordinates org.kill-bill.billing.plugin.java:dwolla-plugin.

Kill Bill compatibility

Plugin version Kill Bill version
0.1.y 0.17.z

Requirements

The plugin needs a database. The latest version of the schema can be found here.

Merchants need to create a Dwolla application. A Webhook Subscription is needed to receive Dwolla notifications.

Configuration

The following properties are required:

  • org.killbill.billing.plugin.dwolla.baseUrl : REST Payment service url (i.e. https://api-uat.dwolla.com/ or https://api.dwolla.com/)
  • org.killbill.billing.plugin.dwolla.baseOAuthUrl : REST Auth service url (i.e. https://uat.dwolla.com/oauth/v2 or https://dwolla.com/oauth/v2)
  • org.killbill.billing.plugin.dwolla.scopes : The application scopes (i.e. Send|AccountInfoFull|Funding)
  • org.killbill.billing.plugin.dwolla.clientId : Your merchant application key.
  • org.killbill.billing.plugin.dwolla.clientSecret : Your merchant application secret.

These properties can be specified globally via System Properties or on a per tenant basis:

curl -v \
     -X POST \
     -u admin:password \
     -H 'X-Killbill-ApiKey: bob' \
     -H 'X-Killbill-ApiSecret: lazar' \
     -H 'X-Killbill-CreatedBy: admin' \
     -H 'Content-Type: text/plain' \
     -d 'org.killbill.billing.plugin.dwolla.baseUrl=WWW
     org.killbill.billing.plugin.dwolla.baseOAuthUrl=XXX
     org.killbill.billing.plugin.dwolla.scopes=YYY
     org.killbill.billing.plugin.dwolla.clientId=ZZZ'
     org.killbill.billing.plugin.dwolla.clientSecret=ZZZ' \
     http://127.0.0.1:8080/1.0/kb/tenants/uploadPluginConfig/killbill-dwolla

Kill Bill

Usage

A full end-to-end integration demo is also available here.

Bank account

Add a payment method:

curl -v \
     -u admin:password \
     -H "X-Killbill-ApiKey: bob" \
     -H "X-Killbill-ApiSecret: lazar" \
     -H "Content-Type: application/json" \
     -H "X-Killbill-CreatedBy: demo" \
     -X POST \
     --data-binary '{
       "pluginName": "killbill-dwolla",
       "pluginInfo": {
         "properties": [
           {
             "key": "fundingSource",
             "value": "9ece9660-aa34-41eb-80d7-0125d53b45e8"
           },
           {
             "key": "customerId",
             "value": "ca32853c-48fa-40be-ae75-77b37504581b"
           }
         ]
       }
     }' \
     "http://127.0.0.1:8080/1.0/kb/accounts/<ACCOUNT_ID>/paymentMethods?isDefault=true"

Notes:

To trigger a payment:

curl -v \
     -u admin:password \
     -H "X-Killbill-ApiKey: bob" \
     -H "X-Killbill-ApiSecret: lazar" \
     -H "Content-Type: application/json" \
     -H "X-Killbill-CreatedBy: demo" \
     -X POST \
     --data-binary '{"transactionType":"PURCHASE","amount":"5","currency":"EUR","transactionExternalKey":"INV-'$(uuidgen)'-PURCHASE"}' \
    "http://127.0.0.1:8080/1.0/kb/accounts/<ACCOUNT_ID>/payments"

Notes:

  • Make sure to replace ACCOUNT_ID with the id of the Kill Bill account

At this point, the payment will be in PENDING state, until we receive a notification from Dwolla. You can verify the state of the transaction by listing the payments:

curl -v \
     -u admin:password \
     -H "X-Killbill-ApiKey: bob" \
     -H "X-Killbill-ApiSecret: lazar" \
     -H "Content-Type: application/json" \
     -H "X-Killbill-CreatedBy: demo" \
    "http://127.0.0.1:8080/1.0/kb/accounts/<ACCOUNT_ID>/payments?withPluginInfo=true"

You can simulate a notification from Dwolla as follows:

curl -v \
     -u admin:password \
     -H "X-Killbill-ApiKey: bob" \
     -H "X-Killbill-ApiSecret: lazar" \
     -H "Content-Type: application/json" \
     -H "X-Killbill-CreatedBy: demo" \
     -X POST \
     --data-binary '
     {
      "id": "80d8ff7d-7e5a-4975-ade8-9e97306d6c16",
      "topic": "customer_transfer_completed",
      "_links": {
        "self": {
          "href": "https://api-uat.dwolla.com/events/80d8ff7d-7e5a-4975-ade8-9e97306d6c16"
        },
        "account": {
          "href": "https://api-uat.dwolla.com/accounts/b3153e29-b25a-4ccd-9c1a-5b05b606e50c"
        },
        "resource": {
          "href": "https://api-uat.dwolla.com/transfers/7c8e7484-2184-e611-80e8-0aa34a9b2388"
        },
        "customer": {
          "href": "https://api-uat.dwolla.com/customers/b3153e29-b25a-4ccd-9c1a-5b05b606e50c"
        }
      }
    }' \
    "http://127.0.0.1:8080/1.0/kb/paymentGateways/notification/killbill-dwolla"

Notes:

  • Make sure to replace resource.href with the Dwolla transfer id reference of your payment (see the dwolla_responses table)
  • If topic is customer_transfer_completed, the payment transaction state will be SUCCESS and the payment state PROCESSED
  • If topic is customer_transfer_failed or customer_transfer_canceled, the payment transaction state will be PAYMENT_FAILURE and the payment state ERROR

About

Plugin to use Dwolla as a gateway

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%