# Stripe Checkout (payment + price id)

Link to stripe docs: <https://docs.stripe.com/api/checkout/sessions/create>&#x20;

***

### Parameters:

<details>

<summary>success_url</summary>

In this field you should enter the URL that the user will be taken to once they make a successful payment.&#x20;

Link to Stripe docs: <https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-success_url>

</details>

<details>

<summary>cancel_url</summary>

In this field you should enter the URL that the user should be taken to when they cancel the payment.&#x20;

Users cancel the payment by clicking the back button in the checkout session portal.&#x20;

</details>

<details>

<summary>line_items(price_id)</summary>

In this field you should enter the price id of a product you have created in stripe.

Your price id should look something like this: **price\_1PbaGKLpgKvw6WCMvjvexif**

</details>

<details>

<summary>line_items (quantity)</summary>

In this field you should enter the quantity of the line item being purchased

Link to Stripe docs: <https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-line_items-quantity>

</details>

<details>

<summary>mode</summary>

In this field you should enter the following value: **payment**

This parameter typically takes in one of the following values:

payment - Accept one-time payments for cards, iDEAL, and more.

setup - Save payment details to charge your customers later.

subscription - Use Stripe Billing to set up fixed-price subscriptions.

Here is a link to the relevant Stripe documentation: <https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-mode>

</details>

<details>

<summary>metadata[custom_value] (optional)</summary>

If you need to pass custom data through the checkout session you can do so by creating custom fields in the metadata, you can create as many as needed, all you have to do is replace "custom\_value" with a name that makes sense for your use case.&#x20;

When a response is returned from a checkout session, you will be able to access these custom values.&#x20;

As an example, you might create a field called metadata\[users\_bubble\_id], then when a checkout session is created you enter the current users id into this field. When the user completes a checkout session you will get a response and in that response under 'metadata', you will have access to the user id you entered.&#x20;

</details>

<details>

<summary>customer_id</summary>

In this field you should enter the users stripe customer id.

This field is not required to capture a payment however with a customer id you are able to easily identify and save information about customers with stripe.&#x20;

</details>

<details>

<summary>Adjustable quantity (optional)</summary>

If your users will be choosing the quantity, you will need to append the following code to the api calls body.

{% code overflow="wrap" %}

```markup
&line_items[0][adjustable_quantity][enabled]=_*_adjustable_quantity_enabled_*_&&line_items[0][adjustable_quantity][minimum]=_*_adjustable_quantity_minimum_*_line_items[0][adjustable_quantity][maximum]=_*_adjustable_quantity_maximum_*_
```

{% endcode %}

This code introduces the following parameters:

* adjustable\_quantity\_enabled - this field should be set to either "true" or "false".&#x20;
* adjustable\_quantity\_minimum - In this field you should enter the minimum quantity the user is able to select.&#x20;
* adjustable\_quantity\_maximum - In this field you should enter the maximum quantiy the user is able to select.&#x20;

**Note that the "quantity" field is still required as this will be used to set the initial quantity.**&#x20;

Link to Stripe docs: <https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-line_items-adjustable_quantity>

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://apg-software-solutions.gitbook.io/bubblebase/apis/stripe/stripe-checkout-payment-mode/stripe-checkout-payment-+-price-id.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
