Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for customizing Stripe Checkout parameters #10

Merged
merged 1 commit into from Feb 13, 2022

Conversation

oscarychen
Copy link
Owner

This addresses issue #2.

Some of the checkout parameters are specified in DRF_STRIPE settings:

CHECKOUT_SUCCESS_URL_PATH: The checkout session success redirect url path.
CHECKOUT_CANCEL_URL_PATH: The checkout session cancel redirect url path.
PAYMENT_METHOD_TYPES: The default
default payment method types
, defaults to ["card"].
DEFAULT_CHECKOUT_MODE: The default checkout mode, defaults to "subscription".

By default, you can create a checkout session by calling the default REST endpoint my-site.com/stripe/checkout/, this
REST endpoint utilizes drf_stripe.serializers.CheckoutRequestSerializer to validate checkout parameters and create a
Stripe Checkout Session. Only a price_id is needed, quantity defaults to 1.

You can extend this serializer and customize Checkout behavior, such as specifying multiple line_items
, payment_method_types, and checkout_mode.

See README for more info.

@oscarychen oscarychen merged commit 8713b65 into master Feb 13, 2022
@oscarychen oscarychen deleted the feature/stripe-params branch February 13, 2022 20:00
@joshuakoh1
Copy link
Contributor

Can you also add coupons?

discounts=[{
  'coupon': '{{COUPON_ID}}',
}]

and promo codes

allow_promotion_codes=True

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants