stripe-samples / checkout-one-time-payments Goto Github PK
View Code? Open in Web Editor NEWUse Checkout to quickly collect one-time payments.
Home Page: https://checkout.stripe.dev/?mode=payment
License: MIT License
Use Checkout to quickly collect one-time payments.
Home Page: https://checkout.stripe.dev/?mode=payment
License: MIT License
I want integrate with Stripe Checkout Client in my asp.net application.
Before I integrate, I am testing sample check-out-onetime-payment project in GitHub.
I also already created stripe account.
I want to test with test mode Public Key and Secret Key first before I go live.
So, I tested sample check-out-onetime-payment project in GitHub using my test mode Public Key and Secret Key.
But, I got Integration Error : No such SKU when called redirectToCheckout.
Mean, cannot test with test mode Public Key and Secret Key?
Please give me any other suggestion.
Thanks a lot.
A clear and concise description of what the bug is. I need a payment method bypass so i can get what I ordered for free
Steps to reproduce the behavior, please provide code snippets or a repository:
A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.
Add any other context about the problem here.
In the readme, specifically the "How to run locally section". The current link to the client-only setup instructions is broken and directs to a Github 404.
I followed the instructions in the README but when I click on the "Buy for $9.99" button, it changes to "Loading..." and never returns. the app just hangs and on the console I see only:
./src/components/Checkout.js
Line 61:5: Duplicate key 'price' no-dupe-keys
I'm attempting my first Stripe integration but so far not looking very good. this is dead on arrival
In the client-side script.js file there's a createCheckoutSession function that uses fetch() to hit the /create-checkout-session endpoint and return the JSON it gets. There are two huge problems with this function: A) it exists; it's only used once in one place, forcing me to jump from one place to another in the code to follow the code path, which needlessly complicates the code and makes it more difficult to follow rather than having the content of this function inline, making things nice and linear and easier to understand, and B) it doesn't handle JSON parsing errors at all, so things just fall off a cliff with the aforementioned cryptic JSON parse error if everything doesn't work perfectly.
Most users use php but not slim, let's try to make that easier to work with.
1sun
A clear and concise description of what the bug is.
Steps to reproduce the behavior, please provide code snippets or a repository:
A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.
Add any other context about the problem here.
The {{lng}} parameter is e.g. en-US, so the file requested is en-US.json, while the file available is en.json, so it causes a 404 but then fetches the correct file via the fallback.
Ideal fix is to apply a similar fix to the one done here:
7045bf1
Alternatively, add a whitelist parameter to line 9 which will make this automatically fallback without the 404.
The link to the flowchart is broken.
When the Buy button is pressed...
I get POST http://127.0.0.1:4242/create-checkout-session 403 (FORBIDDEN)
error...
Following the instructions in README file, I managed to run the python test server. All steps, including creating an account, getting test keys, etc are completed.
On my integration of the Stripe checkout it seems to be possible to send the cancel request multiple times by clicking repeatly on the button.
This leads to errors when the payment token is invalidated after use.
The price cannot be shown
There is no price value and you cannot checkout
A clear and concise description of what the bug is.
Steps to reproduce the behavior, please provide code snippets or a repository:
Checkout
A clear and concise description of what you expected to happen.
https://drive.google.com/file/d/1OqnHijGq9jzwrOUk0fbSEu6e17Opjk6i/view?usp=sharing
If applicable, add screenshots to help explain your problem.
iOS 12.4.8 with Safari
Add any other context about the problem here.
Hello, thank you for the project.
I am using client and server / PHP and I have the following bug when clicking on 1st page button so there is no redirection to checkout page
Uncaught (in promise) SyntaxError: Unexpected token < in JSON at position 0
Promise.then (async)
(anonymous) @ script.js:115
Please only file issues here that you believe represent actual bugs or feature requests for this sample.
If you're having general trouble with your Stripe integration, please reach out to support using the form at https://support.stripe.com/ (preferred) or via email to [email protected].
If you are reporting a bug, please include the server language you're using, as well as any other details that may be helpful in reproducing the problem.
Returned JSON does not include the name/ title of the purchase. In the example "Pacha Photo"
Add any other context about the problem here.
.env.example
# DOMAIN="http://localhost:3000" # When using the React client
I lost some work time because of this and I just don't want it to happen to someone else :)
Essentially, I uncommented this line, and commented the one on top, because I'm using react. Intellisense was still showing the same-line comment as commented out, but when we use dotenv to grab that line, it picks up the the url + comment at the end of the line and sends them to the server as 1 string.
Stripe-Checkout Unable to execute
Session session = Session.create(createParams);
Stripe return msg: java.lang.IllegalArgumentException: Refusing to create type reflection-based type adapter for external class: com.google.gson.JsonObject
In:client-only/client/index.html
Stripe โ Cliente Only Integration โ Fixing Bug
https://medium.com/@sssimple.33/stripe-cliente-only-integration-fixing-bug-c6087dda902f
from: var DOMAIN = window.location.host (default in the example)
to: var DOMAIN = window.location.origin
When creating a Checkout Session, we should use this environment variable to pass the list of supported payment method types.
payment_method_types
argument.crashes returns Invalid Host header
A clear and concise description of what the bug is.
click the react demo link
Steps to reproduce the behavior, please provide code snippets or a repository:
A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.
Add any other context about the problem here.
Hi,
Everything is working perfect , I want to upload my website to live server , what permission should I assign to config.ini .
Permission means 644 or what
We should either remove all localization from the sample, or make sure the locale is passed when creating the checkout session in all servers.
There is an additional word in the typo where it shouldn't be.
ln 97:
STATIC_DIR` tells the server where to the client files are located and does not need to be modified unless you move the server files.
Should be:
STATIC_DIR
tells the server where the client files are located and does not need to be modified unless you move the server files.
https://github.com/stripe-samples/checkout-one-time-payments/pull/503/files
Correct the typo.
PR Submitted to resolve:
#503
This Var: var basicPhotoButton = document.getElementById('basic-photo-button');
not in the HTML file.
Can I use this project to list more than one item per page? How can we achieve this? ADD more price vars in .env and edit the script.js in client update server.js in server to retrieve the price
ran the sample using npm start. Getting the Error: No such plan: 'price_12345'
error. Am I missing some configuration step?
On the localhost:4242 url in browser, I am getting ```
Uncaught ReferenceError: config is not defined
at HTMLButtonElement.updateQuantity (script.js:40)
> [email protected] start C:\temp\checkout-one-time-payments\client-and-server\server\node
> node server.js
Node server listening on port 4242!
(node:8740) UnhandledPromiseRejectionWarning: Error: No such plan: 'price_12345'
at Function.generate (C:\temp\checkout-one-time-payments\client-and-server\server\node\node_modules\stripe\lib\Error.js:39:16)
at IncomingMessage.<anonymous> (C:\temp\checkout-one-time-payments\client-and-server\server\node\node_modules\stripe\lib\StripeResource.js:190:33)
at Object.onceWrapper (events.js:417:28)
at IncomingMessage.emit (events.js:323:22)
at endReadableNT (_stream_readable.js:1204:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:8740) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:8740) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:8740) UnhandledPromiseRejectionWarning: Error: No such plan: 'price_12345'
at Function.generate (C:\temp\checkout-one-time-payments\client-and-server\server\node\node_modules\stripe\lib\Error.js:39:16)
at IncomingMessage.<anonymous> (C:\temp\checkout-one-time-payments\client-and-server\server\node\node_modules\stripe\lib\StripeResource.js:190:33)
at Object.onceWrapper (events.js:417:28)
at IncomingMessage.emit (events.js:323:22)
at endReadableNT (_stream_readable.js:1204:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:8740) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
is there a Discord group, Telegram or IRC channel, or any other kind of place where developers struggling with Stripe congregate to help each other?
if not, could you guys create one and publish its existence for the sake of those of us struggling?
Hi,
When incrementing using front end code provided by the sample demo in the repository (using both client and server code), I experience this error:
And it points to this part of the code (pictured below)
You'll notice the document object ID is different than what's in the sample, this was just me changing it on the front end and the JS to see if I could gain control over what was wrong.
What can I do or should I do differently to avoid this?
I have successfully created checkout form in php. it 's not showing google pay or apple pay buttons on my checkout form. they both have been by default ON in my dashboard. so what could be the problem.
What i need :
https://i.imgur.com/a06wtgH.png?1
What i have :
https://i.imgur.com/FnXl4KA.png?1
Any Reply Would be Greatly Appreciated.
Thanks.
Thanks to the pre-built example which is really nice! But I have a confusion about the Apply Pay & Google Pay document for Stripe Checkout (the pre-built Stripe hosted page).
On the doc https://stripe.com/docs/apple-pay?platform=web#accept it says You can start accepting Apple Pay payments on the Web using Checkout or Elements. No additional configuration is required to use Apple Pay in Checkout.
It directs me to the example code to the Payment Request Button
if using Element
.
But I don't see any example code that uses pre-built Checkout with Apple pay or Google Pay. I am confused about how to implement Apple Pay and Google Pay just with pre-built Checkout?
I tried with https://checkout.stripe.dev/preview to explore the Checkout, and on the 3rd step there is a button with Apply Pay, but nothing is there and still no clue how to implement it.
I found there is an issue stripe-samples/accept-a-payment#1 stating Unfortunately, all of the payment request demos have so many restrictions around https and having cards setup in chrome / google pay settings that it'll be hard for anyone to test locally.
Is this the reason why there is no sample code for apply pay?
Thanks! Any help is really appreciated!
Good Morning,
First of all, i really appreciate the hard work done in the repo.
I have successfully integrated Stripe Checkout with one of the projects i am working on,
but I have a small inquiry, is it possible to show the Checkout page in an iframe instead of redirecting the user to the stripe domain ?
I want to let the user feels that he is still on my website instead of multiple redirections
Thanks in advance
Hi I want to use client only integration but I want to use a PRODUCT_ID rather than PRICE_ID
The reason being is I am charging shipping, so the product is shipping, but the price varies depending on region. So I want to be able to send the PRDUCT_ID with a custom Price derived from my form. AKA inline Price. How would I go about modifying the script to enable this.
`
var PRICE_ID = "price_1234";
if (PUBLISHABLE_KEY === "pk_1234") {
console.log(
"Replace the hardcoded publishable key with your own publishable key: https://dashboard.stripe.com/test/apikeys"
);
}
if (PRICE_ID === "price_1234") {
console.log(
"Replace the hardcoded SKU ID with your own SKU: https://stripe.com/docs/api/skus"
);
}
`
A clear and concise description of what the bug is.
Steps to reproduce the behavior, please provide code snippets or a repository:
A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.
Add any other context about the problem here.
In client-and-server/client/script.js
, a function called handleResult
has been defined twice in line 70 and 96. Which would be prone to inconsistency.
/* Handle any errors returns from Checkout */
var handleResult = function(result) {
if (result.error) {
var displayError = document.getElementById("error-message");
displayError.textContent = result.error.message;
}
};
// Create a Checkout Session with the selected quantity
var createCheckoutSession = function(stripe) {
var inputEl = document.getElementById("quantity-input");
var quantity = parseInt(inputEl.value);
return fetch("/create-checkout-session", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
quantity: quantity
})
}).then(function(result) {
return result.json();
});
};
// Handle any errors returned from Checkout
var handleResult = function(result) {
if (result.error) {
var displayError = document.getElementById("error-message");
displayError.textContent = result.error.message;
}
};
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.