@@ -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
@@ -108,15 +112,16 @@ KOTLIN
108112
109113``` kotlin
110114
111- thepeer.send()
115+ val config = ThepeerConfig (amount = BigDecimal (100000 ), currency = " NGN" , meta = mapOf ())
116+ thepeer.send(config = config)
112117
113118```
114119
115120JAVA
116121
117122``` java
118123
119- thepeer. send();
124+ thepeer. send(config );
120125
121126```
122127
@@ -128,15 +133,16 @@ KOTLIN
128133
129134``` kotlin
130135
131- thepeer.checkout(email: String )
136+ val config = ThepeerConfig (amount = BigDecimal (100000 ), currency = " NGN" , meta = mapOf ())
137+ thepeer.checkout(
" [email protected] " , config
= config)
132138
133139```
134140
135141JAVA
136142
137143``` java
138144
139- thepeer. checkout(String email);
145+ thepeer. checkout(" email@gmail.com " , config );
140146
141147```
142148
@@ -147,16 +153,16 @@ Initiate the Direct Charge request by calling the below function
147153KOTLIN
148154
149155``` kotlin
150-
151- thepeer.directCharge()
156+ val config = ThepeerConfig (amount = BigDecimal ( 100000 ), currency = " NGN " , meta = mapOf ())
157+ thepeer.directCharge(config )
152158
153159```
154160
155161JAVA
156162
157163``` java
158164
159- thepeer. directCharge();
165+ thepeer. directCharge(config );
160166
161167```
162168
@@ -168,9 +174,9 @@ KOTLIN
168174
169175``` Kotlin
170176private val resultListener = object : ThepeerResultListener {
171- override fun onSuccess (transaction : ThepeerTransaction ) {
177+ override fun onSuccess (response : String ) {
172178 // Transaction Successful
173- Log .v(TAG , transaction.toString() )
179+ Log .v(TAG ,response )
174180
175181 }
176182
195201 new ThepeerResultListener () {
196202
197203 @Override
198- public void onSuccess (@NonNull ThepeerTransaction transaction ) {
204+ public void onSuccess (@NonNull String transaction ) {
199205 ((TextView ) findViewById(R . id. resultText)). setText(transaction. toString());
200206 }
201207
@@ -212,6 +218,51 @@ JAVA
212218 }
213219
214220
221+ ```
222+ ## Response structure
223+ ``` JSON
224+ {
225+ "event" : " send.success" ,
226+ "type" : " send.success" ,
227+ "data" : {
228+ "id" : " 744bdf8f-17a6-46ae-bda1-b348c6d22f89" ,
229+ "amount" : 100000 ,
230+ "channel" : " send" ,
231+ "refund" : false ,
232+ "checkout" : null ,
233+ "user" : {
234+ "reference" : " 73f03de5-1043-4ad1-bc2e-aa4d94ebee4f" ,
235+ "name" : " Doreen Okoh" ,
236+ "identifier" : " doreen" ,
237+ "identifier_type" : " username" ,
238+ 239+ "created_at" : " 2021-04-19T19:50:26.000000Z" ,
240+ "updated_at" : " 2022-02-14T22:58:25.000000Z"
241+ },
242+ "charge" : 1000 ,
243+ "currency" : " NGN" ,
244+ "mode" : " debit" ,
245+ "reference" : " d34dfaebd727e40a8f436a4b43acbf73" ,
246+ "remark" : " food" ,
247+ "status" : " success" ,
248+ "type" : " peer" ,
249+ "meta" : null ,
250+ "peer" : {
251+ "business" : {
252+ "name" : " Cash App" ,
253+ "logo" : " https://palaciodepeer.s3.us-east-2.amazonaws.com/business_logos/UJimBqYOu7KQIM3DwCWOuKjkDbBbVLYRuYRTgxKh.png" ,
254+ "logo_colour" : " #77cc33"
255+ },
256+ "user" : {
257+ "name" : " Trojan Okoh" ,
258+ "identifier" : " trojan" ,
259+ "identifier_type" : " username"
260+ }
261+ },
262+ "updated_at" : " 2023-05-25T12:32:03.000000Z" ,
263+ "created_at" : " 2023-05-25T12:32:03.000000Z"
264+ }
265+ }
215266```
216267## Support
217268
0 commit comments