You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What are you trying to accomplish?
Hi, I'm trying to redirect the customer on a custom subscription confirmation page of my app, with this code :
@login_requireddefsubscription_confirm(request):
# set our stripe keys upstripe.api_key=djstripe_settings.STRIPE_SECRET_KEY# get the session id from the URL and retrieve the session object from Stripesession_id=request.GET.get("session_id")
session=stripe.checkout.Session.retrieve(session_id)
# get the subscribing user from the client_reference_id we passed in aboveclient_reference_id=int(session.client_reference_id)
subscription_holder=get_user_model().objects.get(id=client_reference_id)
# sanity check that the logged in user is the one being updatedassertsubscription_holder==request.user# get the subscription object form Stripe and sync to djstripesubscription=stripe.Subscription.retrieve(session.subscription)
djstripe_subscription=Subscription.sync_from_stripe_data(subscription)
# set the subscription and customer on our usersubscription_holder.subscription=djstripe_subscriptionsubscription_holder.customer=djstripe_subscription.customersubscription_holder.save()
# show a message to the user and redirectmessages.success(request, f"You've successfully signed up. Thanks for the support!")
returnrender(request, 'dashboard/subscription-complete.html')
But I have an error : You did not provide an API key. You need to provide your API key in the Authorization header, using Bearer auth (e.g. 'Authorization: Bearer YOUR_SECRET_KEY').
How can I do that ?
Thanks !
The text was updated successfully, but these errors were encountered:
What are you trying to accomplish?
Hi, I'm trying to redirect the customer on a custom subscription confirmation page of my app, with this code :
But I have an error : You did not provide an API key. You need to provide your API key in the Authorization header, using Bearer auth (e.g. 'Authorization: Bearer YOUR_SECRET_KEY').
How can I do that ?
Thanks !
The text was updated successfully, but these errors were encountered: