Skip to content

Commit 2bea148

Browse files
committed
Minor improvements
1 parent 8520ee4 commit 2bea148

File tree

1 file changed

+28
-55
lines changed

1 file changed

+28
-55
lines changed

userguide/tutorials/braintree-plugin.adoc

Lines changed: 28 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ The https://github.com/killbill/killbill-braintree[Braintree Plugin] is a Kill B
55
== Prerequisites
66

77
* Ensure that you have Kill Bill, Kaui, and the database set up as explained in the https://docs.killbill.io/latest/getting_started.html[__Getting Started Guide__].
8-
* Ensure that you have https://curl.haxx.se/[_cURL_] installed. If you are on Windows, we recommend that you use https://git-scm.com/download/win[_Git Bash_] to run the `cURL` commands.
8+
* Ensure that you have https://curl.se/[_cURL_] installed. If you are on Windows, we recommend that you use https://git-scm.com/download/win[_Git Bash_] to run the `cURL` commands.
99
* Ensure that you have a Braintree account. A Braintree sandbox account may be used for testing purposes. You can sign up for a free account at https://www.braintreepayments.com/sandbox[https://www.braintreepayments.com/sandbox].
1010

1111
== Overview
@@ -41,11 +41,10 @@ The Braintree plugin requires the following properties:
4141
|===
4242
|Property Name |Description | Required|Default Value
4343
//----------------------
44-
|org.killbill.billing.plugin.braintree.btEnvironment| The Braintree environment to use. |Yes|-|
45-
org.killbill.billing.plugin.braintree.btMerchantId |Unique Braintree merchant identifier that tells the plugin which merchant account to process transactions under. | Yes | -
46-
|org.killbill.billing.plugin.braintree.btPublicKey |The public API key from your Braintree account used to authenticate API calls.| Yes |-
47-
|org.killbill.billing.plugin.braintree.btPrivateKey|The private API key from your Braintree account used alongside the public key to authenticate API calls.|No | DEFAULT
48-
44+
|org.killbill.billing.plugin.braintree.btEnvironment|The Braintree environment to use.|Yes|-
45+
|org.killbill.billing.plugin.braintree.btMerchantId|Unique Braintree merchant identifier that tells the plugin which merchant account to process transactions under.|Yes|-
46+
|org.killbill.billing.plugin.braintree.btPublicKey|The public API key from your Braintree account used to authenticate API calls.|Yes|-
47+
|org.killbill.billing.plugin.braintree.btPrivateKey|The private API key from your Braintree account used alongside the public key to authenticate API calls.|Yes|-
4948
|===
5049
5150
These properties can be configured globally via the https://docs.killbill.io/latest/userguide_configuration.html#global_configuration_properties[Kill Bill Configuration File] or on a per-tenant basis via the https://apidocs.killbill.io/tenant#add-a-per-tenant-configuration-for-a-plugin[Add a per-tenant configuration for a plugin] endpoint. For example, to configure these properties for the `bob/lazar` tenant, you can use the following curl:
@@ -66,9 +65,11 @@ org.killbill.billing.plugin.braintree.btPrivateKey=xxx' \
6665
http://127.0.0.1:8080/1.0/kb/tenants/uploadPluginConfig/killbill-braintree
6766
----
6867
68+
Expected result: HTTP `201`/`204` and no validation errors in the response.
69+
6970
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.
7071
71-
// == Kaui Integration TBB
72+
// == Kaui Integration TBD
7273
7374
[[aviate_integration]]
7475
== Aviate Integration
@@ -85,20 +86,21 @@ You can use the https://aviate.killbill.io/home[Aviate UI] to install/configure
8586
++++
8687
8788
89+
[[testing_the_plugin]]
8890
== Testing the Plugin
8991
9092
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.
9193
9294
You can follow the steps given below to test the plugin:
9395
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**).
96+
. Ensure that the plugin is installed and configured as explained above.
9797
98-
3. https://apidocs.killbill.io/account#create-an-account[Create] a Kill Bill account. Save the **accountId** for further use.
98+
. 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**).
9999
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:
100+
. https://apidocs.killbill.io/account#create-an-account[Create] a Kill Bill account. Save the **accountId** for further use.
101101
102+
. 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:
103+
+
102104
[source, bash]
103105
----
104106
curl -v \
@@ -125,19 +127,21 @@ curl -v \
125127
}' \
126128
"http://127.0.0.1:8080/1.0/kb/accounts/<ACCOUNT_ID>/paymentMethods?isDefault=true"
127129
----
130+
+
131+
Expected result: HTTP `201` and a response containing a `paymentMethodId`.
128132
129-
5. Create an https://apidocs.killbill.io/invoice#create-external-charge-s[external charge] on the account.
133+
. Create an https://apidocs.killbill.io/invoice#create-external-charge-s[external charge] on the account.
130134
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).
135+
. 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 method).
132136
133-
## Integration
137+
== Integration
134138
135-
In order to use the Braintree plugin, follow the steps given below:
139+
In order to use the Braintree plugin in your application, follow the steps given below:
136140
137-
1. Ensure that the plugin is installed and configured as explained above.
138-
139-
2. Invoke the `BraintreeTokenServlet` to obtain a token:
141+
. Ensure that the plugin is installed and configured as explained above.
140142
143+
. Invoke the `BraintreeTokenServlet` to obtain a token:
144+
+
141145
[source, bash]
142146
----
143147
curl -v \
@@ -151,44 +155,13 @@ curl -v \
151155
-H "X-Killbill-Comment: demo" \
152156
"http://localhost:8080/plugins/killbill-braintree/clientToken"
153157
----
158+
+
159+
Expected result: HTTP `200` and a client token payload.
154160
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**).
161+
. 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.
158162
159-
5. https://apidocs.killbill.io/account#create-an-account[Create] a Kill Bill account. Save the **accountId** for further use.
163+
. Complete steps 2-4 from <<testing_the_plugin, Testing the Plugin>> to create a Braintree customer, create a Kill Bill account, and add a Kill Bill payment method with the generated nonce and Braintree customer ID.
160164
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.
165+
. Use the `paymentMethodId` to charge the customer as required.
191166
192167
A full end-to-end integration demo that demonstrates Braintree integration is available https://github.com/killbill/killbill-braintree-demo[here].
193-
194-

0 commit comments

Comments
 (0)