@montonio/montonio-js 1.0.58 → 1.0.59

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
@@ -33,7 +33,7 @@ In this case, the library and its components will be available in the global obj
33
33
  const { MontonioCheckout } = window.Montonio;
34
34
  ```
35
35
 
36
- The following examples use the async/await syntax. If you are using `<script>` tags (e.g. in some PHP-based frameworks), you can use `<script type="module">` to use the async/await syntax. Otherwise, you can use the `then` and `catch` syntax for the same effect.
36
+ The following examples use the async/await syntax. If you are using `<script>` tags (e.g. in some PHP-based frameworks), you can use `<script type="module">` to use the async/await syntax. Alternatively, you can use the `then` and `catch` syntax for the same effect.
37
37
 
38
38
  # Usage
39
39
 
@@ -63,7 +63,6 @@ const checkoutOptions = {
63
63
  onError: (error) => {
64
64
  // Payment failed or validation error occurred
65
65
  console.error('Payment failed:', error);
66
- alert('Payment failed. Please try again.');
67
66
  // Unlock your checkout form to allow the user to try again
68
67
  }
69
68
  };
@@ -91,7 +90,9 @@ try {
91
90
 
92
91
  ### 3. Create the order and submit the payment
93
92
 
94
- Once the user has clicked the "Pay" button in your checkout and you have validated the form, you can create the order and submit the payment. First, you need to create a Montonio Order on your server. Follow the [Create and validate an Order](https://docs.montonio.com/api/stargate/guides/orders) guide to create an order. Make sure you include the session UUID in the order request.
93
+ Once the user has clicked the "Pay" button in your checkout and you have validated the form, you can create the order and submit the payment. First, you need to create a Montonio Order on your server. Follow the [Create and validate an Order](https://docs.montonio.com/api/stargate/guides/orders) guide to create an order.
94
+
95
+ Make sure you **include the session UUID in the order request**. See the [Order data structure](https://docs.montonio.com/api/stargate/guides/orders#1-order-data-structure) section of the Orders guide for more details.
95
96
 
96
97
  Once the order is created, you can call the `submitPayment` method on the `MontonioCheckout` instance.
97
98
 
@@ -112,5 +113,3 @@ When the payment completes (successfully or with an error), the appropriate call
112
113
  - **`onError(error)`**: Called when payment fails or validation errors occur.
113
114
 
114
115
  The `returnUrl` is the URL you provided in the backend request to create the order. As per the API documentation, this URL will contain the `order-token` query parameter, which you can use to validate the payment. In most cases, you should redirect the user to the `returnUrl` in your `onSuccess` callback and handle the token validation on that page.
115
-
116
- **Note:** The callbacks will be invoked even if the payment completes without explicitly calling `submitPayment()`, for example if the user completes the payment directly within the embedded payment form.