Skip to content

Commit 8520ee4

Browse files
committed
Add sections for plugin testing and integration
1 parent 0faa72f commit 8520ee4

File tree

1 file changed

+109
-3
lines changed

1 file changed

+109
-3
lines changed

userguide/tutorials/braintree-plugin.adoc

Lines changed: 109 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ The https://github.com/killbill/killbill-braintree[Braintree Plugin] is a Kill B
1010

1111
== Overview
1212

13+
The Braintree plugin allows you to process payments via the Braintree payment gateway. You can create a payment method, make a purchase, and view the transaction details in Kaui.
14+
1315
== Plugin Installation
1416

1517
You can install the plugin as explained in the https://docs.killbill.io/latest/plugin_installation#_plugin_installation[Plugin Installation Guide].
@@ -21,7 +23,7 @@ For example, to install the plugin via https://github.com/killbill/killbill-clou
2123
kpm install_java_plugin braintree-plugin --destination=<path_to_install_plugin>
2224
----
2325

24-
You can also install the plugin via the https://aviate.killbill.io/home[Aviate UI] via the "Plugin Marketplace" tab. Refer to the <<aviate_integration, Aviate Integration>> section below for more details.
26+
You can also install the plugin via the https://aviate.killbill.io/home[Aviate UI] "Plugin Marketplace" tab. Refer to the <<aviate_integration, Aviate Integration>> section below for more details.
2527

2628
== Database Configuration
2729

@@ -64,14 +66,14 @@ org.killbill.billing.plugin.braintree.btPrivateKey=xxx' \
6466
http://127.0.0.1:8080/1.0/kb/tenants/uploadPluginConfig/killbill-braintree
6567
----
6668
67-
Alternative, you can also configure these properties via the https://aviate.killbill.io/home[Aviate UI] by navigating to the "Plugin Configuration" tab. Refer to the <<aviate_integration, Aviate Integration>> section below for more details.
69+
Alternatively, you can also configure these properties via the https://aviate.killbill.io/home[Aviate UI] "Plugin Configuration" tab. Refer to the <<aviate_integration, Aviate Integration>> section below for more details.
6870
6971
// == Kaui Integration TBB
7072
7173
[[aviate_integration]]
7274
== Aviate Integration
7375
74-
You can use the https://aviate.killbill.io/home[Aviate UI] to install/configure the plugin. the following demo
76+
You can use the https://aviate.killbill.io/home[Aviate UI] to install/configure the plugin. Refer to the following demo:
7577
7678
++++
7779
<div>
@@ -83,6 +85,110 @@ You can use the https://aviate.killbill.io/home[Aviate UI] to install/configure
8385
++++
8486
8587
88+
== Testing the Plugin
89+
90+
Once the plugin is installed and configured, you can use it to process payments via the Braintree payment gateway. You can create a payment method, make a purchase, and view the transaction details in Kaui.
91+
92+
You can follow the steps given below to test the plugin:
93+
94+
1. Ensure that the plugin is installed and configured as explained above.
95+
96+
2. https://developer.paypal.com/braintree/articles/control-panel/vault/create[Create a customer] in Braintree with https://developer.paypal.com/braintree/docs/reference/general/testing#valid-card-numbers[test card details]. Save the **Customer ID** generated for future reference (it should be something like **620594365**).
97+
98+
3. https://apidocs.killbill.io/account#create-an-account[Create] a Kill Bill account. Save the **accountId** for further use.
99+
100+
4. https://apidocs.killbill.io/account#add-a-payment-method[Create] a payment method in Kill Bill using a https://developer.paypal.com/braintree/docs/reference/general/testing#payment-method-nonces[fake valid nonce] and the braintree customer id as follows:
101+
102+
[source, bash]
103+
----
104+
curl -v \
105+
-u admin:password \
106+
-H "X-Killbill-ApiKey: bob" \
107+
-H "X-Killbill-ApiSecret: lazar" \
108+
-H "Content-Type: application/json" \
109+
-H "X-Killbill-CreatedBy: demo" \
110+
-X POST \
111+
--data-binary '{
112+
"pluginName": "killbill-braintree",
113+
"pluginInfo": {
114+
"properties": [
115+
{
116+
"key": "bt_nonce",
117+
"value": "fake-valid-nonce"
118+
},
119+
{
120+
"key": "bt_customer_id",
121+
"value": "xxx"
122+
}
123+
]
124+
}
125+
}' \
126+
"http://127.0.0.1:8080/1.0/kb/accounts/<ACCOUNT_ID>/paymentMethods?isDefault=true"
127+
----
128+
129+
5. Create an https://apidocs.killbill.io/invoice#create-external-charge-s[external charge] on the account.
130+
131+
6. Use the `paymentMethodId` to https://apidocs.killbill.io/invoice#trigger-an-invoice-run[trigger payment] (required only if the `paymentMethodId` is not set as the default payment).
132+
133+
## Integration
134+
135+
In order to use the Braintree plugin, follow the steps given below:
136+
137+
1. Ensure that the plugin is installed and configured as explained above.
138+
139+
2. Invoke the `BraintreeTokenServlet` to obtain a token:
140+
141+
[source, bash]
142+
----
143+
curl -v \
144+
-u admin:password \
145+
-H "X-Killbill-ApiKey: bob" \
146+
-H "X-Killbill-ApiSecret: lazar" \
147+
-H "Content-Type: application/json" \
148+
-H "Accept: application/json" \
149+
-H "X-Killbill-CreatedBy: demo" \
150+
-H "X-Killbill-Reason: demo" \
151+
-H "X-Killbill-Comment: demo" \
152+
"http://localhost:8080/plugins/killbill-braintree/clientToken"
153+
----
154+
155+
3. Use the https://developer.paypal.com/braintree/docs/start/drop-in[Braintree Drop-in] implementation to gather the customer's payment details and obtain a payment nonce.
156+
157+
4. https://developer.paypal.com/braintree/docs/guides/customers[Create a customer] in Braintree. Save the **Customer ID** generated for future reference (it should be something like **620594365**).
158+
159+
5. https://apidocs.killbill.io/account#create-an-account[Create] a Kill Bill account. Save the **accountId** for further use.
160+
161+
6. https://apidocs.killbill.io/account#add-a-payment-method[Create] a payment method in Kill Bill using the nonce and the braintree customer id as follows:
162+
163+
[source, bash]
164+
----
165+
curl -v \
166+
-u admin:password \
167+
-H "X-Killbill-ApiKey: bob" \
168+
-H "X-Killbill-ApiSecret: lazar" \
169+
-H "Content-Type: application/json" \
170+
-H "X-Killbill-CreatedBy: demo" \
171+
-X POST \
172+
--data-binary '{
173+
"pluginName": "killbill-braintree",
174+
"pluginInfo": {
175+
"properties": [
176+
{
177+
"key": "bt_nonce",
178+
"value": "xxx"
179+
},
180+
{
181+
"key": "bt_customer_id",
182+
"value": "xxx"
183+
}
184+
]
185+
}
186+
}' \
187+
"http://127.0.0.1:8080/1.0/kb/accounts/<ACCOUNT_ID>/paymentMethods?isDefault=true"
188+
----
189+
190+
7. Use the `paymentMethodId` to charge the customer as required.
86191
192+
A full end-to-end integration demo that demonstrates Braintree integration is available https://github.com/killbill/killbill-braintree-demo[here].
87193
88194

0 commit comments

Comments
 (0)