@paystack/inline-js 2.25.0-dev.9 → 2.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -108,7 +108,7 @@ paystackInstance.newTransaction({
108
108
  | id | Autogenerated id for the Popup instance | `String` |
109
109
  | backgroundDiv | A placeholder div that shows a loading indicator when the main checkout iFrame is loading | `domElement` |
110
110
  | checkoutIframe | The iframe where the payment happens | `domElement` |
111
- | paymentRequestContainer | The div container for wallet payment buttons i.e Apple Pay and Google Pay | `domElement` \| `null` |
111
+ | paymentRequestContainer | The div container for wallet payment buttons i.e Apple Pay | `domElement` \| `null` |
112
112
 
113
113
  ## Object Methods
114
114
 
@@ -139,7 +139,7 @@ This method starts a new transaction on the checkout form.
139
139
  | lastName | False | `String` | The last name of the customer |
140
140
  | phone | False | `String` | The phone number of the customer |
141
141
  | customerCode | False | `String` | A valid Paystack customer code. If provided, this overrides all the customer information above |
142
- | channels | False | `Array` | An array of payment channels to use. By default, all options available in PaystackPop.CHANNELS are used. `google_pay` has to be passed alongside `card`. On its own the transaction will not initialize |
142
+ | channels | False | `Array` | An array of payment channels to use. By default, all options available in in PaystackPop.CHANNELS are used |
143
143
  | paymentRequest | False | `String` | A valid Paystack payment request id |
144
144
  | paymentPage | False | `String` | A valid Paystack payment page id |
145
145
  | metadata | False | Object | A valid object of extra information that you want to be saved to the transaction. To show this on the dashboard, see [Seeing your metadata on the dashboard](#tip-seeing-your-metadata-on-the-dashboard) |
@@ -318,7 +318,7 @@ try {
318
318
 
319
319
  # PaystackPop.checkout({options})
320
320
 
321
- This method loads a transaction on the checkout form.
321
+ This method loads a transaction on the checkout form but shows a pre checkout modal before loading the form if a wallet payment e.g Apple Pay is supported.
322
322
 
323
323
  ## Configuration Options
324
324
 
@@ -380,7 +380,7 @@ async function checkout(amount) {
380
380
 
381
381
  # PaystackPop.paymentRequest({options})
382
382
 
383
- This method mounts wallet payment buttons e.g Apple Pay, Google Pay on a provided div, and also provides the option to allow a provided button open the checkout form.
383
+ This method mounts a wallet payment button e.g Apple pay on a provided div and also provides the option to allow a provided button open the checkout form.
384
384
 
385
385
  ## General Configuration Options
386
386
 
@@ -390,49 +390,15 @@ All General and Custom configuration options that are accepted by [PaystackPop.n
390
390
 
391
391
  | Option | Required | Type | Description |
392
392
  | ----------------------------- | -------------- | --------------------| ---------------------------------------------------- |
393
- | container | True | `String` | ID of div to mount the payment request buttons |
393
+ | container | True | `String` | ID of div to mount the payment request button |
394
394
  | loadPaystackCheckoutButton | False | `String` | ID of button to open checkout form |
395
- | styles | False | `Object` | Layout and button styling. See [Styling Options](#styling-options) |
396
-
397
- ### Styling Options
398
-
399
- | Option | Type | Default | Description |
400
- | ----------- | ----------------------------- | -------------- | -------------------------------------------------------------------------------------------------------- |
401
- | theme | `'dark'` or `'light'` | `'dark'` | Sets both buttons to their black or white variant |
402
- | orientation | `'horizontal'` or `'vertical'` | `'horizontal'` | Horizontal shares the row equally between the buttons. Vertical stacks them, each at its natural width |
403
- | applePay | `Object` | See below | Apple Pay button styling |
404
- | googlePay | `Object` | See below | Google Pay button styling |
405
-
406
- #### styles.applePay
407
-
408
- | Option | Type | Default |
409
- | ------------ | -------- | --------- |
410
- | width | `String` | `'auto'` |
411
- | height | `String` | `'50px'` |
412
- | borderRadius | `String` | `'3px'` |
413
- | padding | `String` | `'10px'` |
414
- | type | `String` | `'pay'` |
415
- | locale | `String` | `'en'` |
416
-
417
- #### styles.googlePay
418
-
419
- `width` and `height` size the button. Every other key is passed straight through to Google's [`createButton`](https://developers.google.com/pay/api/web/reference/client#createButton), so anything it accepts works here, including overriding the defaults below.
420
-
421
- | Option | Type | Default |
422
- | -------------- | -------- | -------------------- |
423
- | width | `String` | `'auto'` |
424
- | height | `String` | `'50px'` |
425
- | buttonType | `String` | `'pay'` |
426
- | buttonRadius | `Number` | `3` |
427
- | buttonColor | `String` | Follows `styles.theme` |
428
- | buttonSizeMode | `String` | `'fill'` |
429
-
395
+ | styles | False | `Object` | { <br>&nbsp;&nbsp;&nbsp;&nbsp;theme: 'dark' or 'light', <br>&nbsp;&nbsp;&nbsp;&nbsp;applePay: { <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;width: '100%', <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;height: '50px' <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;borderRadius: '3px', <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type: 'plain', <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;locale: 'en' <br>&nbsp;&nbsp;&nbsp;&nbsp;} <br>} |
430
396
 
431
397
  ### Configuration Options for Callbacks
432
-
433
398
  | Event name | Description | Response properties |
434
399
  | ---------------------------- | -------------------------------------------------------- | -----------------------------------|
435
- | onElementsMount | Called once mounting has finished for both wallets | `{ applePay: Boolean, googlePay: Boolean }`, or `null` if mounting failed |
400
+ | onElementsMount | Called when the payment request button has been mounted | `{ applePay: true }` or `null` |
401
+
436
402
 
437
403
  ## Method Response
438
404
 
@@ -440,7 +406,7 @@ This method returns a Promise which resolves to a [PopupTransaction Instance](#t
440
406
 
441
407
  ## For Example
442
408
 
443
- Mount the wallet buttons, and change the text of the button to open the checkout form if either of them appears
409
+ Mount a payment button and change the text of the button to open the checkout form if the apple pay button mounts
444
410
 
445
411
  ```html
446
412
  <div id="payment-request-buttons"></div>
@@ -451,35 +417,28 @@ Mount the wallet buttons, and change the text of the button to open the checkout
451
417
  const paystackPop = new PaystackPop();
452
418
 
453
419
  const onElementsMount = (elements) => {
454
- if (elements && (elements.applePay || elements.googlePay)) {
420
+ if (elements && elements.applePay) {
455
421
  document.querySelector("#pay-button").innerText = "More Payment Options";
456
422
  }
457
423
  }
458
424
 
459
- async function loadPaymentRequestButtons() {
425
+ async function loadApplePayButton() {
460
426
  try {
461
427
  await paystackPop.paymentRequest({
462
428
  key: config.publicLiveKey,
463
429
  email: 'testuser@paystack.com',
464
430
  amount: 10000,
465
431
  currency: "NGN",
466
- // google_pay needs card alongside it to show
467
- channels: ["card", "apple_pay", "google_pay"],
468
432
  container: 'payment-request-buttons',
469
433
  loadPaystackCheckoutButton: 'pay-button',
470
434
  styles: {
471
435
  theme: 'dark',
472
- orientation: 'horizontal',
473
436
  applePay: {
437
+ width: '100%',
474
438
  height: '50px',
475
439
  borderRadius: '3px',
476
440
  type: 'plain',
477
441
  locale: 'en'
478
- },
479
- googlePay: {
480
- height: '50px',
481
- buttonRadius: 3,
482
- buttonType: 'pay'
483
442
  }
484
443
  },
485
444
  onElementsMount,
@@ -489,7 +448,7 @@ async function loadPaymentRequestButtons() {
489
448
  }
490
449
  }
491
450
 
492
- loadPaymentRequestButtons()
451
+ loadApplePayButton()
493
452
  ```
494
453
 
495
454
  ---
@@ -534,4 +493,4 @@ Paystack Inline is designed to support all recent versions of major browsers. Th
534
493
 
535
494
  If you have an issue with Paystack Inline on a specific browser, kindly reach out to us so we can quickly resolve any issues.
536
495
 
537
- * We don't support Opera Mini because Javascript is disabled in it. We support the Opera browser however, except in super saver mode where JS is disabled as well.
496
+ * We don't support Opera Mini because Javascript is disabled in it. We support the Opera browser however, except in super saver mode where JS is disabled as well.