mainstack-payments 1.0.32 → 1.0.34
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 +48 -8
- package/build/mainstack-payments.js +5840 -5797
- package/build/src/api/index.d.ts +3 -0
- package/build/src/components/ContactAction.d.ts +14 -0
- package/build/src/hooks/useApi.d.ts +1 -0
- package/build/src/types/index.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -83,9 +83,13 @@ The config object should contain the following properties:
|
|
|
83
83
|
|
|
84
84
|
* `mainstackProductId`: A User's ID for a particular product, e.g store\_id, bookings\_id etc.
|
|
85
85
|
|
|
86
|
-
* `STRIPE_SECRET_KEY
|
|
86
|
+
* `STRIPE_SECRET_KEY*`: Stripe secret key for stripe payments, usually stored in an env.
|
|
87
87
|
|
|
88
|
-
* `STRIPE_SECRET_KEY_GBP
|
|
88
|
+
* `STRIPE_SECRET_KEY_GBP*`: Stripe secret key for stripe payments in GBP, usually stored in an env.
|
|
89
|
+
|
|
90
|
+
* `STRIPE_SECRET_KEY_CAD*`: Stripe secret key for stripe payments in CAD, usually stored in an env.
|
|
91
|
+
|
|
92
|
+
* `merchantBearsTax` : This is a boolean to indicate if the merchant bears tax charges or not.
|
|
89
93
|
|
|
90
94
|
* `applyTrancheFee`: Boolean that is passed to the transaction fees endpoint and dictates if a tranch fee should be applied for transaction fees.This is specifically for Pay In Tranches payments. Default is false.
|
|
91
95
|
|
|
@@ -103,21 +107,33 @@ The config object should contain the following properties:
|
|
|
103
107
|
|
|
104
108
|
* `paymentModel`: string that specifies if the payment model is 'ips' or 'default'
|
|
105
109
|
|
|
110
|
+
* `isFreeTrial`: Boolean to specify if a subscription payment is a free trial.
|
|
111
|
+
|
|
112
|
+
* `merchantCountry`: A string that returns the country of the merchant.
|
|
113
|
+
|
|
114
|
+
* `isPowerUser`: A Boolean to specify if a merchant is a power user.
|
|
115
|
+
|
|
116
|
+
* `itemsList`: This is an Array of objects used when multiple products are being purchased at once. e.g: event tickets or cart products. See object values [here](https://app.joggr.io/app/documents/b5b2ff2f-550d-4057-bed3-441870eaaf5d/edit#items-list)
|
|
117
|
+
|
|
106
118
|
#### metadata
|
|
107
119
|
|
|
108
120
|
The `metadata` object should contain the following properties:
|
|
109
121
|
|
|
110
|
-
*
|
|
122
|
+
* `productName`: The name of the product being paid for.
|
|
123
|
+
|
|
124
|
+
* `productImage`: The image url of the product.
|
|
125
|
+
|
|
126
|
+
* `type`: The type of product being paid for.
|
|
111
127
|
|
|
112
|
-
*
|
|
128
|
+
* `account_id`: The account ID of the user making the payment
|
|
113
129
|
|
|
114
|
-
*
|
|
130
|
+
* `user_id`: The user ID of the user making the payment
|
|
115
131
|
|
|
116
|
-
*
|
|
132
|
+
* `product_id`: The product ID of the product being paid for
|
|
117
133
|
|
|
118
|
-
*
|
|
134
|
+
* `mainstack_product_type`: What Category of Mainstack Product is being paid for, accepted values are 'store', 'editor', 'bookings', 'mediakit', 'invoicing', 'hosted\_courses'
|
|
119
135
|
|
|
120
|
-
*
|
|
136
|
+
* `quantity`: The quantity of a product being purchased.
|
|
121
137
|
|
|
122
138
|
* `[key:string]` : Any other key-value pair that you want to add to the metadata object
|
|
123
139
|
|
|
@@ -145,6 +161,20 @@ The `metadata` object should contain the following properties:
|
|
|
145
161
|
|
|
146
162
|
* `phone`: For the PhoneNumber input. Default is false.
|
|
147
163
|
|
|
164
|
+
* `summaryWidth`: This takes a width in pixels to set a fixed width for the summary section.
|
|
165
|
+
|
|
166
|
+
#### itemsList
|
|
167
|
+
|
|
168
|
+
* `name*`: String for the name of the product.
|
|
169
|
+
|
|
170
|
+
* `price*`: Type of Number for the product price.
|
|
171
|
+
|
|
172
|
+
* `currency*`: Currency code of the price.
|
|
173
|
+
|
|
174
|
+
* `quantity*` : The amount of each product being purchased.
|
|
175
|
+
|
|
176
|
+
* `image`: Optional image url for each product.
|
|
177
|
+
|
|
148
178
|
The `paymentRedirectUrl` is the URL to redirect to after a successful payment with Paystack, Startbutton or Stripe UK. This page will be created by you and should contain the following code:
|
|
149
179
|
|
|
150
180
|
```typescript
|
|
@@ -177,12 +207,22 @@ Other Props that can be passed to the `MainstackPayments` component are:
|
|
|
177
207
|
|
|
178
208
|
* `defaultFormValues`: This is an object with `fullname` and `email` keys. Their values are passed to their respective inputs as default values.
|
|
179
209
|
|
|
210
|
+
* `preCheckoutBanner`: This takes a ReactNode to add a banner to the top of the checkout page.
|
|
211
|
+
|
|
212
|
+
* `height`: this takes a value in pixels to set a fixed height for the checkout library component.
|
|
213
|
+
|
|
214
|
+
* `FooterElement` : This takes a ReactNode to display a component at the bottom of the checkout page.
|
|
215
|
+
|
|
180
216
|
* `onPaymentComplete`: This is a callback function that is called when the payment is completed. It contains a payload that will include the amount, default input values, and reference of the payment, as well as some other optional data.
|
|
181
217
|
|
|
182
218
|
* `onGoBack`: This is a callback function that is called when the user clicks the back button on the payment page.
|
|
183
219
|
|
|
184
220
|
* `onInitializePayment`: This is an async function is called just as the payment is about to be initialized and is useful for triggering any actions before the payment is initialized, like validating your custom form or making an api call to validate something with the user's name or email before proceeding with payment. It contains an argument that has the values for the default form inputs, and must return a promise that resolves an object with a `terminate` boolean property. The payment initialization will terminate immediately the promise resolves depending on what the value of `terminate` is.
|
|
185
221
|
|
|
222
|
+
* `onDiscountApplied`: This is a callback that gets called when discount get's applied on checkout.
|
|
223
|
+
|
|
224
|
+
* `onDiscountRemoved`: This is a callback that get's called when discount is removed from the checkout.
|
|
225
|
+
|
|
186
226
|
```typescript
|
|
187
227
|
<MainstackPayments
|
|
188
228
|
paymentConfig={config}
|