@@ -60,14 +60,10 @@ override fun onCreate(savedInstanceState: Bundle?) {
6060
6161
6262 // initialize Thepeer SDK
63- val thepeer = Thepeer .Builder (
64- activity = this ,
65- amount = BigDecimal (10000.00 ),
66- currency = " NGN" ,
67- userReference = getString(R .string.user_reference),
68- resultListener = resultListener
69- ).setMeta(mapOf (" remark" to " Enjoy" )).build()
70-
63+ val thepeer = Thepeer .Initiate (
64+ activity = this ,
65+ userReference = " YOUR _USER_REFERENCE" ,
66+ resultListener = resultListener).build()
7167 }
7268
7369```
8379 setContentView(R . layout. activity_main);
8480
8581 // initialize Thepeer SDK
86- Thepeer thepeer = new Thepeer .Builder (
87- this ,
88- new BigDecimal (" 1000.00" ),
89- " NGN" ,
82+ Thepeer thepeer = new Thepeer .Initiate (
9083 getResources(). getString(R . string. user_reference),
84+ activity,
9185 new ThepeerResultListener ())
9286
9387 }
88+
9489```
90+ | Parameter name | Description | Required |
91+ | ------------------------ | --------------------------------------| --------------------------------------|
92+ | ` userReference ` | The user reference returned by Thepeer API when a user has been indexed | ` true ` |
93+
94+ ## Configuration
95+ Every request will require this configuration to initiate a transaction.
9596
97+ ```
98+ val config = ThepeerConfig(amount = BigDecimal(100000), currency = "NGN", meta = mapOf())
99+
100+ ```
96101| Parameter name | Description | Required |
97102| ------------------------ | --------------------------------------| --------------------------------------|
98103| ` amount ` | The amount you intend to send and must be pass as an integer in kobo | ` true ` |
99104| ` currency ` | Currency which can be ` "NGN" ` or ` "USD" ` | ` true ` |
100- | ` userReference ` | The user reference returned by Thepeer API when a user has been indexed | ` true ` |
101105| ` meta ` | This object should contain additional/optional attributes you would like to have on your transaction response | ` false ` |
102106
103107## Send
@@ -107,16 +111,16 @@ Initiate the send request by calling the below function
107111KOTLIN
108112
109113``` kotlin
110-
111- thepeer.send()
114+ val config = ThepeerConfig (amount = BigDecimal ( 100000 ), currency = " NGN " , meta = mapOf ())
115+ thepeer.send(config = config )
112116
113117```
114118
115119JAVA
116120
117121``` java
118122
119- thepeer. send();
123+ thepeer. send(config );
120124
121125```
122126
@@ -128,15 +132,16 @@ KOTLIN
128132
129133``` kotlin
130134
131- thepeer.checkout(email: String )
135+ val config = ThepeerConfig (amount = BigDecimal (100000 ), currency = " NGN" , meta = mapOf ())
136+ thepeer.checkout(
" [email protected] " , config
= config)
132137
133138```
134139
135140JAVA
136141
137142``` java
138143
139- thepeer. checkout(String email);
144+ thepeer. checkout(" email@gmail.com " , config );
140145
141146```
142147
@@ -147,16 +152,16 @@ Initiate the Direct Charge request by calling the below function
147152KOTLIN
148153
149154``` kotlin
150-
151- thepeer.directCharge()
155+ val config = ThepeerConfig (amount = BigDecimal ( 100000 ), currency = " NGN " , meta = mapOf ())
156+ thepeer.directCharge(config )
152157
153158```
154159
155160JAVA
156161
157162``` java
158163
159- thepeer. directCharge();
164+ thepeer. directCharge(config );
160165
161166```
162167
@@ -168,9 +173,9 @@ KOTLIN
168173
169174``` Kotlin
170175private val resultListener = object : ThepeerResultListener {
171- override fun onSuccess (transaction : ThepeerTransaction ) {
176+ override fun onSuccess (response : String ) {
172177 // Transaction Successful
173- Log .v(TAG , transaction.toString() )
178+ Log .v(TAG ,response )
174179
175180 }
176181
195200 new ThepeerResultListener () {
196201
197202 @Override
198- public void onSuccess (@NonNull ThepeerTransaction transaction ) {
203+ public void onSuccess (@NonNull String transaction ) {
199204 ((TextView ) findViewById(R . id. resultText)). setText(transaction. toString());
200205 }
201206
@@ -212,6 +217,51 @@ JAVA
212217 }
213218
214219
220+ ```
221+ ## Response structure
222+ ``` JSON
223+ {
224+ "event" : " send.success" ,
225+ "type" : " send.success" ,
226+ "data" : {
227+ "id" : " 744bdf8f-17a6-46ae-bda1-b348c6d22f89" ,
228+ "amount" : 100000 ,
229+ "channel" : " send" ,
230+ "refund" : false ,
231+ "checkout" : null ,
232+ "user" : {
233+ "reference" : " 73f03de5-1043-4ad1-bc2e-aa4d94ebee4f" ,
234+ "name" : " Doreen Okoh" ,
235+ "identifier" : " doreen" ,
236+ "identifier_type" : " username" ,
237+ 238+ "created_at" : " 2021-04-19T19:50:26.000000Z" ,
239+ "updated_at" : " 2022-02-14T22:58:25.000000Z"
240+ },
241+ "charge" : 1000 ,
242+ "currency" : " NGN" ,
243+ "mode" : " debit" ,
244+ "reference" : " d34dfaebd727e40a8f436a4b43acbf73" ,
245+ "remark" : " food" ,
246+ "status" : " success" ,
247+ "type" : " peer" ,
248+ "meta" : null ,
249+ "peer" : {
250+ "business" : {
251+ "name" : " Cash App" ,
252+ "logo" : " https://palaciodepeer.s3.us-east-2.amazonaws.com/business_logos/UJimBqYOu7KQIM3DwCWOuKjkDbBbVLYRuYRTgxKh.png" ,
253+ "logo_colour" : " #77cc33"
254+ },
255+ "user" : {
256+ "name" : " Trojan Okoh" ,
257+ "identifier" : " trojan" ,
258+ "identifier_type" : " username"
259+ }
260+ },
261+ "updated_at" : " 2023-05-25T12:32:03.000000Z" ,
262+ "created_at" : " 2023-05-25T12:32:03.000000Z"
263+ }
264+ }
215265```
216266## Support
217267
0 commit comments