Skip to content

Commit b62bcc7

Browse files
author
Wilberforce Uwadiegwu
authored
Update README.md
1 parent 3fbf5bd commit b62bcc7

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ import 'package:flutter_paystack/flutter_paystack.dart';
2424
2525
class _PaymentPageState extends State<PaymentPage> {
2626
var publicKey = '[YOUR_PAYSTACK_PUBLIC_KEY]';
27+
final plugin = PaystackPlugin();
2728
2829
@override
2930
void initState() {
30-
PaystackPlugin.initialize(
31-
publicKey: publicKey);
31+
plugin.initialize(publicKey: publicKey);
3232
}
3333
}
3434
```
@@ -57,7 +57,7 @@ There are two ways of making payment with the plugin.
5757
..reference = _getReference()
5858
// or ..accessCode = _getAccessCodeFrmInitialization()
5959
..email = 'customer@email.com';
60-
CheckoutResponse response = await PaystackPlugin.checkout(
60+
CheckoutResponse response = await plugin.checkout(
6161
context context,
6262
method: CheckoutMethod.card, // Defaults to CheckoutMethod.selectable
6363
charge: charge,
@@ -67,11 +67,11 @@ There are two ways of making payment with the plugin.
6767
Please, note that an `accessCode` is required if the method is
6868
`CheckoutMethod.bank` or `CheckoutMethod.selectable`.
6969

70-
`PaystackPlugin.checkout()` returns the state and details of the
70+
`plugin.checkout()` returns the state and details of the
7171
payment in an instance of `CheckoutResponse` .
7272

7373

74-
It is recommended that when `PaystackPlugin.checkout()` returns, the
74+
It is recommended that when `plugin.checkout()` returns, the
7575
payment should be
7676
[verified](https://developers.paystack.co/v2.0/reference#verify-transaction)
7777
on your backend.
@@ -86,7 +86,7 @@ You can choose to initialize the payment locally or via your backend.
8686
on your backend.
8787

8888
1.b If everything goes well, the initialization request returns a response with an `access_code`.
89-
You can then create a `Charge` object with the access code and card details. The `charge` is in turn passed to the ` PaystackPlugin.chargeCard()` function for payment:
89+
You can then create a `Charge` object with the access code and card details. The `charge` is in turn passed to the `plugin.chargeCard()` function for payment:
9090

9191
```dart
9292
PaymentCard _getCardFromUI() {
@@ -104,7 +104,7 @@ You can then create a `Charge` object with the access code and card details. The
104104
..accessCode = accessCode
105105
..card = _getCardFromUI();
106106
107-
final response = await PaystackPlugin.chargeCard(context, charge: charge);
107+
final response = await plugin.chargeCard(context, charge: charge);
108108
// Use the response
109109
}
110110
```
@@ -115,7 +115,7 @@ for more information.
115115

116116

117117
#### 2. Initialize Locally
118-
Just send the payment details to `PaystackPlugin.chargeCard`
118+
Just send the payment details to `plugin.chargeCard`
119119
```dart
120120
// Set transaction params directly in app (note that these params
121121
// are only used if an access_code is not set. In debug mode,

0 commit comments

Comments
 (0)