Skip to content

Commit

Permalink
submit order
Browse files Browse the repository at this point in the history
  • Loading branch information
arpit2425 committed May 31, 2020
1 parent 4cb2e92 commit e122034
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<script src="https://js.stripe.com/v3/"></script>
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const CardForm = injectStripe(Checkout);

const StripeWrapper = () => {
return (
<StripeProvider apiKey="pk_test_RmWPHoQAmlEf6RiOlsMRkEeJ00XzgNQe2k">
<StripeProvider apiKey="pk_test_y4RqvASvCbSkcpFMaE473erl00OluYWr6n">
<Elements>
<CardForm></CardForm>
</Elements>
Expand Down
24 changes: 24 additions & 0 deletions src/strapi/submitOrder.js
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
// submit order
import axios from "axios";
import url from "../utils/URL";

async function submitOrder({ name, total, items, stripeTokenId, userToken }) {
const response = await axios
.post(
`${url}/orders`,
{
name,
total,
items,
stripeTokenId,
},
{
headers: {
Authorization: `Bearer ${userToken}`,
},
}
)
.catch((error) => console.log(error));
return response;
}

export default submitOrder;

0 comments on commit e122034

Please sign in to comment.