File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
packages/react-paypal-js-storybook/v6/src/shared Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ import { PayPalProvider, PayPalSavePaymentButton } from "@paypal/react-paypal-js
8484async function createVaultToken() {
8585 const response = await fetch("/api/paypal/create-vault-token", {
8686 method: "POST",
87+ headers: { "Content-Type": "application/json" },
8788 });
8889 const data = await response.json();
8990 return { vaultSetupToken: data.id };
@@ -118,6 +119,7 @@ import {
118119async function createOrder() {
119120 const response = await fetch("/api/paypal/create-order", {
120121 method: "POST",
122+ headers: { "Content-Type": "application/json" },
121123 });
122124 const data = await response.json();
123125 return { orderId: data.id };
@@ -163,6 +165,7 @@ import { PayPalProvider, PayPalGuestPaymentButton } from "@paypal/react-paypal-j
163165async function createOrder() {
164166 const response = await fetch("/api/paypal/create-order", {
165167 method: "POST",
168+ headers: { "Content-Type": "application/json" },
166169 });
167170 const data = await response.json();
168171 return { orderId: data.id };
Original file line number Diff line number Diff line change @@ -29,7 +29,10 @@ export const PAYPAL_CLIENT_ID =
2929export async function createOrder ( ) : Promise < { orderId : string } > {
3030 const response = await fetch (
3131 `${ SAMPLE_INTEGRATION_API } /paypal-api/checkout/orders/create-order-for-one-time-payment` ,
32- { method : "POST" } ,
32+ {
33+ method : "POST" ,
34+ headers : { "Content-Type" : "application/json" } ,
35+ } ,
3336 ) ;
3437 const data = await response . json ( ) ;
3538 return { orderId : data . id } ;
@@ -40,7 +43,10 @@ export async function captureOrder(
4043) : Promise < Record < string , unknown > > {
4144 const response = await fetch (
4245 `${ SAMPLE_INTEGRATION_API } /paypal-api/checkout/orders/${ orderId } /capture` ,
43- { method : "POST" } ,
46+ {
47+ method : "POST" ,
48+ headers : { "Content-Type" : "application/json" } ,
49+ } ,
4450 ) ;
4551 return response . json ( ) ;
4652}
@@ -50,7 +56,10 @@ export async function captureOrder(
5056export async function createVaultToken ( ) : Promise < { vaultSetupToken : string } > {
5157 const response = await fetch (
5258 `${ SAMPLE_INTEGRATION_API } /paypal-api/vault/create-setup-token-for-paypal-save-payment` ,
53- { method : "POST" } ,
59+ {
60+ method : "POST" ,
61+ headers : { "Content-Type" : "application/json" } ,
62+ } ,
5463 ) ;
5564 const data = await response . json ( ) ;
5665 return { vaultSetupToken : data . id } ;
You can’t perform that action at this time.
0 commit comments