## Create a ConfirmationToken with Elements

`stripe.createConfirmationToken(options: object)`

Convert payment information collected by Elements into a [ConfirmationToken](https://docs.stripe.com/api/confirmation_tokens.md) object. Use this method if you want to [confirm payment on your server](https://docs.stripe.com/payments/finalize-payments-on-the-server.md) or [confirm payment on a subsequent page](https://docs.stripe.com/payments/build-a-two-step-confirmation.md).

- `options`
  - `elements`
    The [Elements](#payment_element_create) instance that was used to create the Express Checkout Element or Payment Element. Calling `stripe.createConfirmationToken` pulls payment method, billing address, and shipping address data from the Elements instance.
  - `params`
    Parameters that will be passed on to the Stripe API.
  - `payment_method_data`
    When you call `stripe.createConfirmationToken`, payment details are collected from Elements. You can include additional `payment_method_data` fields, which will be merged with the data collected from Elements. Refer to the [PaymentMethod API](https://docs.stripe.com/api/payment_methods/create.md) for a full list of parameters.
  - `billing_details`
    [Billing information](https://docs.stripe.com/api/payment_methods/create.md#create_payment_method-billing_details) associated with the PaymentMethod that may be used or required by particular types of payment methods.
  - `allow_redisplay`
    Indicates whether the payment method can be displayed to the customer in subsequent checkout flows. The value passed here will override the [allow_redisplay](docs/api/payment_methods/object#payment_method_object-allow_redisplay) determined by the provided `elements` parameter.
  - `shipping`
    The [shipping details](https://docs.stripe.com/api/payment_intents/object.md#payment_intent_object-shipping) for the payment, if collected. You can't specify `shipping` if `mode: 'setup'` is specified on the `elements` object.
    **Note**: When the [Address Element](https://docs.stripe.com/js/element/address_element.md) in shipping mode is being used, shipping address details are collected from the Address Element. You can also include additional `shipping` fields, which will be merged with the data collected from the Element, overriding any fields that were also collected by the Address Element.
  - `return_url`
    The URL to redirect your customer back to after they authenticate or cancel their payment on the payment method's app or site. If you'd prefer to redirect

### Example
```javascript
const stripe = await loadStripe('pk_test_...');
const elements = stripe.elements();

const paymentElement = elements.create('payment');
paymentElement.mount('#payment-element');

// Use stripe.createConfirmationToken to confirm payment on your server
// or on a subsequent page.
const token = await stripe.createConfirmationToken({
  elements: elements,
  params: {
    // Add any additional parameters you want to pass to the Stripe API
  },
});
```