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

modify checkout connect flow for standard connect #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions 2020-05-07-checkout-wine-shipment/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,24 @@ app.post("/create-checkout-session", async (req, res) => {
return {
...PRODUCT_LIST[id],
quantity: quantity,
currency: 'usd',
currency: 'eur',
}
});


// https://site-admin.stripe.com/docs/payments/checkout/connect#direct-charges
// Create new Checkout session
const session = await stripe.checkout.sessions.create({
payment_method_types: ["card"],
payment_method_types: ["card", "ideal", "bancontact"],
shipping_address_collection: {
allowed_countries: ['US'],
allowed_countries: ['US','NL', 'BE'],
},
line_items: lineItems,
// ?session_id={CHECKOUT_SESSION_ID} means the redirect will have the session ID set as a query param
success_url: `${domainUrl}/success?session_id={CHECKOUT_SESSION_ID}`,
cancel_url: `${domainUrl}`,
}, {
stripeAccount: process.env.STRIPE_CONNECTED_ACCOUNT_ID,
});

res.json({
Expand Down
4 changes: 3 additions & 1 deletion 2020-05-07-checkout-wine-shipment/server/views/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@
</div>

<script>
const stripe = Stripe('pk_test_254YMVH1T73Zf6tG4quL78KX00VCYOdZPx');
const stripe = Stripe('pk_test_hKnxuMssP5ake8fyO674QBi100SK0c1Qfx', {
stripeAccount: 'acct_1Gnyp9FEOafZSXoi'
});

// Keys: product ids. Values: quantity.
const productSelections = {};
Expand Down