@paystack/inline-js 2.25.0 → 2.26.0-dev.1
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 +55 -14
- package/dist/inline.js +2434 -1
- package/es/inline.js +2429 -1
- package/lib/inline.js +2431 -1
- package/package.json +1 -1
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
|
|
111
|
+
| paymentRequestContainer | The div container for wallet payment buttons i.e Apple Pay and Google 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
|
|
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 |
|
|
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. Wallet payments such as Apple Pay and Google Pay are offered inside the form.
|
|
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
|
|
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.
|
|
384
384
|
|
|
385
385
|
## General Configuration Options
|
|
386
386
|
|
|
@@ -390,15 +390,49 @@ 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
|
|
393
|
+
| container | True | `String` | ID of div to mount the payment request buttons |
|
|
394
394
|
| loadPaystackCheckoutButton | False | `String` | ID of button to open checkout form |
|
|
395
|
-
| styles | False | `Object` |
|
|
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
|
+
|
|
396
430
|
|
|
397
431
|
### Configuration Options for Callbacks
|
|
432
|
+
|
|
398
433
|
| Event name | Description | Response properties |
|
|
399
434
|
| ---------------------------- | -------------------------------------------------------- | -----------------------------------|
|
|
400
|
-
| onElementsMount | Called
|
|
401
|
-
|
|
435
|
+
| onElementsMount | Called once mounting has finished for both wallets | `{ applePay: Boolean, googlePay: Boolean }`, or `null` if mounting failed |
|
|
402
436
|
|
|
403
437
|
## Method Response
|
|
404
438
|
|
|
@@ -406,7 +440,7 @@ This method returns a Promise which resolves to a [PopupTransaction Instance](#t
|
|
|
406
440
|
|
|
407
441
|
## For Example
|
|
408
442
|
|
|
409
|
-
Mount
|
|
443
|
+
Mount the wallet buttons, and change the text of the button to open the checkout form if either of them appears
|
|
410
444
|
|
|
411
445
|
```html
|
|
412
446
|
<div id="payment-request-buttons"></div>
|
|
@@ -417,28 +451,35 @@ Mount a payment button and change the text of the button to open the checkout fo
|
|
|
417
451
|
const paystackPop = new PaystackPop();
|
|
418
452
|
|
|
419
453
|
const onElementsMount = (elements) => {
|
|
420
|
-
if (elements && elements.applePay) {
|
|
454
|
+
if (elements && (elements.applePay || elements.googlePay)) {
|
|
421
455
|
document.querySelector("#pay-button").innerText = "More Payment Options";
|
|
422
456
|
}
|
|
423
457
|
}
|
|
424
458
|
|
|
425
|
-
async function
|
|
459
|
+
async function loadPaymentRequestButtons() {
|
|
426
460
|
try {
|
|
427
461
|
await paystackPop.paymentRequest({
|
|
428
462
|
key: config.publicLiveKey,
|
|
429
463
|
email: 'testuser@paystack.com',
|
|
430
464
|
amount: 10000,
|
|
431
465
|
currency: "NGN",
|
|
466
|
+
// google_pay needs card alongside it to show
|
|
467
|
+
channels: ["card", "apple_pay", "google_pay"],
|
|
432
468
|
container: 'payment-request-buttons',
|
|
433
469
|
loadPaystackCheckoutButton: 'pay-button',
|
|
434
470
|
styles: {
|
|
435
471
|
theme: 'dark',
|
|
472
|
+
orientation: 'horizontal',
|
|
436
473
|
applePay: {
|
|
437
|
-
width: '100%',
|
|
438
474
|
height: '50px',
|
|
439
475
|
borderRadius: '3px',
|
|
440
476
|
type: 'plain',
|
|
441
477
|
locale: 'en'
|
|
478
|
+
},
|
|
479
|
+
googlePay: {
|
|
480
|
+
height: '50px',
|
|
481
|
+
buttonRadius: 3,
|
|
482
|
+
buttonType: 'pay'
|
|
442
483
|
}
|
|
443
484
|
},
|
|
444
485
|
onElementsMount,
|
|
@@ -448,7 +489,7 @@ async function loadApplePayButton() {
|
|
|
448
489
|
}
|
|
449
490
|
}
|
|
450
491
|
|
|
451
|
-
|
|
492
|
+
loadPaymentRequestButtons()
|
|
452
493
|
```
|
|
453
494
|
|
|
454
495
|
---
|
|
@@ -493,4 +534,4 @@ Paystack Inline is designed to support all recent versions of major browsers. Th
|
|
|
493
534
|
|
|
494
535
|
If you have an issue with Paystack Inline on a specific browser, kindly reach out to us so we can quickly resolve any issues.
|
|
495
536
|
|
|
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.
|
|
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.
|