Skip to content
Merged
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
3 changes: 3 additions & 0 deletions packages/react-paypal-js-storybook/v6/src/shared/code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ import { PayPalProvider, PayPalSavePaymentButton } from "@paypal/react-paypal-js
async function createVaultToken() {
const response = await fetch("/api/paypal/create-vault-token", {
method: "POST",
headers: { "Content-Type": "application/json" },
});
const data = await response.json();
return { vaultSetupToken: data.id };
Expand Down Expand Up @@ -118,6 +119,7 @@ import {
async function createOrder() {
const response = await fetch("/api/paypal/create-order", {
method: "POST",
headers: { "Content-Type": "application/json" },
});
const data = await response.json();
return { orderId: data.id };
Expand Down Expand Up @@ -163,6 +165,7 @@ import { PayPalProvider, PayPalGuestPaymentButton } from "@paypal/react-paypal-j
async function createOrder() {
const response = await fetch("/api/paypal/create-order", {
method: "POST",
headers: { "Content-Type": "application/json" },
});
const data = await response.json();
return { orderId: data.id };
Expand Down
15 changes: 12 additions & 3 deletions packages/react-paypal-js-storybook/v6/src/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ export const PAYPAL_CLIENT_ID =
export async function createOrder(): Promise<{ orderId: string }> {
const response = await fetch(
`${SAMPLE_INTEGRATION_API}/paypal-api/checkout/orders/create-order-for-one-time-payment`,
{ method: "POST" },
{
method: "POST",
headers: { "Content-Type": "application/json" },
},
);
const data = await response.json();
return { orderId: data.id };
Expand All @@ -40,7 +43,10 @@ export async function captureOrder(
): Promise<Record<string, unknown>> {
const response = await fetch(
`${SAMPLE_INTEGRATION_API}/paypal-api/checkout/orders/${orderId}/capture`,
{ method: "POST" },
{
method: "POST",
headers: { "Content-Type": "application/json" },
},
);
return response.json();
}
Expand All @@ -50,7 +56,10 @@ export async function captureOrder(
export async function createVaultToken(): Promise<{ vaultSetupToken: string }> {
const response = await fetch(
`${SAMPLE_INTEGRATION_API}/paypal-api/vault/create-setup-token-for-paypal-save-payment`,
{ method: "POST" },
{
method: "POST",
headers: { "Content-Type": "application/json" },
},
);
const data = await response.json();
return { vaultSetupToken: data.id };
Expand Down
Loading