#Suren
1 messages · Page 1 of 1 (latest)
Hi 👋 yes, you can use the ID of the Payment Intent to retrieve it from this endpoint:
https://stripe.com/docs/api/payment_intents/retrieve
The response will include the client secret.
You can use Stripe CLI to do it from your terminal:
https://stripe.com/docs/stripe-cli
Toby
error
:
{type: 'invalid_request_error', message: 'Invalid API Key provided: pk_test_*********************aLr"', status: 401}
[[Prototype]]
:
Object
PaymentElement doesnt load for the above error
I am sure I am using the right test key\
I would recommend double checking the key you're using, it should likely have a prefix format of pk_test_
yes yes pk_test_Y**wg0ZOzAguYESkZEAabaLr
I took it from the API keys part of the dashboard in test mode
Okay, and that issue still persists after ensuring that's the value your code is using? Asking because it doesn't seem to match the format in the error message.
Is this a public site that I could take a look at?
{
"type": "invalid_request_error",
"message": "Invalid API Key provided: pk_test_*********************aLr"",
"status": 401
}
yes but I am doing this test offline
bmusician.com is the site
How do I get to the page where the Payment Element is expected to be rendered from there?
I am doing this offline
means locally
in test mode
can you anydesk?
thats the only way at the moment
const stripe = Stripe('pk_test_YUSwg0ZOzAguYESkZEAabaLr"');
const options_ = {
clientSecret: 'pi_3NWIx8I9xjTc4WYW1IqzVqyI_secret_0QAtnIgCwfGRSMjfwTGltBpD5',
// Fully customizable with appearance API.
appearance: {/*...*/ },
};
for now I am just hardcoding the client secret of an payment that is incomplete and trying to authenticate and succeed
the subscription status is incomplete and payment is pending
pk_test_YUSwg0ZOzAguYESkZEAabaLr
Does that work when you put that in the code?
Then I don't know what could be going wrong. I would recommend double checking the key value is correct. If you can put this in a publicly accessible site then I can take a closer look, but currently all I can tell is our API doesn't like the key value your code is providing it.
toby
I found the issue
the way I was stringifying was wrong. Its working now
however, I have a quick question
Now when a user subscribes for the first time, they enter their card info. Then the subscription gets created with the status incomplete and payment status - pending.
Now, I am redirecting them to a page, when they have to enter card details again and complete authentication
is this the only flow
That's a bit vague, but no, there are lots of flows when working with Stripe. That one does not sound ideal, why are you handling it that way?
Because I collect payment info before creating a subscrition
<form action="~/Stripe/Create" method="POST" class="dt-sc-subscription-frm">
<input type="hidden" value="@feetype.TypeID" name="feetypeid">
<input type="hidden" value="@feetype.StripePlanID" name="stripeplanid">
<script src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="pk_test_YUSwg0ZOzAguYESkZEAabaLr"
data-amount=@feetype.AmountInCents
data-name="@feetype.TypeName Subscription"
data-email=@feetype.Email
data-description="Stripe Secure Payment"
@data-image="......\logo_bmu.png"@
data-locale="auto"
data-label="Pay"
data-currency=@feetype.Currency>
</script>
</form>
with something like this
Ah, that is our legacy version of Checkout, I'm honestly not too familiar with it offhand. Is this a new integration you're working on building, if so I wouldn't recommend continuing with that approach and would recommend using one of our newer flows instead.
If you still want the flow of creating a Payment Method first from Checkout, I would recommend taking a look at this flow:
https://stripe.com/docs/payments/save-and-reuse
If you want to collect payment method details, and create a Subscription at the same time, from a single checkout experience, then I would recommend looking at this flow:
https://stripe.com/docs/billing/subscriptions/build-subscriptions